HessianKit linking failure

399 views Asked by At

I am trying to link HessianKit with a simple Xcode iOS test project. I tried different build configurations. I added the -ObjC switch to both the linker command line for the library project and for my main project.

This is the command line from the main project:

Ld /Users/wuttke/Library/Developer/Xcode/DerivedData/MatthiasSimpleTest-gfekzjmarzscwwgbynkuztivwkpw/Build/Products/Debug-iphonesimulator/MatthiasSimpleTest.app/MatthiasSimpleTest normal i386
cd /Users/wuttke/Documents/MatthiasSimpleTest
setenv MACOSX_DEPLOYMENT_TARGET 10.6
setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk -L/Users/wuttke/Library/Developer/Xcode/DerivedData/MatthiasSimpleTest-gfekzjmarzscwwgbynkuztivwkpw/Build/Products/Debug-iphonesimulator -L/Users/wuttke/Documents/MatthiasSimpleTest/MatthiasSimpleTest -L/Users/wuttke/Documents/MatthiasSimpleTest -F/Users/wuttke/Library/Developer/Xcode/DerivedData/MatthiasSimpleTest-gfekzjmarzscwwgbynkuztivwkpw/Build/Products/Debug-iphonesimulator -F/Users/wuttke/Documents/MatthiasSimpleTest -filelist /Users/wuttke/Library/Developer/Xcode/DerivedData/MatthiasSimpleTest-gfekzjmarzscwwgbynkuztivwkpw/Build/Intermediates/MatthiasSimpleTest.build/Debug-iphonesimulator/MatthiasSimpleTest.build/Objects-normal/i386/MatthiasSimpleTest.LinkFileList -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -Xlinker -no_implicit_dylibs -D__IPHONE_OS_VERSION_MIN_REQUIRED=50000 -framework UIKit -framework Foundation -framework CoreGraphics -framework HessianKit -o /Users/wuttke/Library/Developer/Xcode/DerivedData/MatthiasSimpleTest-gfekzjmarzscwwgbynkuztivwkpw/Build/Products/Debug-iphonesimulator/MatthiasSimpleTest.app/MatthiasSimpleTest

This the error message from the linker:

Undefined symbols for architecture i386:
  "_OBJC_CLASS_$_CWHessianConnection", referenced from:
      objc-class-ref in MainWindowController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I attached a screenshot showing the project (it contains the HessianKit.framework, we build for i386/MacOS, iOS 5.0).

Screenshot Failure

This is some output showing the contents of the library to be linked:

Tobiass-MacBook-Pro:HessianKit.framework wuttke$ pwd
/Users/wuttke/Documents/MatthiasSimpleTest/HessianKit.framework
Tobiass-MacBook-Pro:HessianKit.framework wuttke$ ls
Headers     HessianKit  Resources   Versions
Tobiass-MacBook-Pro:HessianKit.framework wuttke$ nm -arch i386 HessianKit | grep CWHessianConnection
000010a0 t +[CWHessianConnection proxyWithURL:protocol:]
00001020 t -[CWHessianConnection initWithHessianVersion:]
000011a0 t -[CWHessianConnection proxyWithURL:protocol:]
00001260 t -[CWHessianConnection setVersion:]
00001240 t -[CWHessianConnection version]
0000d000 S .objc_class_name_CWHessianConnection

I found the suggestion to try to include the HessianKit files directly with the project. This gives compile errors because of the ARC.

Have you got any suggestions I could try? Thanks a lot in advance.

Matthias

1

There are 1 answers

1
user1366367 On BEST ANSWER

I am very new to Xcode and was able to solve this issue. I was trying to use HessianKit in a project I'm developing.

The solution to the problem is described in this post: https://stackoverflow.com/a/7866167/1366367

Apparently the iPhone simulator requires libraries to built for the i386 architecture not armv7.

This worked for me:

  1. Open Project HessianKit (downloaded from sourceforge)
  2. Set Base SDK on HessianKit target to iphonesimulator
  3. Clear Base SDK for StaticHessianKit target (should default to iphonesimulator)
  4. Run Build
  5. Find libStaticHessianKit.a in ~/Library/Developer/Xcode/DerivedData/*/Build/Products/Debug-iphonesimulator folder
  6. Drag libStaticHessianKit.a into your project. This should automatically set up library search paths.
  7. Drag HessianKit framework folder to your project as well.
  8. Make sure you import this where you are using HessianKit:

    #import <HessianKit/HessianKit.h>
    

Good luck.