使用cygwin64构建qt失败。错误信息是“ qWindowsVersionInfo()未定义引用”

问题描述 投票:0回答:1

我想学习如何在Windows 10(cygwin64)上为其他Linux交叉编译构建qt。但是我遇到了一些错误。

所以我尝试了最简单的配置。但是我仍然遇到链接错误(未找到符号qWindowsVersionInfo)。

我尝试在cygwin64 shell中最简单的配置:

cd /cygdrive/d/Qt/qt-build
../qt-everywhere-src-5.12.3/configure -v -platform cygwin-g++

但是我有错误:

g++ -o "../bin/qmake" ...<many obj files>
qglobal.o:In the function ‘winSp_helper’:
/cygdrive/d/Qt/qt-everywhere-src-5.12.3/qtbase/src/corelib/global/qglobal.cpp:2098:‘qWindowsVersionInfo()’ undefined reference
/cygdrive/d/Qt/qt-everywhere-src-5.12.3/qtbase/src/corelib/global/qglobal.cpp:2098:(.text+0x179): truncated re-addressing to match: R_X86_64_PC32 for undefined symbol qWindowsVersionInfo()
qglobal.o: In the function ‘osVer_helper’:
/cygdrive/d/Qt/qt-everywhere-src-5.12.3/qtbase/src/corelib/global/qglobal.cpp:2114:(.text+0x33a): truncated re-addressing to match: R_X86_64_PC32 for undefined symbol qWindowsVersionInfo()
collect2: Error: ld returns 1
make: *** [Makefile:189:../bin/qmake] Error 1

我发现在源代码D:\ Qt \ qt-everywhere-src-5.12.3 \ qtbase \ src \ corelib \ global \ qoperatingsystemversion_win.cpp中定义的qWindowsVersionInfo函数

并且我读取生成的Makefile(D:\ Qt \ qt-build \ qtbase \ qmake \ Makefile):qoperatingsystemversion_win.o:

$(SOURCE_PATH)/src/corelib/global/qoperatingsystemversion_win.cpp
    $(CXX) -c -o $@ $(CXXFLAGS) $<

因此目标存在。

但是任何人都未引用qoperatingsystemversion_win.o。

错误行(g ++ -o“ ../bin/qmake” ...)是由该目标生成的:

$(BUILD_PATH)/bin/qmake$(EXEEXT): $(OBJS) $(QOBJS) qlibraryinfo.o
    $(CXX) -o "$@" $(OBJS) $(QOBJS) qlibraryinfo.o $(LFLAGS)

它不使用qoperatingsystemversion_win.o目标。

如何使用qoperatingsystemversion_win.o目标?此Makefile由configure命令生成。我无法更改它。

在这种情况下哪个平台是正确的? win32-g ++或cygwin-g ++吗?

如果更改为cygwin-g ++,则将cat Makefile.unix.unix配置为最终的Makefile。我有错误。

如果更改为win32-g ++,请配置将Makefile.unix.win32命名为最终的Makefile。我立即有一个新错误:

g++ -c o main.o ......
/cygdrive/d/Qt/qt-everywhere-src-5.12.3/qtbase/qmake/main.cpp: In the function ‘int installFileOrDirectory(const QString&, const QString&)’:
/cygdrive/d/Qt/qt-everywhere-src-5.12.3/qtbase/qmake/main.cpp:303:15: Error: ‘::symlink’ is not declared

它仍然无法正常运行。

所以请告诉我Windows 10上win32-g ++和cygwin-g ++的区别。

c++ qt hyperlink configure
1个回答
0
投票

我也有这个问题...是否有修复程序?

© www.soinside.com 2019 - 2024. All rights reserved.