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?
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"!