I have been trying to build Libyuv for arm64 architecture and then integrate it to PJSIP library. But I am not getting any progress as Pjsip is not able to find the libyuv.a framework.
While configuring the Pjsip build, I use following command :
ARCH='-arch arm64' ./configure-iphone --with-libyuv=/Users/Mayur/Desktop/pjsip/externals/libyuv/out_ios/Release-iphoneos
This is the folder where libyuv.a is located.
But, while configuration, this line appears :
checking for I420Scale in -lyuv... no
Any suggestions on what's wrong here?
References :
Building Pjsip for iPhone : https://trac.pjsip.org/repos/wiki/Getting-Started/iPhone
Building libyuv : https://trac.pjsip.org/repos/ticket/1776
UPDATE
This is how I built libyuv.a
GYP_DEFINES="OS=ios target_arch=arm64 target_subarch=arm64" GYP_CROSSCOMPILE=1 GYP_GENERATOR_FLAGS="output_dir=out_ios" ./gyp_libyuv -f ninja --depth=. libyuv_test.gyp
ninja -j7 -C out_ios/Release-iphoneos libyuv_unittest
This successfully creates the library, but I am not getting a proper way to connect that lib!
Turns out that if you use the latest revision for PJSIP and install the libyuv framework as described in the question, it just builds perfectly.
Just check out the revision 5128, using the following command :
svn checkout -r 5128 http://svn.pjsip.org/repos/pjproject/trunk pjproject
It also contains fixes for orientation in iOS!
Use the following script for Building PJSIP Library.
Steps :
Copy Script and make .sh file.
Copy .sh file in PJSIP Lib folder.
Run chmod 777 .sh_filename
Run script (e.x ./pjsip_auto_2.6.sh)
#!/bin/sh
BASE_DIR=$(pwd)
# Create config_site.h file in path
echo "#define PJ_CONFIG_IPHONE 1
#define PJ_HAS_IPV6 1
#include <pj/config_site_sample.h>" > pjlib/include/pj/config_site.h
# Compile Library and Build For Default iPhone 4 use armv7 architecture
./configure-iphone && make dep && make clean && make
# Build For iPhone 5, use armv7s architecture
ARCH='-arch armv7s' ./configure-iphone && make dep && make clean && make
# Build For iPhone 5s, use arm64 architecture
ARCH='-arch arm64' ./configure-iphone && make dep && make clean && make
# Build For Simulator, use i386 architecture
export DEVPATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer
ARCH="-arch i386" CFLAGS="-O2 -m32 -mios-simulator-version-min=5.0" LDFLAGS="-O2 -m32 -mios-simulator-version-min=5.0" ./configure-iphone
make dep && make clean && make
# Build For Simulator, use x86_64 architecture
export DEVPATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer
ARCH="-arch x86_64" CFLAGS="-O2 -m32 -mios-simulator-version-min=5.0" LDFLAGS="-O2 -m32 -mios-simulator-version-min=5.0" ./configure-iphone
make dep && make clean && make
# Create (arm64,armv7,armv7s,i386, x86_64, unified) Folder
if [ ! -d libs/arm64 ];
then
mkdir -p libs/arm64
echo "arm64 Folder created"
else
echo "arm64 Folder exists"
fi
if [ ! -d libs/armv7 ];
then
mkdir -p libs/armv7
echo "armv7 Folder created"
else
echo "armv7 Folder exists"
fi
if [ ! -d libs/armv7s ];
then
mkdir -p libs/armv7s
echo "armv7s Folder created"
else
echo "armv7s Folder exists"
fi
if [ ! -d libs/i386 ];
then
mkdir -p libs/i386
echo "i386 Folder created"
else
echo "i386 Folder exists"
fi
if [ ! -d libs/x86_64 ];
then
mkdir -p libs/x86_64
echo "x86_64 Folder created"
else
echo "x86_64 Folder exists"
fi
if [ ! -d libs/unified ];
then
mkdir -p libs/unified
echo "unified Folder created"
else
echo "unified Folder exists"
fi
# Copy From pjlib folder to Libs
cp pjlib/lib/*-arm64-apple-darwin_ios.a libs/arm64/
cp pjlib/lib/*-armv7-apple-darwin_ios.a libs/armv7/
cp pjlib/lib/*-armv7s-apple-darwin_ios.a libs/armv7s/
cp pjlib/lib/*-i386-apple-darwin_ios.a libs/i386/
cp pjlib/lib/*-x86_64-apple-darwin_ios.a libs/x86_64/
# Copy From pjlib-util folder to Libs
cp pjlib-util/lib/*-arm64-apple-darwin_ios.a libs/arm64/
cp pjlib-util/lib/*-armv7-apple-darwin_ios.a libs/armv7/
cp pjlib-util/lib/*-armv7s-apple-darwin_ios.a libs/armv7s/
cp pjlib-util/lib/*-i386-apple-darwin_ios.a libs/i386/
cp pjlib-util/lib/*-x86_64-apple-darwin_ios.a libs/x86_64/
# Copy From pjmedia folder to Libs
cp pjmedia/lib/*-arm64-apple-darwin_ios.a libs/arm64/
cp pjmedia/lib/*-armv7-apple-darwin_ios.a libs/armv7/
cp pjmedia/lib/*-armv7s-apple-darwin_ios.a libs/armv7s/
cp pjmedia/lib/*-i386-apple-darwin_ios.a libs/i386/
cp pjmedia/lib/*-x86_64-apple-darwin_ios.a libs/x86_64/
# Copy From pjnath folder to Libs
cp pjnath/lib/*-arm64-apple-darwin_ios.a libs/arm64/
cp pjnath/lib/*-armv7-apple-darwin_ios.a libs/armv7/
cp pjnath/lib/*-armv7s-apple-darwin_ios.a libs/armv7s/
cp pjnath/lib/*-i386-apple-darwin_ios.a libs/i386/
cp pjnath/lib/*-x86_64-apple-darwin_ios.a libs/x86_64/
# Copy From pjsip folder to Libs
cp pjsip/lib/*-arm64-apple-darwin_ios.a libs/arm64/
cp pjsip/lib/*-armv7-apple-darwin_ios.a libs/armv7/
cp pjsip/lib/*-armv7s-apple-darwin_ios.a libs/armv7s/
cp pjsip/lib/*-i386-apple-darwin_ios.a libs/i386/
cp pjsip/lib/*-x86_64-apple-darwin_ios.a libs/x86_64/
# Copy From third_party folder to Libs
cp third_party/lib/*-arm64-apple-darwin_ios.a libs/arm64/
cp third_party/lib/*-armv7-apple-darwin_ios.a libs/armv7/
cp third_party/lib/*-armv7s-apple-darwin_ios.a libs/armv7s/
cp third_party/lib/*-i386-apple-darwin_ios.a libs/i386/
cp third_party/lib/*-x86_64-apple-darwin_ios.a libs/x86_64/
# Rename file name From Created folder
cd $BASE_DIR/libs/arm64/
rename 's/\-arm64\-apple\-darwin_ios//g' *.a
cd $BASE_DIR/libs/armv7/
rename 's/\-armv7\-apple\-darwin_ios//g' *.a
cd $BASE_DIR/libs/armv7s/
rename 's/\-armv7s\-apple\-darwin_ios//g' *.a
cd $BASE_DIR/libs/i386/
rename 's/\-i386\-apple\-darwin_ios//g' *.a
cd $BASE_DIR/libs/x86_64/
rename 's/\-x86_64\-apple\-darwin_ios//g' *.a
cd $BASE_DIR/libs/
# Combine Libs to united folder
export LIB_NAME="libg7221codec.a"
lipo -arch armv7 armv7/$LIB_NAME -arch armv7s armv7s/$LIB_NAME -arch arm64 arm64/$LIB_NAME -arch i386 i386/$LIB_NAME -arch x86_64 x86_64/$LIB_NAME -create -output unified/$LIB_NAME
export LIB_NAME="libgsmcodec.a"
lipo -arch armv7 armv7/$LIB_NAME -arch armv7s armv7s/$LIB_NAME -arch arm64 arm64/$LIB_NAME -arch i386 i386/$LIB_NAME -arch x86_64 x86_64/$LIB_NAME -create -output unified/$LIB_NAME
export LIB_NAME="libilbccodec.a"
lipo -arch armv7 armv7/$LIB_NAME -arch armv7s armv7s/$LIB_NAME -arch arm64 arm64/$LIB_NAME -arch i386 i386/$LIB_NAME -arch x86_64 x86_64/$LIB_NAME -create -output unified/$LIB_NAME
export LIB_NAME="libpj.a"
lipo -arch armv7 armv7/$LIB_NAME -arch armv7s armv7s/$LIB_NAME -arch arm64 arm64/$LIB_NAME -arch i386 i386/$LIB_NAME -arch x86_64 x86_64/$LIB_NAME -create -output unified/$LIB_NAME
export LIB_NAME="libpjlib-util.a"
lipo -arch armv7 armv7/$LIB_NAME -arch armv7s armv7s/$LIB_NAME -arch arm64 arm64/$LIB_NAME -arch i386 i386/$LIB_NAME -arch x86_64 x86_64/$LIB_NAME -create -output unified/$LIB_NAME
export LIB_NAME="libpjmedia-audiodev.a"
lipo -arch armv7 armv7/$LIB_NAME -arch armv7s armv7s/$LIB_NAME -arch arm64 arm64/$LIB_NAME -arch i386 i386/$LIB_NAME -arch x86_64 x86_64/$LIB_NAME -create -output unified/$LIB_NAME
export LIB_NAME="libpjmedia-codec.a"
lipo -arch armv7 armv7/$LIB_NAME -arch armv7s armv7s/$LIB_NAME -arch arm64 arm64/$LIB_NAME -arch i386 i386/$LIB_NAME -arch x86_64 x86_64/$LIB_NAME -create -output unified/$LIB_NAME
export LIB_NAME="libpjmedia-videodev.a"
lipo -arch armv7 armv7/$LIB_NAME -arch armv7s armv7s/$LIB_NAME -arch arm64 arm64/$LIB_NAME -arch i386 i386/$LIB_NAME -arch x86_64 x86_64/$LIB_NAME -create -output unified/$LIB_NAME
export LIB_NAME="libpjmedia.a"
lipo -arch armv7 armv7/$LIB_NAME -arch armv7s armv7s/$LIB_NAME -arch arm64 arm64/$LIB_NAME -arch i386 i386/$LIB_NAME -arch x86_64 x86_64/$LIB_NAME -create -output unified/$LIB_NAME
export LIB_NAME="libpjnath.a"
lipo -arch armv7 armv7/$LIB_NAME -arch armv7s armv7s/$LIB_NAME -arch arm64 arm64/$LIB_NAME -arch i386 i386/$LIB_NAME -arch x86_64 x86_64/$LIB_NAME -create -output unified/$LIB_NAME
export LIB_NAME="libpjsdp.a"
lipo -arch armv7 armv7/$LIB_NAME -arch armv7s armv7s/$LIB_NAME -arch arm64 arm64/$LIB_NAME -arch i386 i386/$LIB_NAME -arch x86_64 x86_64/$LIB_NAME -create -output unified/$LIB_NAME
export LIB_NAME="libpjsip-simple.a"
lipo -arch armv7 armv7/$LIB_NAME -arch armv7s armv7s/$LIB_NAME -arch arm64 arm64/$LIB_NAME -arch i386 i386/$LIB_NAME -arch x86_64 x86_64/$LIB_NAME -create -output unified/$LIB_NAME
export LIB_NAME="libpjsip-ua.a"
lipo -arch armv7 armv7/$LIB_NAME -arch armv7s armv7s/$LIB_NAME -arch arm64 arm64/$LIB_NAME -arch i386 i386/$LIB_NAME -arch x86_64 x86_64/$LIB_NAME -create -output unified/$LIB_NAME
export LIB_NAME="libpjsip.a"
lipo -arch armv7 armv7/$LIB_NAME -arch armv7s armv7s/$LIB_NAME -arch arm64 arm64/$LIB_NAME -arch i386 i386/$LIB_NAME -arch x86_64 x86_64/$LIB_NAME -create -output unified/$LIB_NAME
export LIB_NAME="libpjsua.a"
lipo -arch armv7 armv7/$LIB_NAME -arch armv7s armv7s/$LIB_NAME -arch arm64 arm64/$LIB_NAME -arch i386 i386/$LIB_NAME -arch x86_64 x86_64/$LIB_NAME -create -output unified/$LIB_NAME
export LIB_NAME="libpjsua2.a"
lipo -arch armv7 armv7/$LIB_NAME -arch armv7s armv7s/$LIB_NAME -arch arm64 arm64/$LIB_NAME -arch i386 i386/$LIB_NAME -arch x86_64 x86_64/$LIB_NAME -create -output unified/$LIB_NAME
export LIB_NAME="libresample.a"
lipo -arch armv7 armv7/$LIB_NAME -arch armv7s armv7s/$LIB_NAME -arch arm64 arm64/$LIB_NAME -arch i386 i386/$LIB_NAME -arch x86_64 x86_64/$LIB_NAME -create -output unified/$LIB_NAME
export LIB_NAME="libspeex.a"
lipo -arch armv7 armv7/$LIB_NAME -arch armv7s armv7s/$LIB_NAME -arch arm64 arm64/$LIB_NAME -arch i386 i386/$LIB_NAME -arch x86_64 x86_64/$LIB_NAME -create -output unified/$LIB_NAME
export LIB_NAME="libsrtp.a"
lipo -arch armv7 armv7/$LIB_NAME -arch armv7s armv7s/$LIB_NAME -arch arm64 arm64/$LIB_NAME -arch i386 i386/$LIB_NAME -arch x86_64 x86_64/$LIB_NAME -create -output unified/$LIB_NAME
export LIB_NAME="libyuv.a"
lipo -arch armv7 armv7/$LIB_NAME -arch armv7s armv7s/$LIB_NAME -arch arm64 arm64/$LIB_NAME -arch i386 i386/$LIB_NAME -arch x86_64 x86_64/$LIB_NAME -create -output unified/$LIB_NAME
export LIB_NAME="libwebrtc.a"
lipo -arch armv7 armv7/$LIB_NAME -arch armv7s armv7s/$LIB_NAME -arch arm64 arm64/$LIB_NAME -arch i386 i386/$LIB_NAME -arch x86_64 x86_64/$LIB_NAME -create -output unified/$LIB_NAME
echo 'Congratulation you have built PJSIP Library successfully'
Since PJSIP 2.5.5, libyuv is included in the PJSIP package and configure script param --with-libyuv is removed, check ticket #1937 for more info.
https://trac.pjsip.org/repos/wiki/Getting-Started/iPhone
Related
To compile PJSIP library for iPhone device, I am using this code
make distclean && make clean
ARCH='-arch arm64' ./configure-iphone --enable-opus-codec
make dep
make
This code allows me to install my app for single architecture only.
To compile pjsip for all the architectures (armv7, armv7s, arm64, i386, x86_64), Which command or tool I can use
--- One Way to build PJSIP libraries --- test with pjsip 2.6
//Updated for XCode 8.
Building PJSIP
$ cd /Users/ravimalviya/Developer/Dev2/trunk
//If you want to specify the minimum supported iOS version
//export MIN_IOS="-miphoneos-version-min=8.0"
Compile Library and Build For Default iPhone 4 use armv7 architecture
$ ./configure-iphone && make dep && make clean && make
Build For iPhone 5, use armv7s architecture
$ ARCH='-arch armv7s' ./configure-iphone && make dep && make clean && make
Build For iPhone 5s, use arm64 architecture
$ ARCH='-arch arm64' ./configure-iphone && make dep && make clean && make
Build For Simulator, use i386 architecture
export DEVPATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer
ARCH="-arch i386" CFLAGS="-O2 -m32 -mios-simulator-version-min=5.0" LDFLAGS="-O2 -m32 -mios-simulator-version-min=5.0" ./configure-iphone
make dep && make clean && make
Build For Simulator, use x86_64 architecture
export DEVPATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer
ARCH="-arch x86_64" CFLAGS="-O2 -m32 -mios-simulator-version-min=5.0" LDFLAGS="-O2 -m32 -mios-simulator-version-min=5.0" ./configure-iphone
make dep && make clean && make
The compilation result
pjlib/lib
pjlib-util/lib
pjmedia/lib
pjsip/lib
pjnath/lib
third_party/lib
Note add into project..
Combine resulting archtecture(arm64,armv7,armv7s,i386, x86_64) supported library .a file.
//goto directory where you collect all build library. create folder name arm64, armv7s, armv7, i386, x86_64 and put all library respectivly. each having only one arch supported library file.
//rename file in all these 5 folders it's a easy way to make universal library.
//Also create folder named unified where all unversal library will create.
$ export LIB_NAME="libg7221codec.a"
$ lipo -arch armv7 armv7/$LIB_NAME -arch armv7s armv7s/$LIB_NAME -arch arm64 arm64/$LIB_NAME -arch i386 i386/$LIB_NAME -arch x86_64 x86_64/$LIB_NAME -create -output unified/$LIB_NAME
//-arch armv7s armv7s/$LIB_NAME means support armv7s get library from directory armv7s/$LIB_NAME and $LIB_NAME file name that only support armv7s.
//-arch arm64 arm64/$LIB_NAME ............
//-arch armv7 armv7/$LIB_NAME ............
//-arch i386 i386/$LIB_NAME ..............
//-arch x86_64 x86_64/$LIB_NAME ..............
//unified/$LIB_NAME is directory where unversal library will build using lips. with same name $LIB_NAME that export. do it same.
//check which arch you lib is supporting
xcrun -sdk iphoneos lipo -info unified/$LIB_NAME
$ export LIB_NAME="libgsmcodec.a"
$ lipo -arch armv7 armv7/$LIB_NAME -arch armv7s armv7s/$LIB_NAME -arch arm64 arm64/$LIB_NAME -arch i386 i386/$LIB_NAME -arch x86_64 x86_64/$LIB_NAME -create -output unified/$LIB_NAME
$ export LIB_NAME="libilbccodec.a"
$ .....same as above in lipo......
$ export LIB_NAME="libpj.a"
$ .....same as above in lipo......
$ export LIB_NAME="libpjlib-util.a"
$ .....same as above in lipo......
$ export LIB_NAME="libpjmedia-audiodev.a"
$ .....same as above in lipo......
$ export LIB_NAME="libpjmedia-codec.a"
$ .....same as above in lipo......
$ export LIB_NAME="libpjmedia-videodev.a"
$ .....same as above in lipo......
$ export LIB_NAME="libpjmedia.a"
$ .....same as above in lipo......
$ export LIB_NAME="libpjnath.a"
$ .....same as above in lipo......
$ export LIB_NAME="libpjsdp.a"
$ .....same as above in lipo......
$ export LIB_NAME="libpjsip-simple.a"
$ .....same as above in lipo......
$ export LIB_NAME="libpjsip-ua.a"
$ .....same as above in lipo......
$ export LIB_NAME="libpjsip.a"
$ .....same as above in lipo......
$ export LIB_NAME="libpjsua.a"
$ .....same as above in lipo......
$ export LIB_NAME="libpjsua.a"
$ .....same as above in lipo......
$ export LIB_NAME="libpjsua2.a"
$ .....same as above in lipo......
$ export LIB_NAME="libresample.a"
$ .....same as above in lipo......
$ export LIB_NAME="libspeex.a"
$ .....same as above in lipo......
$ export LIB_NAME="libsrtp.a"
$ .....same as above in lipo......
$ export LIB_NAME="libyuv.a"
$ lipo -arch armv7 armv7/$LIB_NAME -arch armv7s armv7s/$LIB_NAME -arch arm64 arm64/$LIB_NAME -arch i386 i386/$LIB_NAME -arch x86_64 x86_64/$LIB_NAME -create -output unified/$LIB_NAME
Note: Unversal libraries you can add into your project and also mention in library search path.
//In order to use the pjsip libraries, we need to include folder that ahve header files that access .a files. Naturally, the header files are located in:
pjlib/include
pjlib-util/include
pjmedia/include
pjnath/include
pjsip/include
Note: do't add into project..buz you can not import like import <pjsip-lib/pjsip.h>
so just place these folder into project directory where ever you want but mention in header search path.
Enjoy (:)
Steps to compile for all devices.
compile for all devices separately
merge with lipo
eg.
-create /libsrtp-arm64-apple-darwin_ios.a /libsrtp-i386-apple-darwin_ios.a -output output_file_name
then use output_file_name.a as a universal library for all device and simulator
to check supported architecture : output_file_name.a
lipo -info name_of_static_lib
output :
/libsrtp-universal-apple-darwin_ios.a are: armv7 armv7s i386 x86_64 arm64
Compile PJSIP 2.5 Library for all archietectures
Thanks
We wrote a cocoapod that will create a static library that you can include in your project. For the moment you can only use it in an Objective C cocoapod environment. We are working on a version that will create a dynamic library so it can be used with Swift.
Please check it out on:
https://github.com/VoIPGRID/Vialer-pjsip-iOS
We've made an open source wrapper that makes integrating PJSIP in your iOS project a lot easier:
https://github.com/VoIPGRID/VialerSIPLib
the merge like this as posted
lipo -create /My\ Project/pjsip-universal/x86_64/libgsmcodec-x86_64-apple-darwin_ios.a /My\ Project/pjsip-universal/i386/libgsmcodec-i386-apple-darwin_ios.a /My\ Project/pjsip-universal/armv7s/libgsmcodec-armv7s-apple-darwin_ios.a /My\ Project/pjsip-universal/armv7/libgsmcodec-armv7-apple-darwin_ios.a /My\ Project/pjsip-universal/arm64/libgsmcodec-arm64-apple-darwin_ios.a -output /My\ Project/pjsip-universal/universal/libgsmcodec-universal-apple-darwin_ios.a
finally test it
lipo -info /My\ Project/pjsip-universal/libgsmcodec-universal-apple-darwin_ios.a
output:
Architectures in the fat file: /My Project/pjsip-universal/libgsmcodec-universal-apple-darwin_ios.a are: i386 armv7s armv7 x86_64 arm64
Once you generate the universal architecture:
Follow this link to add in you project from this line in link
Adding the header files into the project
how to add in project
Hope this will help you.
I am using this script to build pjsip for my archs.
I am running it in the pjsip root folder, it creates a uni folder containing the resulting libraries which I then link/add into my project.
#!/bin/bash
ARCHS="armv7 armv7s arm64"
mkdir -p uni
echo "Compiling..."
for arch in $ARCHS
do
echo $arch
echo "=================================="
echo
ARCH="-arch $arch" ./configure-iphone && make dep && make clean && make
echo "Done."
echo
done
RESULT_PATHS="pjlib/lib pjlib-util/lib pjmedia/lib pjsip/lib pjnath/lib third_party/lib"
for path in $RESULT_PATHS
do
echo $path
for file in `ls $path/*-armv7-*`
do
library=`echo $file | sed "s/-armv7-\(.*$\)//g"`
library_tail=`echo $file | sed "s/.*-armv7-//g"`
lipo -arch armv7 $library-armv7-$library_tail -arch armv7s $library-armv7s-$library_tail -arch arm64 $library-arm64-$library_tail -create -output $library.a
cp -vi $library.a uni
done
done
I'm trying to cross-compile lib for iOS simulator:
export CC="clang -arch i386 -mios-version-min=5.0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk"
export CXX="clang++ -arch i386 -mios-version-min=5.0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk"
../configure --prefix=/Users/asmirnov/Documents/dev/src/libadx_installed --enable-optimized --disable-assertions
unset CC CXX
make VERBOSE=1 -j4
and i'm getting error:
clang: error: invalid argument '-mmacosx-version-min=10.9' not allowed with '-miphoneos-version-min=5.0'
since i'm compiling for ios i'm using -miphoneos-version-min parameter and -mmacosx-version-min=10.9 is added automatically somehow.
How can i fix it?
UPDATE: make VERBOSE=1
llvm[3]: Linking Release Loadable Module LLVMHello.dylib
clang++ -O3 -rdynamic -Wl,-rpath -Wl,#executable_path/../lib -L/Users/asmirnov/Documents/dev/src/llvm_34_build_i386/Release/lib -L/Users/asmirnov/Documents/dev/src/llvm_34_build_i386/Release/lib -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk -miphoneos-version-min=5.0 -stdlib=libc++ -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk -miphoneos-version-min=5.0 -stdlib=libc++ -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk -miphoneos-version-min=5.0 -stdlib=libc++ -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk -miphoneos-version-min=5.0 -stdlib=libc++ -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk -miphoneos-version-min=5.0 -stdlib=libc++ -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk -miphoneos-version-min=5.0 -stdlib=libc++ -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk -miphoneos-version-min=5.0 -stdlib=libc++ -m32 -Wl,-flat_namespace -Wl,-undefined,suppress -dynamiclib -mmacosx-version-min=10.9 -o /Users/asmirnov/Documents/dev/src/llvm_34_build_i386/Release/lib/LLVMHello.dylib /Users/asmirnov/Documents/dev/src/llvm_34_build_i386/lib/Transforms/Hello/Release/Hello.o \
-Wl,-exported_symbols_list,/Users/asmirnov/Documents/dev/src/llvm_34_build_i386/lib/Transforms/Hello/Release/Hello.exports.sed -lz -lpthread -lcurses -lm
clang: error: invalid argument '-mmacosx-version-min=10.9' not allowed with '-miphoneos-version-min=5.0'
It was error in lib's Makefile, fixed by removing lines containing 'mmacosx-version-min'. By default it adds 'mmacosx-version-min' for non-ARM builds for some reason
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 am compiling libraries in the terminal with the following command to get an armv7 slice:
./configure CC=/Developer/usr/bin/arm-apple-darwin10-llvm-gcc-4.2 --host=arm
NOTE: I also change the ldflags, sysroot to provide the relevant path, although I don´t show that here to keep this short.
I have successfully generated code slices for: i686, i386 and armv7 and combined them, but I can´t get an armv7s slice.
What settings do I use for armv7s code slice?
You should specify -arch armv7s in CFLAGS. Below is what I use to build ICU:
INSTALL=`pwd`/..
if [ $# -eq 0 ]
then
$0 armv7 iPhoneOS
$0 armv7s iPhoneOS
$0 i386 iPhoneSimulator
mkdir -p $INSTALL/universal/lib
cd $INSTALL/armv7/lib
for f in *.a
do
echo $f
xcrun -sdk iphoneos lipo -output ../../universal/lib/$f -create -arch armv7 $f -arch armv7s ../../armv7s/lib/$f -arch i386 ../../i386/lib/$f
done
#cd ../..
else
echo $1 $2
ARCH=$1
PLATFORM=$2
TOOLCHAIN=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain
export CC="$TOOLCHAIN/usr/bin/clang"
DEVROOT=/Applications/Xcode.app/Contents/Developer/Platforms/$PLATFORM.platform/Developer
SDK=6.1
SDKROOT=$DEVROOT/SDKs/$PLATFORM$SDK.sdk
export CFLAGS="-arch $ARCH -isysroot $SDKROOT -miphoneos-version-min=5.0 -I/Users/xxx/icu/source/tools/tzcode"
export CXXFLAGS="$CFLAGS"
gnumake distclean
../../icu/source/configure --host=arm-apple-darwin --enable-static --disable-shared --with-cross-build=/Users/xxx/icu-build/mac --prefix=$INSTALL/$ARCH
gnumake
gnumake install
fi
You could do something similar to get what you want.
EDIT: How to call make with clang:
export CFLAGS=-arch armv7s # add more compiler flags as needed here
export CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
make
I've combined the crt.1.x.x.0, libarclite, and libclang Xcode of the three current device architectures in order to support armv6, armv7, and armv7s for my iOS app.
Original Stack Overflow post that helped me: https://stackoverflow.com/a/12836808/761902.
Since you are trying to compile a ARM (conventional iOS device) and Intel (OS X computer) architectures into one file, you can try getting the crt, libarclite, and libclang files specified in the original post.
As the ARM files were located under
Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/,
I would expect the equivalent i386 files to be located under
Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/
, I'm not sure what Xcode build platform i686 falls under since I don't recall seeing that before, but if it is a iPhoneSimulator.platform, it would be in the same files as the i386 platform.
You might also want to add i686 and i386 to your build settings. The below are my architecture settings for building for armv6, armv7, and armv7s.
If that doesn't work, you can also build i686, i386, and armv7s separately and merge the built binaries with lipo.
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.