user1436087
user1436087

Reputation: 73

How do I cross compile zlib with shared library on MAC OSX?

I am trying to cross compile zlib library for a powerpc embedded target on MAC OSX.

I tried the suggestions: - 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/

But when the library name is not .so instead it's .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.

Upvotes: 2

Views: 2972

Answers (1)

leodotcloud
leodotcloud

Reputation: 1960

Unlike the other gnu packages there is no --host, --build, --target options while configuring zlib library.

You will have to pass the CHOST variable while configuring zlib

CHOST=powerpc-linux ./configure --prefix=/usr --enable-shared
make
make install

Upvotes: 4

Related Questions