如何在MAC OSX上与共享库交叉编译zlib?

时间:2014-01-15 23:53:45

标签: c macos cross-compiling

我正在尝试为MAC OSX上的powerpc嵌入式目标交叉编译zlib库。

我尝试了这些建议: - http://liwende.blogspot.com/2008/02/how-to-cross-compile-zlib-openssl.html - http://www.ailis.de/~k/archives/19-arm-cross-compiling-howto.html - http://www.cnx-software.com/2011/10/06/cross-comping-zlib-for-arm-target/

但是当库名不是.so时,它是.dylib。

zlib-1.2.8]$ CC=powerpc-linux-gcc \
> AR=powerpc-linux-ar RANLIB=powerpc-linux-ranlib \
> AS=powerpc-linux-as LD=powerpc-linux-ld \
> LDSHARED="powerpc-linux-gcc -shared -Wl,-soname,libz.so.1" \
> ./configure --prefix=/usr --shared
Checking for shared library support...
Building shared library libz.1.2.8.dylib with powerpc-linux-gcc.
Checking for off64_t... Yes.
Checking for fseeko... Yes.
Checking for strerror... Yes.
Checking for unistd.h... Yes.
Checking for stdarg.h... Yes.
Checking whether to use vs[n]printf() or s[n]printf()... using vs[n]printf().
Checking for vsnprintf() in stdio.h... Yes.
Checking for return value of vsnprintf()... Yes.
Checking for attribute(visibility) support... Yes.

1 个答案:

答案 0 :(得分:4)

与其他gnu包不同,配置zlib库时没有--host, - build, - target选项。

在配置zlib

时,您必须传递CHOST变量
CHOST=powerpc-linux ./configure --prefix=/usr --enable-shared
make
make install