Xcode4 构建 axis2/c 库的链接器问题
我正在使用 axis2/c webservices 框架构建一个简单的 c 库。我可以在命令行中使用 gcc 构建我的库,但在 Xcode4 中成功配置我的项目时遇到困难。
在命令行中的以下构建有效:
gcc -shared -o liblatlon2pcde.so -I$AXIS2C_HOME/include/axis2-1.6.0/ \
-L$AXIS2C_HOME/lib -laxutil -laxis2_axiom -laxis2_parser -laxis2_engine \
-lpthread -laxis2_http_sender -laxis2_http_receiver latlon2pcde.c \
latlon2pcde_skeleton.c
在 Xcode4 中,我已通过类似的构建设置进行配置
用户定义的
AXIS2C_HOME /usr/local/axis2c
标头搜索路径
${AXIS2C_HOME}/include/axis2-1.6.0
库搜索路径
${AXIS2C_HOME}/lib
其他链接器标志
-laxutil -laxis2_axiom -laxis2_parser -laxis2_engine -lpthread -laxis2_http_sender -laxis2_http_receiver
但是,构建失败,报告找不到 -laxutil
ld: library not found for -laxutil
Command /Developer/usr/bin/clang failed with exit code 1
完整输出是:
Build target latlon2pcde
Ld /Users/greg/Library/Developer/Xcode/DerivedData/latlon2pcde-diklkgmudvrwwmcnlbjubeshwrqq/Build/Products/Debug/liblatlon2pcde.dylib normal x86_64
cd "/Users/greg/Documents/Development/latlon2pcde/axis2 service"
setenv MACOSX_DEPLOYMENT_TARGET 10.7
/Developer/usr/bin/clang -arch x86_64 -dynamiclib -isysroot /Developer/SDKs/MacOSX10.7.sdk -L/Users/greg/Library/Developer/Xcode/DerivedData/latlon2pcde-diklkgmudvrwwmcnlbjubeshwrqq/Build/Products/Debug -F/Users/greg/Library/Developer/Xcode/DerivedData/latlon2pcde-diklkgmudvrwwmcnlbjubeshwrqq/Build/Products/Debug -filelist /Users/greg/Library/Developer/Xcode/DerivedData/latlon2pcde-diklkgmudvrwwmcnlbjubeshwrqq/Build/Intermediates/latlon2pcde.build/Debug/latlon2pcde.build/Objects-normal/x86_64/latlon2pcde.LinkFileList -install_name /usr/local/lib/liblatlon2pcde.dylib -mmacosx-version-min=10.7 -laxutil -laxis2_axiom -laxis2_parser -laxis2_engine -lpthread -laxis2_http_sender -laxis2_http_receiver -single_module -compatibility_version 1 -o /Users/greg/Library/Developer/Xcode/DerivedData/latlon2pcde-diklkgmudvrwwmcnlbjubeshwrqq/Build/Products/Debug/liblatlon2pcde.dylib
ld: library not found for -laxutil
Command /Developer/usr/bin/clang failed with exit code 1
所以它看起来我的库搜索路径没有进入链接器。有什么想法吗?
I'm building a simple c library using the axis2/c webservices framework. I can get my library to build using gcc at the command line, but am having difficulties configuring my project successfully in Xcode4.
The following build at the command line works:
gcc -shared -o liblatlon2pcde.so -I$AXIS2C_HOME/include/axis2-1.6.0/ \
-L$AXIS2C_HOME/lib -laxutil -laxis2_axiom -laxis2_parser -laxis2_engine \
-lpthread -laxis2_http_sender -laxis2_http_receiver latlon2pcde.c \
latlon2pcde_skeleton.c
In Xcode4 I've configured by build settings similarly
User- defined
AXIS2C_HOME /usr/local/axis2c
Header Search Paths
${AXIS2C_HOME}/include/axis2-1.6.0
Library Search Paths
${AXIS2C_HOME}/lib
Other linker flags
-laxutil -laxis2_axiom -laxis2_parser -laxis2_engine -lpthread -laxis2_http_sender -laxis2_http_receiver
However the build fails reporting that -laxutil could not be found
ld: library not found for -laxutil
Command /Developer/usr/bin/clang failed with exit code 1
The full output is:
Build target latlon2pcde
Ld /Users/greg/Library/Developer/Xcode/DerivedData/latlon2pcde-diklkgmudvrwwmcnlbjubeshwrqq/Build/Products/Debug/liblatlon2pcde.dylib normal x86_64
cd "/Users/greg/Documents/Development/latlon2pcde/axis2 service"
setenv MACOSX_DEPLOYMENT_TARGET 10.7
/Developer/usr/bin/clang -arch x86_64 -dynamiclib -isysroot /Developer/SDKs/MacOSX10.7.sdk -L/Users/greg/Library/Developer/Xcode/DerivedData/latlon2pcde-diklkgmudvrwwmcnlbjubeshwrqq/Build/Products/Debug -F/Users/greg/Library/Developer/Xcode/DerivedData/latlon2pcde-diklkgmudvrwwmcnlbjubeshwrqq/Build/Products/Debug -filelist /Users/greg/Library/Developer/Xcode/DerivedData/latlon2pcde-diklkgmudvrwwmcnlbjubeshwrqq/Build/Intermediates/latlon2pcde.build/Debug/latlon2pcde.build/Objects-normal/x86_64/latlon2pcde.LinkFileList -install_name /usr/local/lib/liblatlon2pcde.dylib -mmacosx-version-min=10.7 -laxutil -laxis2_axiom -laxis2_parser -laxis2_engine -lpthread -laxis2_http_sender -laxis2_http_receiver -single_module -compatibility_version 1 -o /Users/greg/Library/Developer/Xcode/DerivedData/latlon2pcde-diklkgmudvrwwmcnlbjubeshwrqq/Build/Products/Debug/liblatlon2pcde.dylib
ld: library not found for -laxutil
Command /Developer/usr/bin/clang failed with exit code 1
So it looks like my library search path isn't making its way into the linker. Any ideas why?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
显式添加标头搜索和库搜索路径来代替
${AXIS2C_HOME}
。这是垃圾,但应该有用。Add the header search and library search paths explicitly, in place of
${AXIS2C_HOME}
. It's rubbish, but it should work.谜团解开了。似乎这是“项目”和“目标”设置不同的问题,即我更改了其中一个,但没有更改另一个。我从新的构建设置开始,按照我原来的帖子和所有作品中的描述重新应用。如果有疑问,“将其关闭并再次打开”!
Mystery solved. Seems like this was an issue with the "Project" and "Target" settings diverging, ie I'd changed one but not the other. I started with fresh build settings, reapplied as described in my original post and all works. If in doubt "turn it off and turn it back on again"!