我想研究下如何在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
我發現在源代碼找到了qWindowsVersionInfo函式。D:\Qt\qt-everywhere-src-5.12.3\qtbase\src\corelib\global\qoperatingsystemversion_win.cpp
我分析了生成的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命令自動生成的,無法手工改變
另外,我不清楚在這種情況下哪個 -platform 是正確的? win32-g ++或cygwin-g ++?
如果我更改為cygwin-g++,configure 命令將使用 cat Makefile.unix.unix 配置為最終的Makefile。出錯
如果我改為win32-g++,configure就會將 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上,platform 為 win32-g++和cygwin-g++的區別。謝謝!
uj5u.com熱心網友回復:
不要用cyg,用msys2直接自動安裝,qwt ssl全有了uj5u.com熱心網友回復:
我的博客里有一些sys2文章轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/140372.html
標籤:Qt
上一篇:安卓textView問題
