HessianKit链接失败

发布于 2024-12-28 07:36:07 字数 3058 浏览 2 评论 0原文

我正在尝试将 HessianKit 与一个简单的 Xcode iOS 测试项目链接起来。 我尝试了不同的构建配置。 我将 -ObjC 开关添加到库项目和主项目的链接器命令行中。

这是来自主项目的命令行:

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

这是来自链接器的错误消息:

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)

我附上了显示该项目的屏幕截图(它包含 HessianKit.framework,我们为 i386/MacOS、iOS 5.0 构建)。

Screenshot Failure

这是一些显示要链接的库内容的输出:

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

我找到了尝试包含 HessianKit 的建议文件直接与项目一起使用。由于 ARC,这会产生编译错误。

你有什么建议我可以尝试吗?预先非常感谢。

马蒂亚斯

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

伴我心暖 2025-01-04 07:36:07

我对 Xcode 非常陌生,并且能够解决这个问题。我试图在我正在开发的项目中使用 HessianKit。

这篇文章描述了该问题的解决方案: https://stackoverflow.com/a/7866167/1366367

显然iPhone 模拟器需要为 i386 架构而不是 armv7 构建库。

这对我有用:

  1. 打开项目HessianKit(从sourceforge下载)
  2. 将HessianKit目标上的Base SDK设置为iphonesimulator
  3. 清除StaticHessianKit目标的Base SDK(应默认为iphonesimulator)
  4. 运行构建
  5. 中查找libStaticHessianKit.a ~/Library/Developer/Xcode/DerivedData/*/Build/Products/Debug-iphonesimulator文件夹
  6. 拖动libStaticHessianKit.a 到您的项目中。这应该会自动设置库搜索路径。
  7. 将 HessianKit 框架文件夹也拖到您的项目中。
  8. 确保在使用 HessianKit 的地方导入它:

    #import 
    

祝你好运。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文