cisco / libsrtp

Library for SRTP (Secure Realtime Transport Protocol)
Other
1.23k stars 476 forks source link

Failed to build shared library for iOS with bitcode support #411

Closed AlexanderplUs closed 4 years ago

AlexanderplUs commented 6 years ago

I've previously successfully compile static library libsrtp.a for iOS with bitcode enabled but when I switch to shared library I get next error:

ld: -undefined and -bitcode_bundle (Xcode setting ENABLE_BITCODE=YES) cannot be used together

Here is my config:

CPPFLAGS="-arch armv7 -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk -miphoneos-version-min=8.0 -DTARGET_OS_IPHONE=1 -fembed-bitcode"\
LDFLAGS="-arch armv7 -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk -miphoneos-version-min=8.0 -DTARGET_OS_IPHONE=1 -fembed-bitcode" \
srtp/configure -prefix=output/armv7-apple-darwin --host=armv7-apple-darwin

I make shared library using make shared_library

I can make build work just removing -undefined dynamic_lookup key from linking parameters in Makefile.in:

--- Makefile.in.orig    2018-04-25 21:03:51.000000000 +0400
+++ Makefile.in 2018-04-30 15:44:01.000000000 +0400
@@ -87,7 +87,7 @@
 SHAREDLIBSUFFIX = $(SHAREDLIBSUFFIXNOVER)
 else ifeq (darwin,$(findstring darwin,@host@))
 SHAREDLIB_DIR = $(libdir)
-SHAREDLIB_LDFLAGS = -dynamiclib -twolevel_namespace -undefined dynamic_lookup \
+SHAREDLIB_LDFLAGS = -dynamiclib -twolevel_namespace \
        -fno-common -headerpad_max_install_names -install_name $(libdir)/$@
 SHAREDLIBSUFFIXNOVER = dylib
 SHAREDLIBSUFFIX = $(SHAREDLIBVERSION).$(SHAREDLIBSUFFIXNOVER)

Is this undefined flag really needed? Or maybe some check for bitcode enabled (CFLAGS -fembed-bitcode or -fembed-bitcode-marker) can be added in configure script?

pabuhler commented 6 years ago

Hi, maintaining the OSX & IOS builds is mostly a contribution based effort so if you have something to contribute that would be great! I had a quick talk with someone that knows abit about OSX and they mentioned that twolevel_namespace is also something that could be removed. Are you able to make a PR with this this change? We have automatic builds on travis for OSX but I think they are just static builds, we should ensure that they are also shared builds as this change would effect both OSX & IOS.

pabuhler commented 4 years ago

Hi @AlexanderplUs , it has been awhile but I would like to get this resolved. I have tried building for ios on latest osx but dont manage to get it to work. Can you verify this is still and issues for you and if so the exact steps needed to reproduce. Thanks

pabuhler commented 4 years ago

This should work now as part of #472, just reopen if there are still issues.