2014-09-01 201 views
1

在此先感谢您提供任何帮助,我已浏览网页并无法完成此工作。试图在OS X上编译32位和64位的GNU库

我试图从源代码编译运行OS X 10.9.4的mac上的GNU的libgcrypt库。我需要编译成一个32位的二进制文件,稍后我将使用lipo与64位的二进制文件(我有64位的部分工作)混合。我试图能够从32位和64位程序中引用libgcrypt二进制文件。链接这里:http://www.gnu.org/software/libgcrypt/

我抓住了一个未经调整的来源。

我已经使用了以下配置:

$ 的./configure -host = I386-苹果darwin10.5.0 CFLAGS = ' - 拱i386的' LDFLAGS = ' - 拱i386的'

哪结果在:

Libgcrypt v1.6.2 has been configured as follows: 

    Platform:     Darwin (i386-apple-darwin10.5.0) 
    Hardware detection module: hwf-x86 
    Enabled cipher algorithms: arcfour blowfish cast5 des aes twofish 
           serpent rfc2268 seed camellia idea salsa20 
           gost28147 
    Enabled digest algorithms: crc gostr3411-94 md4 md5 rmd160 sha1 
           sha256 sha512 tiger whirlpool stribog 

    Enabled kdf algorithms: s2k pkdf2 scrypt 
    Enabled pubkey algorithms: dsa elgamal rsa ecc 
    Random number generator: default 
    Using linux capabilities: no 
    Try using Padlock crypto: yes 
    Try using AES-NI crypto: yes 
    Try using Intel PCLMUL: yes 
    Try using DRNG (RDRAND): yes 
    Try using Intel AVX:  yes 
    Try using Intel AVX2:  yes 
    Try using ARM NEON:  n/a 

但是当我试着做(或sudo make)时,繁荣!

Making all in src 
/bin/sh ../libtool --tag=CC --mode=link gcc -I/opt/local/include -arch i386 -Wall -arch i386 -o mpicalc mpicalc-mpicalc.o libgcrypt.la -L/opt/local/lib -lgpg-error 
libtool: link: gcc -I/opt/local/include -arch i386 -Wall -arch i386 -o .libs/mpicalc mpicalc-mpicalc.o ./.libs/libgcrypt.dylib -L/opt/local/lib -lgpg-error 
ld: warning: ignoring file /opt/local/lib/libgpg-error.dylib, file was built for x86_64 which is not the architecture being linked (i386): /opt/local/lib/libgpg-error.dylib 
Undefined symbols for architecture i386: 
    "_gpg_strerror", referenced from: 
     _print_mpi in mpicalc-mpicalc.o 
     _scan_mpi in mpicalc-mpicalc.o 
ld: symbol(s) not found for architecture i386 
clang: error: linker command failed with exit code 1 (use -v to see invocation) 
make[2]: *** [mpicalc] Error 1 
make[1]: *** [all-recursive] Error 1 
make: *** [all] Error 2 

还可能感兴趣的:

$ G ++ --version 配置有:前缀= /应用/ Xcode.app /内容/开发/ USR --with-GXX,包括-dir =的/ usr /包括/ C++/4.2.1 苹果LLVM版本5.1(铛-503.0.40)(基于LLVM 3.4svn) 目标:x86_64的-苹果darwin13.3.0 线程模型:POSIX

相关网站链接:

https://gmplib.org/list-archives/gmp-discuss/2010-September/004312.html

很多很多非常感谢您的任何帮助。

回答

1

好的,我已经解决了这个问题,并希望其他人会发现这一点。

上面的配置标志并不完全正确。适当的配置命令是(需要-m32):

的./configure -host = I386-苹果达尔文CFLAGS = ' - 拱I386 -m32' LDFLAGS = ' - 拱I386 -m32'

这将正确编译。仅供参考,为了编译32位libgcrypt库,您需要32位版本的libgpg-error。

随着这些库的32位版本被编译,我使用lipo来混合32位和64位版本,以便32位程序和64位程序都可以访问这些库。

脂-create ./libgcrypt.20.dylib /usr/local/lib/libgcrypt.20.dylib -output /tmp/libgcrypt.20.dylib

须藤MV/TMP/libgcrypt。 20.dylib /usr/local/lib/libgcrypt.20.dylib