xcode - 找不到架构 i386 的 libcrypto.a 符号

标签 xcode

Xcode 6.3 测试版

我在我的项目中使用 libcrypto.a。

我的应用程序可以在我的 ipod touch5 (armv7) 上编译和运行。

但是当我尝试在 iphone5 模拟器上运行我的应用程序时,出现错误:

  "_closedir$UNIX2003", referenced from:
      _OPENSSL_DIR_end in libcrypto.a(o_dir.o)

  "_fputs$UNIX2003", referenced from:
      _write_string in libcrypto.a(ui_openssl.o)
      _read_string in libcrypto.a(ui_openssl.o)

  "_opendir$INODE64$UNIX2003", referenced from:
      _OPENSSL_DIR_read in libcrypto.a(o_dir.o)

  "_readdir$INODE64", referenced from:
      _OPENSSL_DIR_read in libcrypto.a(o_dir.o)
ld: symbol(s) not found for architecture i386

然后我使用以下命令检查了 libcrypto.a 支持的架构:
lipo -info libcrypto.a

并得到结果:
Architectures in the fat file: libcrypto.a are: i386 armv7 armv7s arm64 

任何建议将不胜感激,谢谢:)

最佳答案

在任何地方创建新的 m 文件。
并在此处定义所有缺失的功能:

#include <stdio.h> 
#include <unistd.h> 
#include <string.h>
#include <stdlib.h>
#include <dirent.h>
#include <fnmatch.h>

FILE *fopen$UNIX2003( const char *filename, const char *mode )
{
    return fopen(filename, mode);
}

int fputs$UNIX2003(const char *res1, FILE *res2){
    return fputs(res1,res2);
}

int nanosleep$UNIX2003(int val){
    return usleep(val);
}

char* strerror$UNIX2003(int errornum){
    return strerror(errornum);
}

double strtod$UNIX2003(const char *nptr, char **endptr){
    return strtod(nptr, endptr);
}

size_t fwrite$UNIX2003( const void *a, size_t b, size_t c, FILE *d )
{
    return fwrite(a, b, c, d);
}

DIR * opendir$INODE64( char * dirName )
{
    return opendir( dirName );
}

struct dirent * readdir$INODE64( DIR * dir )
{
    return readdir( dir );
}

关于xcode - 找不到架构 i386 的 libcrypto.a 符号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29390112/

相关文章:

c# - 在 MonoTouch 中绑定(bind) NSArray

ios - 仅在 iPhone 5 上找不到此可执行文件的有效配置文件

ios - Xcode/iOS NSUserDefaults 行为奇怪

ios - swift 的新手 : Why is the Timer not updating to the UILabel?

iphone - "release"如何在 ARC 上创建一个 UIWebView

ios - Rails API 的 POST 方法

xcode - 从命令行从 XCode 中提取构建标志

javascript - stringByEvaluatingJavaScriptFromString 不起作用

ios - LaunchScreen.storyboard 和 SwiftGif

objective-c - Xcode 4.1 (Lion) 和 Xcode 3.2.5 (snow leopard) 之间 .xcdatamodeld 的兼容性问题