c - 如何在 MAC OSX 上交叉编译 zlib 和共享库?

标签 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.

最佳答案

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

配置 zlib 时必须传递 CHOST 变量

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

关于c - 如何在 MAC OSX 上交叉编译 zlib 和共享库?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21150789/

相关文章:

c - 错误 C2143 : syntax error: missing ';' before '{' in C

c - 使用 GCC 交叉编译器时对 printf 的 undefined reference

c - .in'ig.status : error: cannot find input file: `Makefile

有人可以解释这个 C 输出吗?

php - 在 Mac OS X 中终止 PHP 进程

php - OS X Mojave 上的 MongoDB PHP 驱动程序问题

eclipse - 如何让 Eclipse 在非标准位置查找和使用基于 gcc 的工具链

arm - 在 Raspberry Pi 上运行简单的 ELLCC 生成的 ELF 二进制文件时出现非法指令

c - 当程序中包含头文件时, ""和 <> 有什么区别?

python - 在虚拟环境中导入python包