[英]Attempting to compile a GNU library on OS X for 32 and 64 bit
在此先感謝您的任何幫助,我已經在網絡上進行搜索,無法完全正常工作。
我正在嘗試在運行OS X 10.9.4的Mac上從GNU的源代碼編譯libgcrypt庫。 我需要編譯為32位二進制文件,稍后再使用lipo將其與64位二進制文件混合(我有64位部分正在工作)。 我試圖能夠從32位和64位程序中引用libgcrypt二進制文件。 鏈接在這里: http : //www.gnu.org/software/libgcrypt/
我抓到了一個未包裝的來源。
我使用了以下配置:
$ ./configure -host = i386-apple-darwin10.5.0 CFLAGS ='-arch i386'LDFLAGS ='-arch 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配置為:--prefix = / Applications / Xcode.app / Contents / Developer / usr --with-gxx-include-dir = / usr / include / c ++ / 4.2.1 Apple LLVM版本5.1(clang -503.0.40)(基於LLVM 3.4svn)目標:x86_64-apple-darwin13.3.0線程模型:posix
相關網頁鏈接:
https://gmplib.org/list-archives/gmp-discuss/2010-September/004312.html
非常感謝您的任何幫助。
好的,我已經解決了這個問題,希望其他人也會對此感興趣。
上面的配置標志不太正確。 正確的configure命令是(需要-m32):
./configure -host = i386-apple-darwin CFLAGS ='-arch i386 -m32'LDFLAGS ='-arch i386 -m32 '
這將正確編譯。 僅供參考,為了編譯32位libgcrypt庫,您將需要32位版本的libgpg-error。
編譯完這些庫的32位版本后,我使用lipo混合了32位和64位版本,以便32位程序和64位程序都可以訪問這些庫。
lipo -create ./libgcrypt.20.dylib /usr/local/lib/libgcrypt.20.dylib -output /tmp/libgcrypt.20.dylib
sudo mv /tmp/libgcrypt.20.dylib /usr/local/lib/libgcrypt.20.dylib
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.