我正在使用供应商交叉编译器gcc-4.4.4-glibc-2.11.1-multilib-1.0/arm-fsl-linux-gnueabi
交叉编译QT,并在make
期间收到以下错误。
有谁知道这可能与什么有关?
看起来有些软件包已经用另一个编译器编译,现在有错过匹配?我在这一点上写过吗?
我该如何解决这个问题?
/opt/freescale/usr/local/gcc-4.4.4-glibc-2.11.1-multilib-1.0/arm-fsl-linux-gnueabi/bin/arm-fsl-linux-gnueabi-g++ -Wl,-rpath-link,/mnt/freescale/ltib_10.04_gtt/ltib/rootfs/usr/lib -Wl,-O1 -Wl,-rpath,/opt/qt5/lib -o ../../bin/qmlbundle .obj/main.o -L/mnt/freescale/ltib_10.04_gtt/ltib/rootfs/usr/lib -L/home/user/Downloads/qt5/qtdeclarative/lib -lQt5Qml -L/home/user/Downloads/qt5/qtbase/lib -lQt5Network -lQt5Core -lpthread
.obj/main.o: In function `showHelp()':
main.cpp:(.text+0x2e0): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, int)'
main.cpp:(.text+0x310): undefined reference to `std::ctype<char>::_M_widen_init() const'
main.cpp:(.text+0x368): undefined reference to `std::ctype<char>::_M_widen_init() const'
main.cpp:(.text+0x3a0): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, int)'
main.cpp:(.text+0x3d0): undefined reference to `std::ctype<char>::_M_widen_init() const'
main.cpp:(.text+0x408): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, int)'
main.cpp:(.text+0x438): undefined reference to `std::ctype<char>::_M_widen_init() const'
main.cpp:(.text+0x470): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, int)'
main.cpp:(.text+0x4a0): undefined reference to `std::ctype<char>::_M_widen_init() const'
main.cpp:(.text+0x4d8): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, int)'
main.cpp:(.text+0x508): undefined reference to `std::ctype<char>::_M_widen_init() const'
main.cpp:(.text+0x540): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, int)'
main.cpp:(.text+0x570): undefined reference to `std::ctype<char>::_M_widen_init() const'
main.cpp:(.text+0x5a8): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, int)'
main.cpp:(.text+0x5d8): undefined reference to `std::ctype<char>::_M_widen_init() const'
main.cpp:(.text+0x610): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, int)'
main.cpp:(.text+0x640): undefined reference to `std::ctype<char>::_M_widen_init() const'
main.cpp:(.text+0x678): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, int)'
main.cpp:(.text+0x6a8): undefined reference to `std::ctype<char>::_M_widen_init() const'
main.cpp:(.text+0x700): undefined reference to `std::ctype<char>::_M_widen_init() const'
main.cpp:(.text+0x738): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, int)'
main.cpp:(.text+0x768): undefined reference to `std::ctype<char>::_M_widen_init() const'
.obj/main.o: In function `usage(QString const&, QString const&)':
main.cpp:(.text+0x834): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, int)'
main.cpp:(.text+0x868): undefined reference to `std::ctype<char>::_M_widen_init() const'
main.cpp:(.text+0x8c0): undefined reference to `std::ctype<char>::_M_widen_init() const'
main.cpp:(.text+0xa78): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, int)'
main.cpp:(.text+0xaa8): undefined reference to `std::ctype<char>::_M_widen_init() const'
.obj/main.o: In function `main':
main.cpp:(.text+0x1ebc): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, int)'
main.cpp:(.text+0x1ef4): undefined reference to `std::ctype<char>::_M_widen_init() const'
collect2: ld returned 1 exit status
make[3]: *** [../../bin/qmlbundle] Error 1
我认为这不重要,但如果有人想知道我正在为飞思卡尔iMX51(Cortex-A8)构建QT 5.2.0。
这就是我在make之前配置QT 5.2.0的方式:
./configure -v -opensource -confirm-license -opengl es2 -make libs -device imx5 \
-nomake examples -nomake tests \
-skip qtsvg -skip qtdeclarative -skip qtwebkit -skip qtconnectivity -skip qtmultimedia -skip qtlocation -skip qtactiveqt -qt-freetype -no-openssl -no-nis -no-pch -no-dbus \
-skip qtmacextras -skip qtsensors -skip qtserialport \
-device-option CROSS_COMPILE=/opt/freescale/usr/local/gcc-4.4.4-glibc-2.11.1-multilib-1.0/arm-fsl-linux-gnueabi/bin/arm-fsl-linux-gnueabi- \
-sysroot /mnt/freescale/ltib_10.04_gtt/ltib/rootfs -no-gcc-sysroot \
-prefix /opt/qt5
实际下载了imx5的qmake.conf,其内容如下所示:
include(../common/linux_device_pre.conf)
EGLFS_PLATFORM_HOOKS_SOURCES = $$PWD/qeglfshooks_imx5.cpp
QMAKE_INCDIR += $$[QT_SYSROOT]/usr/include
QMAKE_LIBDIR += $$[QT_SYSROOT]/usr/lib
QMAKE_LIBS_EGL += -lEGL
QMAKE_LIBS_OPENGL_ES2 += -lGLESv2 -lEGL
QMAKE_LIBS_OPENVG += -lOpenVG -lEGL
QMAKE_LFLAGS += -Wl,-rpath-link,$$[QT_SYSROOT]/usr/lib
IMX5_CFLAGS = -march=armv7-a -mfpu=neon -D_LINUX
IMX5_CFLAGS_RELEASE = -O2 $$IMX5_CFLAGS
QMAKE_CFLAGS_RELEASE += $$IMX5_CFLAGS_RELEASE
QMAKE_CXXFLAGS_RELEASE += $$IMX5_CFLAGS_RELEASE
QMAKE_CFLAGS_DEBUG += $$IMX5_CFLAGS
QMAKE_CXXFLAGS_DEBUG += $$IMX5_CFLAGS
include(../common/linux_device_post.conf)
load(qt_config)
答案 0 :(得分:0)
我使用gcc 4.8.0为x86_64交叉编译Qt 5.0.2。我注意到与您的构建存在一些潜在的相关差异:
在配置期间:
-no-gcc-sysroot
。-device-option TOOL_DIR=$(TOOL_DIR)
,其中TOOL_DIR
是工具链的顶级目录(即我的交叉g ++位于$(TOOL_DIR)/bin/
)。这在我的qmake.conf中使用。-platform
参数(虽然我认为这默认为linux-g++-64
)。在我的qmake.conf中:
QMAKE_INCDIR = $${TOOL_DIR}/include $$[QT_SYSROOT]/usr/include
linux_device_post.conf
,因为该文件的内容与我无关,除了调用deviceSanityCheckCompiler
,我添加到qmake.conf。这是我的configure命令(makefile的一部分):
cd $(QT_DIR) && PATH=$(QT_PATH) ./configure -v \
-prefix $(ROOT_DIR) \
-sysroot $(ROOT_DIR) \
-headerdir $(TOOL_DIR)/include \
-hostprefix $(TOOL_DIR) \
-datadir $(TOOL_DIR) \
-examplesdir $(TOOL_DIR) \
-testsdir $(TOOL_DIR) \
-platform linux-g++-64 \
-device linux-vendorname-g++ \
-device-option CROSS_COMPILE=$(TARGET)- \
-device-option TOOL_DIR=$(TOOL_DIR) \
-opensource \
-confirm-license \
-no-accessibility \
-no-javascript-jit \
-no-gui \
-no-widgets \
-no-gif \
-no-libpng \
-no-libjpeg \
-no-openssl \
-no-xcb \
-no-opengl \
-no-glib \
-no-dbus \
-no-cups \
-no-pkg-config \
-optimized-qmake \
-reduce-relocations \
-reduce-exports \
-release \
-make libs \
-no-pch
ROOT_DIR
是根fs的顶级,也是安装Qt库的地方。
QT_DIR
是顶级Qt源目录(以及Qt构建发生的地方)。
QT_PATH
包含$(TOOL_DIR)/bin
,以确保它可以找到我的交叉编译器。
这是我的qmake.conf:
include(../common/linux_device_pre.conf)
COMPILER_FLAGS = -mtune=core-avx-i
#modifications to gcc-base.conf
QMAKE_CFLAGS += $$COMPILER_FLAGS
QMAKE_CXXFLAGS += $$COMPILER_FLAGS
#QMAKE_LFLAGS =
QMAKE_INCDIR = $${TOOL_DIR}/include $$[QT_SYSROOT]/usr/include
QMAKE_CXXFLAGS_CXX11 = -std=c++11
# Sanity check
deviceSanityCheckCompiler()
load(qt_config)
此外,看起来您在连接针对此版本的Qt构建的应用程序时遇到问题,而不是构建Qt本身,对吗?在这种情况下,如果你还没有,你应该调用你为你的工具链构建的qmake(它应该是一个主机可执行文件)。如果你使用cmake,当你找到'Qt时,这个qmake需要首先在路径上。