2

I'm trying to get boost 1.53 to link to an app that is compiled for i386. This is on a mac that is 64 bit. It seems that boost is getting built by default as 64 bit so when I try to link to it, I get this error:

ld: warning: ignoring file /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk/usr/local/lib/libboost_system.dylib, file was built for unsupported file format which is not the architecture being linked (i386)

I tried building boost via this command:

./b2 toolset=darwin cxxflags="-arch i386" address-model=32 stage

But it doesn't seem to make a difference. My linker settings are

-lboost_system -lboost_thread

Do I need to build boost a different way, or link to it differently?

Edit

Just figured out that this command seems to build it correctly:

./b2 toolset=darwin cxxflags="-arch i386" address-model=32 architecture=x86 stage

and do the same for install

./b2 install toolset=darwin cxxflags="-arch i386" address-model=32 architecture=x86 stage

4

1 回答 1

3

您需要在目标配置中选择架构 i386:(Valid ArchitecturesBuild Setting您的目标中)

但是,如果您正在构建应用程序,则有两种解决方案:

  • 构建应用程序 32 位,构建库的 32 位版本。
  • 构建 64 位应用程序。为此,请替换i386x86_64和更改Architectures以及Valid Architectures

在此处输入图像描述

于 2013-03-24T01:08:44.117 回答