xcode 4.5 - 找不到架构 i386 (zbar) 的符号

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12551280/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 01:35:35  来源:igfitidea点击:

xcode 4.5 - symbols not found for architecture i386 (zbar)

xcodearmv7xcode4.5zbar-sdkios

提问by woopsicle

I have a project which uses the zbar-sdk (a barcode scanning library).

我有一个使用 zbar-sdk(条形码扫描库)的项目。

After updating my machine to xcode 4.5 and ios6sdk I am having some troubles.

将我的机器更新到 xcode 4.5 和 ios6sdk 后,我遇到了一些麻烦。

I was able to build to the simulator without touching anything about my project. This is using the latest zbar 1.2 library.

我能够在不涉及我的项目的任何内容的情况下构建到模拟器。这是使用最新的 zbar 1.2 库。

I then wanted to build to my ios6 device for testing, and thats when I got an error.

然后我想构建到我的 ios6 设备进行测试,这就是我遇到错误的时候。

After some googling on the zbar developer forum, I seen that I needed to get the zbar source and build the libzbar.a for armv7 and armv7s as this has not yet been done by the zbar developer.

在 zbar 开发人员论坛上进行了一些谷歌搜索后,我发现我需要获取 zbar 源代码并为 armv7 和 armv7s 构建 libzbar.a,因为 zbar 开发人员尚未完成此操作。

See - http://sourceforge.net/projects/zbar/forums/forum/1072195/topic/5728912

见 - http://sourceforge.net/projects/zbar/forums/forum/1072195/topic/5728912

So I did this, re-imported the updated libzbar.a into my project. I then built for my device, and it worked! I was able to get my app onto my testing device and the zbar barcode library worked fine.

所以我这样做了,将更新后的 libzbar.a 重新导入到我的项目中。然后我为我的设备构建了它,它奏效了!我能够将我的应用程序安装到我的测试设备上,并且 zbar 条码库运行良好。

I thought that was the end of it, but unfortunately not.

我以为这就结束了,但不幸的是没有。

I then tried to build to the simulator (ios6) again, and thats when it fails.

然后我尝试再次构建到模拟器(ios6),这就是它失败的时候。

No matter what I cannot get this project to build for both the device and simualtor at the same time and with the same settings :(

不管怎样,我都无法同时使用相同的设置为设备和模拟器构建此项目:(

My libzbar.a project settings when building my own libzbar.a file:

构建我自己的 libzbar.a 文件时我的 libzbar.a 项目设置:

Architecture: Standard (armv7, armv7s) $(ARCHS_STANDARD_32_BIT)

架构:标准(armv7、armv7s)$(ARCHS_STANDARD_32_BIT)

Build Active Architecture Only: No

仅构建活动架构:否

Valid Architectures: armv7 armv7s

有效架构:armv7 armv7s

And my project settings (for myapp) as:

我的项目设置(用于 myapp)为:

Architecture: Standard (armv7, armv7s) $(ARCHS_STANDARD_32_BIT)

架构:标准(armv7、armv7s)$(ARCHS_STANDARD_32_BIT)

Build Active Architecture Only: No

仅构建活动架构:否

Valid Architectures: armv7 armv7s

有效架构:armv7 armv7s

Base SDK: iOS6

基础SDK:iOS6

iOS Deployment Target: iOS 5.0

iOS 部署目标:iOS 5.0

And the error when trying to build to the simulator:

以及尝试构建到模拟器时的错误:

ld: warning: ignoring file /Users/blah/iOS App/myapp/ZBarSDK/libzbar.a, missing required architecture i386 in file /Users/blah/iOS App/myapp/ZBarSDK/libzbar.a (2 slices)
Undefined symbols for architecture i386:
  "_OBJC_CLASS_$_ZBarReaderViewController", referenced from:
      objc-class-ref in mycontroller.o
  "_ZBarReaderControllerResults", referenced from:
      -[mycontroller imagePickerController:didFinishPickingMediaWithInfo:] in mycontroller.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I have tried tweaking the libzbar.a project settings (e.g. build active architecture set to "YES") but this just results in neither the simulator or device working.

我曾尝试调整 libzbar.a 项目设置(例如,将构建活动架构设置为“是”),但这只会导致模拟器或设备均无法工作。

The fact that it works on the device but not the simulator makes me thing there is some weird architecture/project setting causing this.

它适用于设备而不是模拟器的事实让我觉得有一些奇怪的架构/项目设置导致了这种情况。

Any help much appreciated!

非常感谢任何帮助!

回答by Holyprin

I doubt this is the rightanswer but it worked for me, I compiled the new libzber.a using architectures: i386 armv6 armv7 armv7s in that order you also need to specify valid architectures as the same values. Again this is what worked for me with a recent release I needed to get out A.S.A.P. Both are found in Target -> Build Settings -> Architecures.

我怀疑这是正确的答案,但它对我有用,我使用架构编译了新的 libzber.a:i386 armv6 armv7 armv7s,您还需要将有效架构指定为相同的值。同样,这对我最近的版本有用,我需要尽快退出两者都可以在 Target -> Build Settings -> Architecures 中找到。

Also note: $(ARCHS_STANDARD_32_BIT) needed to be removed from the settings.

另请注意:需要从设置中删除 $(ARCHS_STANDARD_32_BIT)。

回答by Capiright

I fixed a similar issue by setting the iOS6 simulator architecture under OTHER_LDFLAGS in Target->Build Settings.

我通过在 Target->Build Settings 中的 OTHER_LDFLAGS 下设置 iOS6 模拟器架构来解决类似的问题。

I forgot that I had a different command line argument for separated archituctures so I had to manually state the simulator

我忘记了我对分离的架构有不同的命令行参数,所以我不得不手动声明模拟器