Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xcode/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Xcode/GCC链接问题:文件不是必需的体系结构_Xcode_Macos_Gcc_G++_Linker - Fatal编程技术网

Xcode/GCC链接问题:文件不是必需的体系结构

Xcode/GCC链接问题:文件不是必需的体系结构,xcode,macos,gcc,g++,linker,Xcode,Macos,Gcc,G++,Linker,我正在尝试将一个包含boost 1.37和wxwidgets的windows项目移植到Mac上。它编译正常,但链接器为libz.1.dylib提供了一个“文件不是体系结构ppc所需的体系结构”错误,并且与其他几个库的警告消息相同。我还收到libz.1.dylib的“复制动态库”警告 链接器输出如下所示: 使用配置“调试”构建项目“Gemsweeper Mac”的目标“Gemsweeper Mac” 检查依赖项 Ld "/Users/adriangrigore/Documents/Gemsweep

我正在尝试将一个包含boost 1.37和wxwidgets的windows项目移植到Mac上。它编译正常,但链接器为libz.1.dylib提供了一个“文件不是体系结构ppc所需的体系结构”错误,并且与其他几个库的警告消息相同。我还收到libz.1.dylib的“复制动态库”警告

链接器输出如下所示:

使用配置“调试”构建项目“Gemsweeper Mac”的目标“Gemsweeper Mac”

检查依赖项

Ld "/Users/adriangrigore/Documents/Gemsweeper Mac/Gemsweeper MacOS/Gemsweeper Mac/build/Debug/Gemsweeper Mac.app/Contents/MacOS/Gemsweeper Mac" normal i386
    cd "/Users/adriangrigore/Documents/Gemsweeper Mac/Gemsweeper MacOS/Gemsweeper Mac"
    setenv MACOSX_DEPLOYMENT_TARGET 10.4
    /Developer/usr/bin/g++-4.0 -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk "-L/Users/adriangrigore/Documents/Gemsweeper Mac/Gemsweeper MacOS/Gemsweeper Mac/build/Debug" -L/Developer/SDKs/MacOSX10.4u.sdk/usr/local/lib -L/opt/local/lib "-F/Users/adriangrigore/Documents/Gemsweeper Mac/Gemsweeper MacOS/Gemsweeper Mac/build/Debug" -F/Users/adriangrigore/Library/Frameworks -F/Developer/SDKs/MacOSX10.4u.sdk/Library/Frameworks -filelist "/Users/adriangrigore/Documents/Gemsweeper Mac/Gemsweeper MacOS/Gemsweeper Mac/build/Gemsweeper Mac.build/Debug/Gemsweeper Mac.build/Objects-normal/i386/Gemsweeper Mac.LinkFileList" -mmacosx-version-min=10.4 -L/opt/local/lib -L/Users/adriangrigore/wxwidgets-manual/wxMac-2.8.9/lib /opt/local/lib/libboost_system-mt.a /opt/local/lib/libboost_program_options-mt.a /opt/local/lib/libboost_thread-mt.a -arch ppc -arch i386 -framework IOKit -framework Carbon -framework Cocoa -framework System -framework QuickTime -framework OpenGL -framework AGL /Users/adriangrigore/wxwidgets-manual/wxMac-2.8.9/lib/libwx_mac-2.8.a -framework WebKit -lwxexpat-2.8 -lwxtiff-2.8 -lwxjpeg-2.8 -lwxpng-2.8 -lz -lpthread -liconv -framework SDL -framework Cocoa -o "/Users/adriangrigore/Documents/Gemsweeper Mac/Gemsweeper MacOS/Gemsweeper Mac/build/Debug/Gemsweeper Mac.app/Contents/MacOS/Gemsweeper Mac"
ld warning: in /Users/adriangrigore/Documents/Gemsweeper Mac/Gemsweeper MacOS/Gemsweeper Mac/build/Gemsweeper Mac.build/Debug/Gemsweeper Mac.build/Objects-normal/i386/main.o, file is not of required architecture
ld warning: in /Users/adriangrigore/Documents/Gemsweeper Mac/Gemsweeper MacOS/Gemsweeper Mac/build/Gemsweeper Mac.build/Debug/Gemsweeper Mac.build/Objects-normal/i386/variousfunctions-xcode.o, file is not of required architecture
ld warning: in /Users/adriangrigore/Documents/Gemsweeper Mac/Gemsweeper MacOS/Gemsweeper Mac/build/Gemsweeper Mac.build/Debug/Gemsweeper Mac.build/Objects-normal/i386/ParticleLayers.o, file is not of required architecture
ld warning: in /Users/adriangrigore/Documents/Gemsweeper Mac/Gemsweeper MacOS/Gemsweeper Mac/build/Gemsweeper Mac.build/Debug/Gemsweeper Mac.build/Objects-normal/i386/SDLMain.o, file is not of required architecture
ld warning: in /opt/local/lib/libboost_system-mt.a, file is not of required architecture
ld warning: in /opt/local/lib/libboost_program_options-mt.a, file is not of required architecture
ld warning: in /opt/local/lib/libboost_thread-mt.a, file is not of required architecture
ld warning: in /opt/local/lib/libz.dylib, file is not of required architecture
ld warning: in /opt/local/lib/libiconv.dylib, file is not of required architecture
ld: in /opt/local/lib/libz.1.dylib, file is not of required architecture for architecture ppc
collect2: ld returned 1 exit status
ld warning: duplicate dylib /opt/local/lib/libz.1.dylib
ld warning: duplicate dylib /opt/local/lib/libiconv.2.dylib
我对Mac平台还很陌生,所以非常感谢您的帮助

谢谢


Adrian听起来你需要为Mac重新下载或重建boost。不管动态库是什么,你都需要这样做。简单来说,您只需要重新安装库


有了boost,您不需要再次下载整个内容,源代码本身是多平台的,只是二进制文件(libs等)在不同平台之间发生变化。很可能您已经下载了所有源代码,所以您只需要从源代码重建库。提供有关使用bjam构建boost的一些信息。我知道在windows上他们已经预编译了二进制文件,但在Mac的boost网站上我看不到这方面的任何信息

从您收到的消息来看,大多数Gemsweeper Mac和libboost都是用ppc作为架构编译的。您应该配置Xcode以生成通用二进制文件,并可能通过MacPorts重新编译libboost。最近的MacPorts有一个“通用”目标,这可能会有所帮助,尽管如果您不打算在ppc上运行它,您只需要重新编译它


您似乎还需要重新编译zlib和libiconv。

使用sudo port xxx install+universal帮助卸载和重新安装zlib和libiconv(以及十几个其他依赖的lib)。感谢您的快速回复!:-)

您需要针对本机架构,而不是两个架构。。“宇宙”的概念

这涉及到将xcode设置为“构建机器的本机架构”、“仅构建活动架构”和“有效架构”,具体取决于您的xcode版本。但是清除所有可能的架构变体

这是因为使用默认的
/b2安装
的boost只会获得本机架构

尝试使用
/b2安装工具集=英特尔重新安装boost

一个可能的(未经尝试的)解决方案是构建两次boost

英特尔
/b2安装--prefix=/usr/local/x64 toolset=intel


原生
/b2安装——前缀=/usr/local/ppc

4年是猎豹的步伐。事实上,它也适用于将来使用asio的其他PEEP。我遇到了同样的问题,花了我一天或更长的时间才解决了这个令人困惑的问题。现在它的ssl错误。你试过ssl服务器了吗。