cancel
Showing results for 
Search instead for 
Did you mean: 

library link error in Qt

LeonSu
Associate

Hello,

Do I need to change the version of STM32CubeProgrammer, or is it just an incorrect setting in the .pro file? Please help me fix it. Thank you in advance.

//----------------------------------------------------------------------------------------------------

Environment

ubuntu 22.04
Qt 6.5.3
qmake version 3.1
STM32CubeProgrammer 2.18.0
gcc version 11.4.0

//--------------------------------------------------------------------------------------------------------

qt pro file

QT += core gui

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

CONFIG += c++17
#DEFINES += QT_NO_VERSION_TAGGING

# You can make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0

SOURCES += \
main.cpp \
mainwindow.cpp \
stm32downloader.cpp \
upgradeFirmware.cpp

HEADERS += \
mainwindow.h \
stm32downloader.h

FORMS += \
mainwindow.ui

# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target

API_PATH = "/usr/local/STMicroelectronics/STM32Cube/STM32CubeProgrammer"

INCLUDEPATH += $$API_PATH/api/include
DEPENDPATH += $$API_PATH/api/src

DESTDIR = += $$API_PATH/bin
LIBS += -L"/usr/local/STMicroelectronics/STM32Cube/STM32CubeProgrammer/lib" -lCubeProgrammer_API

RESOURCES += \
icon.qrc

//--------------------------------------------------------------------------------------------------------
The error message from QT

:-1: error: /usr/local/STMicroelectronics/STM32Cube/STM32CubeProgrammer/lib/libCubeProgrammer_API.so: undefined reference to `qt_version_tag@Qt_6.6'
:-1: error: /usr/local/STMicroelectronics/STM32Cube/STM32CubeProgrammer/lib/libCubeProgrammer_API.so: undefined reference to `QString::toUcs4_helper(char16_t const*, long long, char32_t*)@Qt_6'
:-1: error: collect2: error: ld returned 1 exit status
:-1: error: [Makefile:371: +=/stm32FirmwareUpgrade] Error 1

//-------------------------------------------------------------------------------------------------------
2 REPLIES 2
Aziz BRIGUI
ST Employee

Hello @LeonSu,

I managed to reproduce the error you're seeing as well as some other issues with the CubeProgrammer API and Linux. All is logged under Ticket 201804 (This is an internal tracking number not accessible by customers on community).

For now, I'm not finding any workarounds. I will give you an update as soon as anything changes. This will be fixed in a future release.

Aziz


In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
Pavel A.
Evangelist III

It looks like the CubeProgrammer API module wants Qt libraries 6.6 but you have 6.5.3.