2011-06-09 76 views
1

我編譯的代碼已經通過macports安裝了opencv。但是,在運行我的生成文件時,我得到了在macports上用opencv編譯代碼

ld: warning: in /opt/local/lib/libopencv_core.dylib, file was built for unsupported file format which is not the architecture being linked (i386) 
ld: warning: in /opt/local/lib/libopencv_imgproc.dylib, file was built for unsupported file format which is not the architecture being linked (i386) 
ld: warning: in /opt/local/lib/libopencv_highgui.dylib, file was built for unsupported file format which is not the architecture being linked (i386) 
ld: warning: in /opt/local/lib/libopencv_ml.dylib, file was built for unsupported file format which is not the architecture being linked (i386) 
ld: warning: in /opt/local/lib/libopencv_video.dylib, file was built for unsupported file format which is not the architecture being linked (i386) 
ld: warning: in /opt/local/lib/libopencv_features2d.dylib, file was built for unsupported file format which is not the architecture being linked (i386) 
ld: warning: in /opt/local/lib/libopencv_calib3d.dylib, file was built for unsupported file format which is not the architecture being linked (i386) 
ld: warning: in /opt/local/lib/libopencv_objdetect.dylib, file was built for unsupported file format which is not the architecture being linked (i386) 
ld: warning: in /opt/local/lib/libopencv_contrib.dylib, file was built for unsupported file format which is not the architecture being linked (i386) 
ld: warning: in /opt/local/lib/libopencv_legacy.dylib, file was built for unsupported file format which is not the architecture being linked (i386) 
ld: warning: in /opt/local/lib/libopencv_flann.dylib, file was built for unsupported file format which is not the architecture being linked (i386) 

這是否意味着這些庫都沒有鏈接?我能做些什麼呢?

回答

0

的問題是,你正在編譯代碼的一個架構(可能x86_64的即英特爾64位)和你問的MacPorts與i386架構來構建,即32位

所以喲需要改變一個或另一個。

1)更改你的代碼 - 在編譯規則中將-arch x86_64添加到gcc的選項中。

2)卸載macports,然後重新安裝並在macports.conf文件中選擇所需的build_arch,並檢查默認情況下的universal_archs。

+0

奧普斯我想我知道什麼是錯的。在我的上層通用make文件中,有這兩行:CFLAGS + = -arch i386 -arch x86_64 LDFLAGS + = -arch i386 -arch x86_64我刪除了-arch i386 for both and it worked。謝謝! – 2011-06-16 18:42:03