Question

I am trying to cross compile Jansson for iOS (armv7) from my machine (x86_64). I have learned that with xcode 5, apple has removed llvm-gcc and thus, armv7-apple-darwin-gcc can't be found. The result lib is compiled for x86_64 instead.

This is my current configuration:

./configure --prefix=/resultdir --host=armv7-apple-darwin --target=armv7-apple-darwin

I saw multiple posts of people saying they have jansson compiled for arm architecture so I know its possible. Just can't seem to be able to do it.

Any ideas on how to do this?

Was it helpful?

Solution

I have an older iPhoneOS 5.0 SDK installed on my system. I am sure that you can work with a newer version too. The following script successfully compiled Jansson for me:

export CC="/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/clang"
export CPP="clang -E"

export SDKPATH="/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk"
export CFLAGS="-arch armv7 -isysroot ${SDKPATH} -miphoneos-version-min=5.0"

export LDFLAGS="-isysroot ${SDKPATH}"

./configure --host=arm-apple-darwin10

make

The result is a library that I did not test, but file returns an arm architecture library:

$ file src/.libs/libjansson.4.dylib
src/.libs/libjansson.4.dylib: Mach-O dynamically linked shared library arm

Adjust SDKPATH and -miphoneos-version-min=5.0 appropriately for the SDK that you have installed.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top