如何在 Mac OS X 上将 OpenSSL 构建为 32 位 (i386)?

发布于 2024-09-30 13:08:08 字数 602 浏览 2 评论 0原文

我下载了 OpenSSL 源代码,并进行了 configmakesudo make install 三部曲。

然后我构建了我的项目,链接到 libcrypto.a 和 libssl.a,但是得到:

ld: warning: in /usr/local/ssl/lib/libcrypto.a, file was built for unsupported file format which is not the architecture being linked (x86_64)
ld: warning: in /usr/local/ssl/lib/libssl.a, file was built for unsupported file format which is not the architecture being linked (x86_64)

我很确定我想将 OpenSSL 重新构建为 32 位(i386),因为(由于与这个问题无关的原因)我的项目需要是32位的。

如何在 Mac OS X 上将 OpenSSL 构建为 32 位? (我在“安装”文件中没有看到任何有关此内容的信息。)

I downloaded OpenSSL sources, and did the config, make, sudo make install trilogy.

I then built my project, linking in libcrypto.a and libssl.a, but got:

ld: warning: in /usr/local/ssl/lib/libcrypto.a, file was built for unsupported file format which is not the architecture being linked (x86_64)
ld: warning: in /usr/local/ssl/lib/libssl.a, file was built for unsupported file format which is not the architecture being linked (x86_64)

I'm pretty sure I want to re-build OpenSSL as 32-bit (i386), because (for reasons not pertinent to this question) my project needs to be 32-bit.

How do I build OpenSSL as 32-bit on Mac OS X? (I didn't see anything about this in the "INSTALL" file.)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

旧人九事 2024-10-07 13:08:15

如果有人正在寻找构建动态库的解决方案,可以这样做:

tar -xvzf <openssl gz file>
./Configure darwin-i386-cc -shared 
make

对于 64 位,运行

./Configure darwin64-x86_64-cc -shared
make

If anybody is looking for a solution to build dynamic libraries, this is how to do it:

tar -xvzf <openssl gz file>
./Configure darwin-i386-cc -shared 
make

For 64 bit, run

./Configure darwin64-x86_64-cc -shared
make
十年九夏 2024-10-07 13:08:14
$ curl https://www.openssl.org/source/openssl-1.0.0a.tar.gz | tar xz
$ cd openssl-1.0.0a
$ export CFLAGS="-arch i386"
$ export LDFLAGS="-arch i386"
$ ./config
$ make
$ lipo -info libssl.a
input file libssl.a is not a fat file
Non-fat file: libssl.a is architecture: i386
$ lipo -info libcrypto.a
input file libcrypto.a is not a fat file
Non-fat file: libcrypto.a is architecture: i386
$ curl https://www.openssl.org/source/openssl-1.0.0a.tar.gz | tar xz
$ cd openssl-1.0.0a
$ export CFLAGS="-arch i386"
$ export LDFLAGS="-arch i386"
$ ./config
$ make
$ lipo -info libssl.a
input file libssl.a is not a fat file
Non-fat file: libssl.a is architecture: i386
$ lipo -info libcrypto.a
input file libcrypto.a is not a fat file
Non-fat file: libcrypto.a is architecture: i386
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文