链接器问题与Xcode4构建axis2 / c库

时间:2011-10-08 09:30:38

标签: c xcode4 linker axis2c

我正在使用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

所以看起来我的库搜索路径没有进入链接器。有什么想法吗?

2 个答案:

答案 0 :(得分:0)

明确添加标题搜索和库搜索路径,代替${AXIS2C_HOME}。这是垃圾,但它应该有用。

答案 1 :(得分:0)

神秘解决了。似乎这是“项目”和“目标”设置分歧的问题,即我改变了一个而不是另一个。我开始使用新的构建设置,按照原始帖子和所有工作中的描述重新应用。如果有疑问“将其关闭并再次打开”!