Skip to main content
Associate II
January 16, 2025
Solved

library link error in Qt

  • January 16, 2025
  • 3 replies
  • 717 views

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

//-------------------------------------------------------------------------------------------------------
Best answer by Aziz BRIGUI

Hello,

Issue fixed in the latest STM32CubeProgrammer v2.20.

Aziz

3 replies

Aziz BRIGUI
Technical Moderator
January 31, 2025

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.
Super User
January 31, 2025

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

 

Aziz BRIGUI
Aziz BRIGUIBest answer
Technical Moderator
July 11, 2025

Hello,

Issue fixed in the latest STM32CubeProgrammer v2.20.

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.