Hey,
Been working on this for hours now so any insight would be greatly appreciated.
I'm trying to compile libssh2 for the iPhone Simulator on OS X (I already have it compiled successfully for the device).
I'm using the following environment variables and commands:
export DEVROOT=/Developer/Platforms/iPhoneSimulator.platform/Developer
export SDKROOT=$DEVROOT/SDKs/iPhoneSimulator3.0.sdk
export CC=$DEVROOT/usr/bin/gcc-4.2
export LD=$DEVROOT/usr/bin/ld
export CPP=$DEVROOT/usr/bin/cpp-4.2
export CXX=$DEVROOT/usr/bin/g++-4.2
export AR=$DEVROOT/usr/bin/ar
export AS=$DEVROOT/usr/bin/as
export NM=$DEVROOT/usr/bin/nm
export CXXCPP=$DEVROOT/usr/bin/cpp-4.2
export RANLIB=$DEVROOT/usr/bin/ranlib
export LDFLAGS="-arch i386 -pipe -no-cpp-precomp -isysroot $SDKROOT -L/Users/<USERNAME>/Desktop/Dev/iphonesimulator-os/lib"
export CFLAGS="-arch i386 -pipe -no-cpp-precomp -isysroot $SDKROOT -I/Users/<USERNAME>/Desktop/Dev/iphonesimulator-os/include"
export CXXFLAGS="-arch i386 -pipe -no-cpp-precomp -isysroot $SDKROOT -I/Users/<USERNAME>/Desktop/Dev/iphonesimulator-os/include/"
export CFLAGS=-m32
export CPPFLAGS=-m32
cd /Users/<USERNAME>/Desktop/Dev/src/gnupg-1.4.10
sudo ./configure --host=i386-apple-darwin --prefix=/Users/<USERNAME>/Desktop/Dev/iphonesimulator-os
sudo make
sudo make install
cd /Users/<USERNAME>/Desktop/Dev/src/libgpg-error-1.7
sudo ./configure --host=i386-apple-darwin --prefix=/Users/<USERNAME>/Desktop/Dev/iphonesimulator-os --enable-shared=no
sudo make
sudo make install
cd /Users/<USERNAME>/Desktop/Dev/src/libgcrypt-1.4.5
sudo ./configure --host=i386-apple-darwin --prefix=/Users/<USERNAME>/Desktop/Dev/iphonesimulator-os --enable-shared=no --with-gpg-error-prefix=/Users/<USERNAME>/Desktop/Dev/iphonesimulator-os --disable-asm
sudo make
sudo make install
sudo ./configure --host=i386-apple-darwin --prefix=/Users/<USERNAME>/Desktop/Dev/iphonesimulator-os --with-libgcrypt-prefix=/Users/<USERNAME>/Desktop/Dev/src/libgcrypt-1.4.5
cd /Users/<USERNAME>/Desktop/Dev/src/libssh2-1.2.7
sudo make
sudo make install
The dylib that is produced shows as x86_64 and when trying to use the static library .a file in the iPhone app is says libssh2.a, file was built for unsupported file format which is not the architecture being linked (i386).
libgcrypt and the other required libraries have all compiled with no issue.
Thanks in advance!