Compiling PJSIP "--enable-shared". Some libs with incorrect architecture

HD
Harold Dijkstra
Mon, Aug 29, 2016 7:58 PM

I'm trying to Build PJSIP as a dynamic library for our iOS app /
open-source Cocoapod. Building is done on osx 10.11.6.
I have made some progress with the help of somebody reading this mailing
list (in response to
http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/2016-August/019448.html
)

When compiling PJSIP with the "--enable-shared" option, most of the lib's
are build correctly.
However, some libs are compile for the wrong architecture, in this case
x86_64 instead of arm64
libg7221codec.dylib is architecture: x86_64
libgsmcodec.dylib is architecture: x86_64
libilbccodec.dylib is architecture: x86_64
libresample.dylib is architecture: x86_64
libyuv.dylib is architecture: x86_64

Whereas these are correct:
libpjsip.dylib is architecture: arm64
libpjsua.dylib is architecture: arm64
libpjsua2.dylib is architecture: arm64

  • ./configure-iphone --enable-shared
  • make dep
  • make clean
    al complete correctly but
  • make
    generates these warnings:
    ld: warning: -undefined dynamic_lookup is deprecated on iOS
    ld: warning: -flat_namespace is deprecated on iOS

and a lot of warnings looking like this:
ld: warning: ignoring file
output/libilbccodec-arm64-apple-darwin_ios/iLBC_decode.o, file was built
for unsupported file format ( 0xCF 0xFA 0xED 0xFE 0x0C 0x00 0x00 0x01 0x00
0x00 0x00 0x00 0x01 0x00 0x00 0x00 ) which is not the architecture being
linked (x86_64): output/libilbccodec-arm64-apple-darwin_ios/iLBC_decode.o
ld: warning: ignoring file
output/libg7221codec-arm64-apple-darwin_ios/common/common.o, file was built
for unsupported file format ( 0xCF 0xFA 0xED 0xFE 0x0C 0x00 0x00 0x01 0x00
0x00 0x00 0x00 0x01 0x00 0x00 0x00 ) which is not the architecture being
linked (x86_64): output/libg7221codec-arm64-apple-darwin_ios/common/common.o

and:
ld: warning: ignoring file /pjsip/src/third_party/lib/libg7221codec.dylib,
file was built for x86_64 which is not the architecture being linked
(arm64): /pjsip/src/third_party/lib/libg7221codec.dylib

What could be the reason that some lib are compiled for the correct
architecture and some are not? How would I be able to fix this?

If successful, we will wrap this dynamically compiled version op PJSIP into
a Cocoapod which will be maintained by us an will remain open-source.
The repo can be found here: https://github.com/VoIPGRID/Vialer-pjsip-iOS

For background information, the environment variables as printed by
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 iPhoneOS9.3.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: 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
SDKPATH =
/Applications/XCode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.3.sdk
CFLAGS = -miphoneos-version-min=9.0 -DPJ_SDK_NAME=""iPhoneOS9.3.sdk""
-arch arm64 -isysroot
/Applications/XCode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.3.sdk
LDFLAGS = -O2 -arch arm64 -isysroot
/Applications/XCode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.3.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
ARCH = arm64

I'm trying to Build PJSIP as a dynamic library for our iOS app / open-source Cocoapod. Building is done on osx 10.11.6. I have made some progress with the help of somebody reading this mailing list (in response to http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/2016-August/019448.html ) When compiling PJSIP with the "--enable-shared" option, most of the lib's are build correctly. However, some libs are compile for the wrong architecture, in this case x86_64 instead of arm64 libg7221codec.dylib is architecture: x86_64 libgsmcodec.dylib is architecture: x86_64 libilbccodec.dylib is architecture: x86_64 libresample.dylib is architecture: x86_64 libyuv.dylib is architecture: x86_64 Whereas these are correct: libpjsip.dylib is architecture: arm64 libpjsua.dylib is architecture: arm64 libpjsua2.dylib is architecture: arm64 + ./configure-iphone --enable-shared + make dep + make clean al complete correctly but + make generates these warnings: ld: warning: -undefined dynamic_lookup is deprecated on iOS ld: warning: -flat_namespace is deprecated on iOS and a lot of warnings looking like this: ld: warning: ignoring file output/libilbccodec-arm64-apple-darwin_ios/iLBC_decode.o, file was built for unsupported file format ( 0xCF 0xFA 0xED 0xFE 0x0C 0x00 0x00 0x01 0x00 0x00 0x00 0x00 0x01 0x00 0x00 0x00 ) which is not the architecture being linked (x86_64): output/libilbccodec-arm64-apple-darwin_ios/iLBC_decode.o ld: warning: ignoring file output/libg7221codec-arm64-apple-darwin_ios/common/common.o, file was built for unsupported file format ( 0xCF 0xFA 0xED 0xFE 0x0C 0x00 0x00 0x01 0x00 0x00 0x00 0x00 0x01 0x00 0x00 0x00 ) which is not the architecture being linked (x86_64): output/libg7221codec-arm64-apple-darwin_ios/common/common.o and: ld: warning: ignoring file /pjsip/src/third_party/lib/libg7221codec.dylib, file was built for x86_64 which is not the architecture being linked (arm64): /pjsip/src/third_party/lib/libg7221codec.dylib What could be the reason that some lib are compiled for the correct architecture and some are not? How would I be able to fix this? If successful, we will wrap this dynamically compiled version op PJSIP into a Cocoapod which will be maintained by us an will remain open-source. The repo can be found here: https://github.com/VoIPGRID/Vialer-pjsip-iOS For background information, the environment variables as printed by 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 iPhoneOS9.3.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: 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 SDKPATH = /Applications/XCode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.3.sdk CFLAGS = -miphoneos-version-min=9.0 -DPJ_SDK_NAME="\"iPhoneOS9.3.sdk\"" -arch arm64 -isysroot /Applications/XCode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.3.sdk LDFLAGS = -O2 -arch arm64 -isysroot /Applications/XCode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.3.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 ARCH = arm64