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?

user524261
  • 488
  • 1
  • 5
  • 14
  • Yeah, it looks like you are right; there should be a `-L/usr/local/axis2c` in the command line. Are you using this for client-side webservices access? I'd like to know what made you choose *this* framework over others (I want to do webservices access myself shortly)? – trojanfoe Oct 08 '11 at 10:02
  • I'm using this to write a service running in the apache axis module. One bonus for me is that it supports REST to some degree, I'm not too interested in SOAP yet. You might want to check out gSoap if REST support isn't a requirement. – user524261 Oct 08 '11 at 10:24
  • Yeah I was also looking at gsoap. I want to do webservices client access from iOS however, which might be fun to get working... – trojanfoe Oct 08 '11 at 10:27
  • Yes, it's not a trivial undertaking. I made a client using gSoap in iOS which worked pretty well. I don't believe axis2/c has been ported to iOS. If your requirement is simple, you may be better hand crafting your requests using NSXML. – user524261 Oct 08 '11 at 10:35
  • I've been spoilt from the Java world where tools create the classes representing the SOAP requests and responses for me... I think gsoap is the best way forward, generating C/C++ entities based on the WSDL. – trojanfoe Oct 08 '11 at 16:13
  • 1
    I forgot to add, there's also SudzC http://sudzc.com/. I couldn't get the stubs to work for my application, but you might want to give it a shot. – user524261 Oct 08 '11 at 18:32
  • Thanks; sudzc.com looks awesome. I wish Apple provided this kind of functionality as part of its toolchain. – trojanfoe Oct 09 '11 at 10:33

2 Answers2

0

Add the header search and library search paths explicitly, in place of ${AXIS2C_HOME}. It's rubbish, but it should work.

trojanfoe
  • 120,358
  • 21
  • 212
  • 242
0

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

user524261
  • 488
  • 1
  • 5
  • 14