I am trying to compile PJSIP2.3 for iOS on Mac 10.10.1(Xcode 6.1). But I'm getting some errors when I run ./configure-iphone.
Below are the errors shown in terminal:
WifiMacBook:pjproject-2.3 apple$ ./configure-iphone
configure-iphone: DEVPATH is not specified, using /Applications/XCode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer
configure-iphone: IPHONESDK is not specified, choosing iPhoneOS7.0.sdk
configure-iphone: CC is not specified, choosing /Applications/XCode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/../../../Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
configure-iphone: ARCH is not specified, choosing -arch armv7
configure-iphone: CXX is not specified, using /Applications/XCode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/../../../Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
configure-iphone: calling ./aconfigure with env vars:
CC = /Applications/XCode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/../../../Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
CXX = /Applications/XCode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/../../../Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
CFLAGS = -O2 -Wno-unused-label -DPJ_SDK_NAME="\"iPhoneOS7.0.sdk\"" -arch armv7 -isysroot /Applications/XCode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk
LDFLAGS = -O2 -arch armv7 -isysroot /Applications/XCode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -framework AudioToolbox -framework Foundation
AR = /Applications/XCode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/../../../Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -static -o
RANLIB = echo ranlib
./configure-iphone: line 147: ./aconfigure: Permission denied
I see this link for comping pjsip
http://gaurav-iphone.blogspot.in/2011/09/compiling-pjsip.html
Thanks in Advance.
Give full permission to your pjsip directory,
chmod 777 *
Then type below command in your terminal,
$ tr -d '\r' <configure-iphone> FILE.new
$ rm configure-iphone
$ mv FILE.new configure-iphone
Again run
$ ./configure-iphone
Happy to help all :)
Is aconfigure executable? Try to run chmod -x aconfigure to solve this situation.
It might also be the file permission.
Related
I need to compile Fortran-77 subroutines to be accessible on iOS. I am using GCC with the DragonEgg plugin, so I can use gfortran with the LLVM backend. I followed this answer but I am stuck when it comes to build libgfortran for armv7, armv7s and arm64.
Can I build libgfortran alone or is it always necessary to compile the GCC suite completely?
What is the correct way of producing this library for a different target? Is it possible to use GCC for this step or do I need LLVM for the arm*-targets?
Building GCC with arm-targets using GCC I get these errors:
./configure --prefix=/tmp/out --host=arm-apple-darwin --enable-languages=fortran
make
…
make[2]: arm-apple-darwin-ar: No such file or directory
make[2]: *** [libiberty.a] Error 1
make[1]: *** [all-libiberty] Error 2
Building GCC with arm-targets using LLVM I have problems with configure:
export CC="$(xcrun -sdk iphoneos -find clang)"
export CPP="$CC -E"
export CFLAGS="-arch armv7 -arch armv7s -arch arm64 -isysroot $(xcrun --sdk iphoneos --show-sdk-path) -miphoneos-version-min=9.2"
export AR=$(xcrun -sdk iphoneos -find ar)
export RANLIB=$(xcrun -sdk iphoneos -find ranlib)
export CPPFLAGS="-arch armv7 -arch armv7s -arch arm64 -isysroot $(xcrun --sdk iphoneos --show-sdk-path) -miphoneos-version-min=9.2"
export LDFLAGS="-arch armv7 -arch armv7s -arch arm64 -isysroot $(xcrun --sdk iphoneos --show-sdk-path)"
./configure --prefix=/tmp/out --enable-languages=fortran --host=arm-apple-darwin --disable-shared
…
checking how to run the C preprocessor... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -E
configure: error: in `/Users/timo/temp/gcc-4.8.5-build/fixincludes':
configure: error: C preprocessor "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -E" fails sanity check
See `config.log' for more details.
make[1]: *** [configure-fixincludes] Error 1
The configure script states that
configure: WARNING: If you wanted to set the --build type, don't use --host.
If a cross compiler is detected then cross compile mode will be used.
What is meant by If a cross compiler is detected? How do I define the target platform correctly?
LLVM uses -arch armv7 etc. as target definition. What is nedded when using GCC?
You are trying to build cross-gcc libraries without cross binutils. Here is a good manual for building cross-gcc for arm, you can follow it.
What is meant by If a cross compiler is detected? How do I define the
target platform correctly?
When configuring you should also set --target=arm-apple-darwin. (In my own experience I did not set --host at all)
make[2]: arm-apple-darwin-ar: No such file or directory
Before building arm cross-compiler target libraries you should build binutils for this target.
Can't say anything about llvm.
So just try to make all steps in the link above.
Since Apple is systematically deprecating OpenLDAP for iOS and OS X (some features which are needed has been removed in 10.10), my team decided to get latest OpenLDAP, build it and include libraries to application.
I need only client functionality.
Build for MacOS is not a problem:
$ ./configure --with-tls=openssl --disable-slapd \
> --prefix="`pwd`/openldap-build/common" \
> --exec-prefix="`pwd`/openldap-build/MacOS"
$ make depend
$ make
$ make install
This goes smoothly.
Problem is building for iOS. I've found nice solution which allows to build such external libraries for iOS. I tweak this bash script to go with ~openLDAP` code:
#!/bin/bash
PLATFORMPATH="/Applications/Xcode.app/Contents/Developer/Platforms"
TOOLSPATH="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin"
export IPHONEOS_DEPLOYMENT_TARGET="8.0"
pwd=`pwd`
findLatestSDKVersion()
{
sdks=`ls $PLATFORMPATH/$1.platform/Developer/SDKs`
arr=()
for sdk in $sdks
do
arr[${#arr[#]}]=$sdk
done
# Last item will be the current SDK, since it is alpha ordered
count=${#arr[#]}
if [ $count -gt 0 ]; then
sdk=${arr[$count-1]:${#1}}
num=`expr ${#sdk}-4`
SDKVERSION=${sdk:0:$num}
else
SDKVERSION="8.0"
fi
}
buildit()
{
target=$1
hosttarget=$1
platform=$2
echo =============================================================
echo = building for target $target platform $platform ... =
echo =============================================================
if [[ $hosttarget == "x86_64" ]]; then
hostarget="i386"
elif [[ $hosttarget == "arm64" ]]; then
hosttarget="arm"
fi
export CC="$(xcrun -sdk iphoneos -find clang)"
export CPP="$CC -E"
export CFLAGS="-arch ${target} -isysroot $PLATFORMPATH/$platform.platform/Developer/SDKs/$platform$SDKVERSION.sdk -miphoneos-version-min=$SDKVERSION"
export AR=$(xcrun -sdk iphoneos -find ar)
export RANLIB=$(xcrun -sdk iphoneos -find ranlib)
export CPPFLAGS="-arch ${target} -isysroot $PLATFORMPATH/$platform.platform/Developer/SDKs/$platform$SDKVERSION.sdk -miphoneos-version-min=$SDKVERSION"
export LDFLAGS="-arch ${target} -isysroot $PLATFORMPATH/$platform.platform/Developer/SDKs/$platform$SDKVERSION.sdk"
mkdir -p $pwd/output/$target
./configure --disable-shared --host=$hosttarget-apple-darwin --with-tls=openssl --disable-slapd --prefix="$pwd/output-build/common" --exec-prefix="$pwd/output-build/$target"
make depend
# make clean
make
make install
echo =============================================================
echo = Success for target $target platform $platform ... =
echo =============================================================
}
findLatestSDKVersion iPhoneOS
buildit armv7 iPhoneOS
buildit armv7s iPhoneOS
buildit arm64 iPhoneOS
buildit i386 iPhoneSimulator
buildit x86_64 iPhoneSimulator
#LIPO=$(xcrun -sdk iphoneos -find lipo)
#$LIPO -create $pwd/output/armv7/lib/libpresage.a $pwd/output/armv7s/lib/libpresage.a $pwd/output/arm64/lib/libpresage.a $pwd/output/x86_64/lib/libpresage.a $pwd/output/i386/lib/libpresage.a -output libpresage.a
Configuration and make depend are Ok. make fails on each iOS target with this error:
Making all in /Users/maru/Documents/openldap-2c705e4/libraries
Entering subdirectory liblutil
cc -g -O2 -I../../include -I../../include -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.4.sdk -miphoneos-version-min=8.4 -c -o sasl.o sasl.c
sasl.c:26:10: fatal error: 'sasl/sasl.h' file not found
#include <sasl/sasl.h>
^
1 error generated.
make[2]: *** [sasl.o] Error 1
make[1]: *** [all-common] Error 1
make: *** [all-common] Error 1
Form what I can see SALS is not available for iOS and this is source of problems.
How I can overcome this problem? Can I configure openLDAP differently so it will use something else? Or is there a decent way to provide SASL for iOS?
I'm not familiar with iOS/OSX, but to disable Cyrus SASL you could try
--without-cyrus-sasl
in addition to your other ./configure flags, i.e. you need to run
./configure --with-tls=openssl --disable-slapd \
--without-cyrus-sasl \
--prefix="`pwd`/openldap-build/common" \
--exec-prefix="`pwd`/openldap-build/MacOS"
For further flags info check out
./configure --help
and this nice reference.
Here is part of my compilation result:
===============================================================================
You are ready to build VLC and its contribs
make: '.gas' is up to date.
[info] Building contrib for iOS in '/Users/nikhil.t/VLCKit/MobileVLCKit/ImportedSources/vlc/contrib/iPhoneOS-arm64'
[info] LD FLAGS SELECTED = '-L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/usr/lib -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -miphoneos-version-min=5.1'
/Users/nikhil.t/VLCKit/MobileVLCKit/ImportedSources/vlc
error: invalid deployment target '5.1.0' for architecture 'arm64' (requires
'7.0.0' or later)
1 error generated.
make: Nothing to be done for `fetch'.
error: invalid deployment target '5.1.0' for architecture 'arm64' (requires
'7.0.0' or later)
1 error generated.
sed -i.orig s/-ansi// freetype/builds/unix/configure
cd freetype && GNUMAKE=make CC="xcrun clang" CXX="xcrun clang++" LD="xcrun ld" AR="xcrun ar" CCAS="gas-preprocessor.pl xcrun clang -c" RANLIB="xcrun ranlib" STRIP="xcrun strip" PATH="/Users/nikhil.t/VLCKit/MobileVLCKit/ImportedSources/vlc/contrib/arm-apple-darwin11-arm64/bin:/Users/nikhil.t/VLCKit/MobileVLCKit/ImportedSources/vlc/extras/tools/build/bin:/Users/nikhil.t/VLCKit/MobileVLCKit/ImportedSources/vlc/extras/tools/build/bin:/Users/nikhil.t/VLCKit/MobileVLCKit/ImportedSources/vlc/contrib/arm-apple-darwin11/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin" CPPFLAGS="-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -arch arm64 -miphoneos-version-min=5.1 -O3 -g -arch arm64 -miphoneos-version-min=5.1 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -arch arm64 -miphoneos-version-min=5.1 -O3 -g -I/Users/nikhil.t/VLCKit/MobileVLCKit/ImportedSources/vlc/contrib/arm-apple-darwin11-arm64/include" CFLAGS="-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -arch arm64 -miphoneos-version-min=5.1 -O3 -g -arch arm64 -miphoneos-version-min=5.1 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -arch arm64 -miphoneos-version-min=5.1 -O3 -g -I/Users/nikhil.t/VLCKit/MobileVLCKit/ImportedSources/vlc/contrib/arm-apple-darwin11-arm64/include -g" CXXFLAGS="-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -arch arm64 -miphoneos-version-min=5.1 -O3 -g -arch arm64 -miphoneos-version-min=5.1 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -arch arm64 -miphoneos-version-min=5.1 -O3 -g -arch arm64 -miphoneos-version-min=5.1 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -arch arm64 -miphoneos-version-min=5.1 -O3 -g -I/Users/nikhil.t/VLCKit/MobileVLCKit/ImportedSources/vlc/contrib/arm-apple-darwin11-arm64/include -g -I/Users/nikhil.t/VLCKit/MobileVLCKit/ImportedSources/vlc/contrib/arm-apple-darwin11-arm64/include -g" LDFLAGS="-L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/usr/lib -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -miphoneos-version-min=5.1 -arch arm64 -miphoneos-version-min=5.1 -L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/usr/lib -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -miphoneos-version-min=5.1 -L/Users/nikhil.t/VLCKit/MobileVLCKit/ImportedSources/vlc/contrib/arm-apple-darwin11-arm64/lib" ./configure --without-png --prefix="/Users/nikhil.t/VLCKit/MobileVLCKit/ImportedSources/vlc/contrib/arm-apple-darwin11-arm64" --build="arm-apple-darwin11" --host="x86_64-apple-darwin11" --target="x86_64-apple-darwin11" --program-prefix="" --enable-static --disable-shared --disable-dependency-tracking --with-pic
FreeType build system -- automatic system detection
The following settings are used:
platform unix
compiler xcrun clang
configuration directory ./builds/unix
configuration rules ./builds/unix/unix.mk
If this does not correspond to your system or settings please remove the file
`config.mk' from this directory then read the INSTALL file for help.
Otherwise, simply type `make' again to build the library,
or `make refdoc' to build the API reference (the latter needs python).
cd builds/unix; /bin/sh ./configure '--without-png' '--prefix=/Users/nikhil.t/VLCKit/MobileVLCKit/ImportedSources/vlc/contrib/arm-apple-darwin11-arm64' '--build=arm-apple-darwin11' '--host=x86_64-apple-darwin11' '--target=x86_64-apple-darwin11' '--program-prefix=' '--enable-static' '--disable-shared' '--disable-dependency-tracking' '--with-pic'
configure: WARNING: unrecognized options: --disable-dependency-tracking
checking build system type... arm-apple-darwin11
checking host system type... x86_64-apple-darwin11
checking for x86_64-apple-darwin11-gcc... xcrun clang
checking whether the C compiler works... no
configure: error: in `/Users/nikhil.t/VLCKit/MobileVLCKit/ImportedSources/vlc/contrib/iPhoneOS-arm64/freetype/builds/unix':
configure: error: C compiler cannot create executables
See `config.log' for more details
make[1]: *** [setup] Error 77
make: *** [.freetype2] Error 2
===================================================================
I am using guideline provided by VLC
I tried to change the xcrun path in build.sh (ImportedSources/vlc/extras/package/ios/build.sh) but it resets to original once I build the script.
Is there another way I could change this, so that c compiler works for me?
I am stuck on this for the last 9 days, please provide some guidance.
Thanks,
Albin.K.J
The first error is:
error: invalid deployment target '5.1.0' for architecture 'arm64' (requires
'7.0.0' or later)
... so I would suggest trying what it suggests: bumping the deployment target up from 5.1.0 to 7.0.0, or remove arm64 support.
May be wrong compiler path.
Check the CC points to the correct path also it is as expected in the script file.
I also have the same issue, setting CC correctly did the trick for me.
The required compilers are missing from your system. You need both a C++ compiler and a C compiler.
You can install the compilers (GCC and G++) using apt-get install gcc g++.
I want to use Assimp in my upcoming ios project but having hard time to make it work. I followed the instructions from this:
How to build ASSIMP Library for iOS (Device and Simulator) with boost-library?
But Terminal keep telling me this:
rm: CMakeCache.txt: No such file or directory
/Users/hengchinsoon/Desktop/assimp/port/iOS/build_ios.sh: line 40: cmake: command not found
Building armv6 library
make: *** No rule to make target `clean'. Stop.
make: *** No rule to make target `assimp'. Stop.
cp: ./lib/libassimp.a: No such file or directory
rm: CMakeCache.txt: No such file or directory
/Users/hengchinsoon/Desktop/assimp/port/iOS/build_ios.sh: line 51: cmake: command not found
Building armv7 library
make: *** No rule to make target `clean'. Stop.
make: *** No rule to make target `assimp'. Stop.
cp: ./lib/libassimp.a: No such file or directory
rm: CMakeCache.txt: No such file or directory
/Users/hengchinsoon/Desktop/assimp/port/iOS/build_ios.sh: line 62: cmake: command not found
Building i386 library
make: *** No rule to make target `clean'. Stop.
make: *** No rule to make target `assimp'. Stop.
cp: ./lib/libassimp.a: No such file or directory
rm: ./lib/libassimp.a: No such file or directory
So I checked the assimp root folder and found out that there isn't any lib folder(which from the github descriptions, that is for windows usage). So i just made lib folder and try again. But still not working.
Can anybody share with me which part I did wrongly? Thanks!
Say if I successfully install whatever I need to install, then how to really use the library?
Should I copy the lib/ios/ folder into my ios projects?
What I want to do is to import some .blend files then I can experiment on the shader and other cool stuffs.
I am decent ios developer and have basic understanding of OpenGL ES. Somehow the Assimp document confused me about what it does. I am not so sure if I don't understand Assimp at the core concept level or at the programming level. But I am still convinced that it is very flexible and powerful.
Thanks for helping.
I'm guessing that you are using the "buil_ios.sh" script, in that script there are a few errors.
You should first download Cmake from : Cmake Download
Install Cmake and then do the following.
First of all, I think that besides that output you are getting some message that tells you that some options that you put in the Cmake are not being used. That's because in the script the name of some vars are not well written.
Besides this, you should change the CMakeLists.txt file so you don't get an error while you try to build the library:
Define here the needed parameters
set (ASSIMP_SV_REVISION 1023) <-- It should be less than 1024.
set (ASSIMP_VERSION ${ASSIMP_VERSION_MAJOR}) <-- here you will find some parameters like this. (parameter0).(parameter1)...
Mac OS doesn't like to put names using this nomenclature: parameter0.parameter1.paramter.2.a I guess it's because of the '.'.
So after a long day I finally managed to build the library. Another options is to get the library compiled from the project openframeworks, the path it's this: "/addons/ofxAssimpModelLoader/libs/assimp/lib/ios/assimp.a"
Here you have a link to the library
There you can find the library already compiled for the arm6 arm7 and i386 architectures.
I'm going to put you the script modified here.
#!/bin/sh
# build.sh
#######################
# BUILD ASSIMP for iOS and iOS Simulator
#######################
BUILD_DIR="./lib/ios"
IOS_BASE_SDK="5.0"
IOS_DEPLOY_TGT="3.2"
setenv_all()
{
# Add internal libs
export CFLAGS="$CFLAGS"
export CPP="$DEVROOT/usr/bin/llvm-cpp-4.2"
export CXX="$DEVROOT/usr/bin/llvm-g++-4.2"
export CXXCPP="$DEVROOT/usr/bin/llvm-cpp-4.2"
export CC="$DEVROOT/usr/bin/llvm-gcc-4.2"
export LD=$DEVROOT/usr/bin/ld
export AR=$DEVROOT/usr/bin/ar
export AS=$DEVROOT/usr/bin/as
export NM=$DEVROOT/usr/bin/nm
export RANLIB=$DEVROOT/usr/bin/ranlib
export LDFLAGS="-L$SDKROOT/usr/lib/"
export CPPFLAGS=$CFLAGS
export CXXFLAGS=$CFLAGS
}
setenv_arm6()
{
unset DEVROOT SDKROOT CFLAGS CC LD CPP CXX AR AS NM CXXCPP RANLIB LDFLAGS CPPFLAGS CXXFLAGS
export DEVROOT=/Developer/Platforms/iPhoneOS.platform/Developer
export SDKROOT=$DEVROOT/SDKs/iPhoneOS$IOS_BASE_SDK.sdk
export CFLAGS="-arch armv6 -pipe -no-cpp-precomp -isysroot $SDKROOT -miphoneos-version-min=$IOS_DEPLOY_TGT -I$SDKROOT/usr/include/"
setenv_all
rm CMakeCache.txt
cmake -G 'Unix Makefiles' -DCMAKE_TOOLCHAIN_FILE=./port/iOS/IPHONEOS_ARM6_TOOLCHAIN.cmake -DENABLE_BOOST_WORKAROUND=ON -DBUILD_STATIC_LIB=ON -DASSIMP_BUILD_STATIC_LIB=ON
}
setenv_arm7()
{
unset DEVROOT SDKROOT CFLAGS CC LD CPP CXX AR AS NM CXXCPP RANLIB LDFLAGS CPPFLAGS CXXFLAGS
export DEVROOT=/Developer/Platforms/iPhoneOS.platform/Developer
export SDKROOT=$DEVROOT/SDKs/iPhoneOS$IOS_BASE_SDK.sdk
export CFLAGS="-arch armv7 -pipe -no-cpp-precomp -isysroot $SDKROOT -miphoneos-version-min=$IOS_DEPLOY_TGT -I$SDKROOT/usr/include/"
setenv_all
rm CMakeCache.txt
cmake -G 'Unix Makefiles' -DCMAKE_TOOLCHAIN_FILE=./port/iOS/IPHONEOS_ARM7_TOOLCHAIN.cmake -DENABLE_BOOST_WORKAROUND=ON -DBUILD_STATIC_LIB=ON -DASSIMP_BUILD_STATIC_LIB=ON
}
setenv_i386()
{
unset DEVROOT SDKROOT CFLAGS CC LD CPP CXX AR AS NM CXXCPP RANLIB LDFLAGS CPPFLAGS CXXFLAGS
export DEVROOT=/Developer/Platforms/iPhoneSimulator.platform/Developer
export SDKROOT=$DEVROOT/SDKs/iPhoneSimulator$IOS_BASE_SDK.sdk
export CFLAGS="-arch i386 -pipe -no-cpp-precomp -isysroot $SDKROOT -miphoneos-version-min=$IOS_DEPLOY_TGT"
setenv_all
rm CMakeCache.txt
cmake -G 'Unix Makefiles' -DCMAKE_TOOLCHAIN_FILE=./port/iOS/IPHONEOS_i386_TOOLCHAIN.cmake -DENABLE_BOOST_WORKAROUND=ON -DBUILD_STATIC_LIB=ON -DASSIMP_BUILD_STATIC_LIB=ON
}
create_outdir()
{
for lib_i386 in `find $BUILD_DIR/i386 -name "lib*\.a"`; do
lib_arm6=`echo $lib_i386 | sed "s/i386/arm6/g"`
lib_arm7=`echo $lib_i386 | sed "s/i386/arm7/g"`
lib=`echo $lib_i386 | sed "s/i386\///g"`
echo 'Creating fat binary...'
lipo -arch armv6 $lib_arm6 -arch armv7 $lib_arm7 -arch i386 $lib_i386 -create -output $lib
done
echo 'Done! You will find the libaries and fat binary library in /lib/ios'
}
cd ../../
rm -rf $BUILD_DIR
mkdir -p $BUILD_DIR/arm6 $BUILD_DIR/arm7 $BUILD_DIR/i386
setenv_arm6
echo 'Building armv6 library'
make clean
make assimp -j 8 -l
cp ./lib/libassimp.a $BUILD_DIR/arm6/
setenv_arm7
echo 'Building armv7 library'
make clean
make assimp -j 8 -l
cp ./lib/libassimp.a $BUILD_DIR/arm7/
setenv_i386
echo 'Building i386 library'
make clean
make assimp -j 8 -l
cp ./lib/libassimp.a $BUILD_DIR/i386/
rm ./lib/libassimp.a
create_outdir
I read somewhere that an alternative to this is to use openframeworks since it already incorporate assimp lib.
http://www.openframeworks.cc/download/
look for ios version. and inside there is a folder contain example/ios/assimpExample/ folder would be a good starting point.
Have fun!:D
The boost root for me on Mac with the latest version of Homebrew is the following:
BOOST_ROOT=~/.homebrew/Cellar/boost/1.53.0
Your version of boost may be different, so the last folder will vary. But as of a recent homebrew version, Cellar gets install within the current user's home directory.
I've been trying to cross compile libogg for armv6, armv6 and i386 using the iOS 5.1 SDK in Mountain Lion. Libogg uses autoconf, and I've been having pretty similar issues with a few other libraries as well. I picked up a neat little cross-compiling script from here. I had to update it a bit to find the location of the SDK's.
GLOBAL_OUTDIR="`pwd`/dependencies"
mkdir -p $GLOBAL_OUTDIR/include $GLOBAL_OUTDIR/lib
OUTDIR="./outdir"
OGG_LIB="`pwd`/libogg-1.3.0"
IOS_BASE_SDK="5.1"
IOS_DEPLOY_TGT="3.2"
setenv_all()
{
# Add internal libs
export CFLAGS="$CFLAGS -I$GLOBAL_OUTDIR/include -L$GLOBAL_OUTDIR/lib"
export CXX="$DEVROOT/usr/bin/llvm-g++-4.2"
export CC="$DEVROOT/usr/bin/llvm-gcc-4.2"
export LD=$DEVROOT/usr/bin/ld
export AR=$DEVROOT/usr/bin/ar
export AS=$DEVROOT/usr/bin/as
export NM=$DEVROOT/usr/bin/nm
export RANLIB=$DEVROOT/usr/bin/ranlib
export LDFLAGS="-L$SDKROOT/usr/lib/"
export CPPFLAGS=$CFLAGS
export CXXFLAGS=$CFLAGS
}
setenv_arm6()
{
unset DEVROOT SDKROOT CFLAGS CC LD CPP CXX AR AS NM CXXCPP RANLIB LDFLAGS CPPFLAGS CXXFLAGS
export DEVROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer
export SDKROOT=$DEVROOT/SDKs/iPhoneOS$IOS_BASE_SDK.sdk
export CFLAGS="-arch armv6 -pipe -no-cpp-precomp -isysroot $SDKROOT -miphoneos-version-min=$IOS_DEPLOY_TGT -I$SDKROOT/usr/include/"
setenv_all
}
setenv_arm7()
{
unset DEVROOT SDKROOT CFLAGS CC LD CPP CXX AR AS NM CXXCPP RANLIB LDFLAGS CPPFLAGS CXXFLAGS
export DEVROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer
export SDKROOT=$DEVROOT/SDKs/iPhoneOS$IOS_BASE_SDK.sdk
export CFLAGS="-arch armv7 -pipe -no-cpp-precomp -isysroot $SDKROOT -miphoneos-version-min=$IOS_DEPLOY_TGT -I$SDKROOT/usr/include/"
setenv_all
}
setenv_i386()
{
unset DEVROOT SDKROOT CFLAGS CC LD CPP CXX AR AS NM CXXCPP RANLIB LDFLAGS CPPFLAGS CXXFLAGS
export DEVROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer
export SDKROOT=$DEVROOT/SDKs/iPhoneSimulator$IOS_BASE_SDK.sdk
export CFLAGS="-arch i386 -pipe -no-cpp-precomp -isysroot $SDKROOT -miphoneos-version-min=$IOS_DEPLOY_TGT"
setenv_all
}
create_outdir_lipo()
{
for lib_i386 in `find $LOCAL_OUTDIR/i386 -name "lib*\.a"`; do
lib_arm6=`echo $lib_i386 | sed "s/i386/arm6/g"`
lib_arm7=`echo $lib_i386 | sed "s/i386/arm7/g"`
lib=`echo $lib_i386 | sed "s/i386\///g"`
lipo -arch armv6 $lib_arm6 -arch armv7 $lib_arm7 -arch i386 $lib_i386 -create -output $lib
done
}
merge_libfiles()
{
DIR=$1
LIBNAME=$2
cd $DIR
for i in `find . -name "lib*.a"`; do
$AR -x $i
done
$AR -r $LIBNAME *.o
rm -rf *.o __*
cd -
}
And then to build the ogg library.
## libogg
cd $OGG_LIB
rm -rf $OUTPUT_DIR
mkdir -p $OUTDIR/arm6 $OUTDIR/arm7 $OUTDIR/i386
## Build for armv6
make clean 2> /dev/null
make distclean 2> /dev/null
setenv_arm6
./configure --host=arm-apple-darwin6 --enable-shared=no
make
cp /src/.libs/libogg.a $OUTDIR/arm6
## Build for armv7
make clean 2> /dev/null
make distclean 2> /dev/null
setenv_arm7
./configure --host=arm-apple-darwin7 --enable-shared=no
make
cp src/.libs/libogg.a $OUTDIR/arm7
## Build for iPhone simulator
make clean 2> /dev/null
setenv_i386
./configure
make -j4
cp src/.libs/libogg.a $OUTDIR/i386
## Stich it altogether in a fat .a file.
create_outdir_lipo
Anyway, when building armv6 and armv7, configure finds the compiler's and sdk's okay , and the compiling stage goes off without a hitch. But they both fail to link. The armv7 build spits out the error.
ld: in section __TEXT,__text reloc 1: unknown relocation type 9 for architecture armv7 collect2: ld returned 1 exit status
And when I test the output binary with lipo :
$ lipo -info libogg.a
lipo: archive with no architecture specification: libogg.a (can't determine architecture for it)
What is strange is i386 seems to compile perfectly, (I've tried it in the simulator and all is okay).
Any suggestions on what I can do to try and fix this, or a least where I should start looking. Sorry for the massive code dumps, and thanks.
I was able to solve this by setting the optimization level on the compile to -O3 instead of -O4. With -O4 the files output do not seem to be recognizable to lipo (and even file reports them as data instead of Mach-O object arm).
Update: It seems quite a few people are encountering difficulty compiling Ogg Vorbis. I have made my build available. See: Precompiled Ogg Vorbis Libraries for iOS.