Build OpenJpeg for iPhone with configure and make

2019-08-11 04:50发布

问题:

How do you build Open Jpeg for iPhone? I know it can be done as stated in this thread: jpeg2000 on ios app

But there are no instructions how to compile this for iPhone. What configure arguments do you need to make this for the correct architecture?

I tried this generic iPhone configure file with no luck: https://github.com/jlongster/configure-iphone

Here is the Open Jpeg project: http://www.openjpeg.org/index.php?menu=download

回答1:

I've compiled OpenSSL for iOS a few weeks ago and used the BSD-generic32 arch for armv7 iOS devices which works without any problems. I've used ./configure BSD-generic32 but I haven't worked with OpenJpeg before.

Hope it helps!



回答2:

It looks like that the generic iPhone configure script only does configure. That is probably not enough as you need to configure for different architectures, then build all of the architectures and lipo the resulting libraries together.

I did this for libxml2 a while ago, and you can find the script on my tumblr. Maybe you can be use it as inspiration to make one that works for Open JPEG as well?



回答3:

This is what I do for compiling configure based packages:

export ARCH="armv7"
export OSMIN="5.1"
export XCODE_DEVELOPER="/Applications/Xcode.app/Contents/Developer"
export PFX="`pwd`/result-$ARCH"
export SYSRT="$XCODE_DEVELOPER/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk"
export PATH="$PFX/bin:/usr/bin:/bin:/usr/sbin:/sbin"
export CFLAGS="-Os -arch $ARCH -isysroot $SYSRT -miphoneos-version-min=${OSMIN} -I$PFX/include -L$PFX/lib"
export CXXFLAGS="$CFLAGS"

mkdir -p "$PFX/bin"
mkdir -p "$PFX/lib"

./configure "--prefix=$PFX" && make install

I haven't tested this with jpeg2000, but it should get you close. You'll also want to make sure that you have the Command Line Tools installed if you're using Xcode 4.3 or higher.