我嘗試編譯Qt的應用項目我的小牛計算機上,但得到下面的編譯錯誤。鏈接器錯誤當OSX 10.9部署的Qt 5.2.1應用
我已經通過設置QMAKE變量
QMAKE_MACOSX_DEPLOYMENT_TARGET部署目標設定爲10.9 = 10.9
這並沒有解決這個問題。我懷疑Qt是用錯誤的OSX框架編譯:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/ MacOSX10.8.sdk
當應該使用
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/ MacOSX10.9.sdk
有沒有人遇到了這樣的問題,並找到解決方案?
編譯輸出:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -headerpad_max_install_names -Wl,-syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk -mmacosx-version-min=10.9 -o qt-rodbot-ip.app/Contents/MacOS/qt-rodbot-ip main.o mainwindow.o videoviewer.o MatToQImage.o ipunitcontainer.o smoothingdialog.o unitlist.o units.o thresholddialog.o adaptivethresholddialog.o cannydialog.o contoursdialog.o processing.o capture.o chainwindow.o chainviewer.o morphologydialog.o sobeldialog.o moc_mainwindow.o moc_videoviewer.o moc_ipunitcontainer.o moc_smoothingdialog.o moc_unitlist.o moc_thresholddialog.o moc_adaptivethresholddialog.o moc_cannydialog.o moc_contoursdialog.o moc_processing.o moc_capture.o moc_chainwindow.o moc_chainviewer.o moc_morphologydialog.o moc_sobeldialog.o -F/Applications/Qt/5.2.1/clang_64/lib -L/usr/local/lib/ -lIPChain /usr/local/Cellar/opencv/2.4.6.1/lib/libopencv_calib3d.dylib /usr/local/Cellar/opencv/2.4.6.1/lib/libopencv_contrib.dylib /usr/local/Cellar/opencv/2.4.6.1/lib/libopencv_core.dylib /usr/local/Cellar/opencv/2.4.6.1/lib/libopencv_features2d.dylib /usr/local/Cellar/opencv/2.4.6.1/lib/libopencv_flann.dylib /usr/local/Cellar/opencv/2.4.6.1/lib/libopencv_gpu.dylib /usr/local/Cellar/opencv/2.4.6.1/lib/libopencv_highgui.dylib /usr/local/Cellar/opencv/2.4.6.1/lib/libopencv_imgproc.dylib /usr/local/Cellar/opencv/2.4.6.1/lib/libopencv_legacy.dylib /usr/local/Cellar/opencv/2.4.6.1/lib/libopencv_ml.dylib /usr/local/Cellar/opencv/2.4.6.1/lib/libopencv_nonfree.dylib /usr/local/Cellar/opencv/2.4.6.1/lib/libopencv_objdetect.dylib /usr/local/Cellar/opencv/2.4.6.1/lib/libopencv_ocl.dylib /usr/local/Cellar/opencv/2.4.6.1/lib/libopencv_photo.dylib /usr/local/Cellar/opencv/2.4.6.1/lib/libopencv_stitching.dylib /usr/local/Cellar/opencv/2.4.6.1/lib/libopencv_superres.dylib /usr/local/Cellar/opencv/2.4.6.1/lib/libopencv_ts.dylib /usr/local/Cellar/opencv/2.4.6.1/lib/libopencv_video.dylib /usr/local/Cellar/opencv/2.4.6.1/lib/libopencv_videostab.dylib -framework QtWidgets -framework QtGui -framework QtCore -framework OpenGL -framework AGL
Undefined symbols for architecture x86_64:
"boost::system::system_category()", referenced from:
___cxx_global_var_init2 in main.o
___cxx_global_var_init2 in mainwindow.o
boost::thread_exception::thread_exception(int, char const*) in mainwindow.o
___cxx_global_var_init2 in videoviewer.o
___cxx_global_var_init6 in ipunitcontainer.o
___cxx_global_var_init6 in smoothingdialog.o
___cxx_global_var_init6 in unitlist.o
...
"boost::system::generic_category()", referenced from:
___cxx_global_var_init in main.o
___cxx_global_var_init1 in main.o
___cxx_global_var_init in mainwindow.o
___cxx_global_var_init1 in mainwindow.o
___cxx_global_var_init in videoviewer.o
___cxx_global_var_init1 in videoviewer.o
___cxx_global_var_init in ipunitcontainer.o
...
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [qt-rodbot-ip.app/Contents/MacOS/qt-rodbot-ip] Error 1
11:05:13: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project qt-rodbot-ip (kit: Desktop Qt 5.2.1 clang 64bit)
When executing step 'Make'
11:05:13: Elapsed time: 00:02.
你好像根本就沒有對升壓系統庫鏈接? –
你說得對。這很奇怪,因爲在其他系統上我不需要鏈接boost,因爲它不是一個直接的依賴關係。 – user3293204