Qt6 Cross compilation GLIBC_2.29 undefined reference problem
Solved
General and Desktop
-
Hello everyone,
I try to compile qt on ubuntu host machine for target machine.
I successfully compiled the Qt6 Core. But I can not compile simple example with cmake for target.my cmake
cmake_minimum_required(VERSION 3.5) project(HelloQt6 LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_AUTOUIC ON) set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) find_package(Qt6Core) add_executable(HelloQt6 main.cpp) target_link_libraries(HelloQt6 Qt6::Core)
main.cpp
#include <QCoreApplication> #include <QDebug> int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); qDebug()<<"Hello world"; return a.exec(); }
When I run the qt-cmake file to create a makefile there is no problem
But during linking I am getting this:/opt/rpi/rpi-gcc-8.3.0/lib/gcc/arm-linux-gnueabihf/8.3.0/../../../../arm-linux-gnueabihf/bin/ld: /home/user/rpi-sdk/sysroot/usr/lib/arm-linux-gnueabihf//libicui18n.so.67: undefined reference to `log@GLIBC_2.29' /opt/rpi/rpi-gcc-8.3.0/lib/gcc/arm-linux-gnueabihf/8.3.0/../../../../arm-linux-gnueabihf/bin/ld: /home/user/rpi-sdk/sysroot/usr/lib/arm-linux-gnueabihf//libicui18n.so.67: undefined reference to `pow@GLIBC_2.29'
When I check the path libstdc++ is there. With strings tool I can see that
strings /home/user/rpi-sdk/sysroot/usr/lib/arm-linux-gnueabihf/libstdc++.so.6 | grep GLIBCXX GLIBCXX_3.4 GLIBCXX_3.4.1 GLIBCXX_3.4.2 GLIBCXX_3.4.3 GLIBCXX_3.4.4 GLIBCXX_3.4.5 GLIBCXX_3.4.6 GLIBCXX_3.4.7 GLIBCXX_3.4.8 GLIBCXX_3.4.9 GLIBCXX_3.4.10 GLIBCXX_3.4.11 GLIBCXX_3.4.12 GLIBCXX_3.4.13 GLIBCXX_3.4.14 GLIBCXX_3.4.15 GLIBCXX_3.4.16 GLIBCXX_3.4.17 GLIBCXX_3.4.18 GLIBCXX_3.4.19 GLIBCXX_3.4.20 GLIBCXX_3.4.21 GLIBCXX_3.4.22 GLIBCXX_3.4.23 GLIBCXX_3.4.24 GLIBCXX_3.4.25 GLIBCXX_3.4.26 GLIBCXX_3.4.27 GLIBCXX_3.4.28 GLIBCXX_DEBUG_MESSAGE_LENGTH
As I understand my application wants to use 3.4 but why it tries to link to 2.29 version?
Or am I doing something wrong ?Any idea ?
Thank you. -
After linking fom cmake with
set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -Wl,-rpath-link, ${CMAKE_SYSROOT}/usr/lib/${CMAKE_LIBRARY_ARCHITECTURE} -L${CMAKE_SYSROOT}/usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -Wl,-rpath-link,${CMAKE_SYSROOT}/usr/lib/${CMAKE_LIBRARY_ARCHITECTURE} -L${CMAKE_SYSROOT}/usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}")
problem is solved.
Thanks.