I would like to cross-compile OpenSSL 1.0.1h for iOS on OS X without gcc installed by following instructions in the WWDC 2014 session 305 video and from the OpenSSL web site.
I unzip/untar and the switch from gcc
to clang
(almost) as suggested here.
OLD_LANG=$LANG
unset LANG
sed -i "" 's|\"iphoneos-cross\"\,\"llvm-gcc\:-O3|\"iphoneos-cross\"\,\"clang\:-Os|g' Configure
sed -i "" 's/CC= cc/CC= clang/g' Makefile.org
sed -i "" 's/CFLAG= -O/CFLAG= -Os/g' Makefile.org
export LANG=$OLD_LANG
Notice that I had to stick with the makedepend
tool for otherwise already the make depend
step will fail (as was also mentioned elsewhere). Installing that tool with brew install makedepend
is not an issue for me (but installing gcc next to Clang would be). Now
./Configure iphoneos-cross
make depend
make
leads to warnings (during make depend
) and errors (during make
) about missing include files (such as stdlib.h
). The typical include path passed to clang
is apparently -I. -I.. -I../include
.
I assume this is to related to clang
not receiving specific C options by default, but if so, what is the most sensible way for making the compilation work e.g. by fixing the sed
edits or by setting environment variables. (Currently I don't have any CC*
environment variables set. There is e.g. /usr/include/stdlib.h
on my system.)
I rarely use OS X C compilers on the command line and the solution is therefore not obvious to me.
UPDATE Here is the question in a more specific for whose valid answer will be awarded with a bounty: What specific edits (similar to the first code snippet above) have to be performed on the files in latest version of OpenSSL source code (e.g. openssl-1.0.1h.tar.gz
) so that one can cross-compiles it by issuing commands similar to the second code snippet above for iOS 7 (soon iOS 8) architectures on OS X 10.9 with Xcode 5.1.1 (soon Xcode 6) installed, without gcc installed and with makedepend
optionally installed?
clang: error: no input files
. So gcc apparently exists in the shape of Clang. So what I mean by it not being installed is that I did not try to (re)install it with MacPorts, Homebrew, ...export CFLAGS=-I/usr/include; make
andmake CGLAGS=-I/usr/include
lead to (albeit different) errors. There also seems to be a (perhaps subsequent) problem about a directory/SDKs/
, which is missing on my Mac. (I do have Xcode 5.1.1 -- even Xcode 6.0 -- installed on Mavericks, though.)