Building OpenSSL for iOS with a Run-Script action from within Xcode

There are many scripts out there in the Web that help building OpenSSL for iOS and iOS-Simulator for different architectures. For instance and All of these scripts work fine when invoked from the command line. But as soon as you put them into a run-script action of Xcode, the make process will fail with different, unspecified errors. Most of the Time ¬†you’ll get something like:

Undefined symbols for architecture i386:
"_ENGINE_load_gost", referenced from:
_ENGINE_load_builtin_engines in libcrypto.a(eng_all.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [link_app.] Error 1
make[1]: *** [openssl] Error 2
make: *** [build_apps] Error 1

It took me a long time to figure out the problem, but the solution is easier than you would imagine! Just add the following line to the script before “Configure” or “make” is called:

export COMMAND_MODE=unix2003

That’s all! Building OpenSSL from within Xcode should now work as expected.

Have fun!

Leave a Reply