opencv - 在macports上使用opencv编译代码

我已经使用通过macports安装的opencv编译了代码。但是,在运行我的makefile时,我得到

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)

这是否意味着所有库都未链接?我该怎么办?

最佳答案

问题是您正在为一种体系结构(可能是x86_64,即Intel 64位)编译代码,并且要求macport用i386体系结构(即32位)构建。

因此,您需要更改一个或另一个。

1)更改代码-将-arch x86_64添加到编译规则中gcc的选项中。

2)卸载macports,然后重新安装,然后在macports.conf文件中选择所需的build_arch,并检查应该同时默认为两者的Universal_archs。

https://stackoverflow.com/questions/6299656/

相关文章:

opencv - 边缘检测iPhone OpenCV

opengl - OpenCV 2.2窗口在OpenGL上引起问题

opencv - OpenCV和学生尺寸证明

android - 在Android Eclipse项目中导入OpenCV

opencv - cvMulTransposed和输出矩阵的尺寸?

windows - 建立cvhaartraining.lib

opencv - 使用 openCV 检测由红外光突出显示的图案

dll - OpenCV版本的有意混合

opencv - 我们如何在opencv中启动和停止网络摄像头?

iphone - 为什么在没有旋转代码的情况下在OpenCV中旋转图像?