Как создать OpenSSL как 32-разрядную (i386) в Mac OS X?
Я загрузил источники OpenSSL и выполнил трилогию config
, make
, sudo 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-битным.
Как создать OpenSSL как 32-разрядную версию в Mac OS X? (Я ничего не видел об этом в файле "INSTALL".)
Ответы
Ответ 1
$ 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
Ответ 2
Если кто-то ищет решение для построения динамических библиотек, вот как это сделать:
tar -xvzf <openssl gz file>
./Configure darwin-i386-cc -shared
make
Для 64-битного запуска запустите
./Configure darwin64-x86_64-cc -shared
make