Opened 11 months ago

Closed 11 months ago

Last modified 11 months ago

#56396 closed defect (wontfix)

Bulding shared library libcurl for iOS with bitcode support from sources failed

Reported by: AlexanderplUs (Alexander Ushakov) Owned by: ryandesign (Ryan Schmidt)
Priority: Normal Milestone:
Component: ports Version: 2.4.3
Keywords: Cc:
Port: curl

Description

I try to compile curl (the latest version curl-7_59_0) as shared library for iOS with bitcode support (-fembed-bitcode flags) using MacPorts and get next linker error:

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

This error is caused by libtool.m4 script which add -flat_namespace and -undefined suppress flags to the linker command line:

    case $host_os in
    rhapsody* | darwin1.[[012]])
      _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;;
    darwin1.*)
      _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;;
    darwin*) # darwin 5.x on
      # if running on 10.5 or later, the deployment target defaults
      # to the OS version, if on x86, and 10.4, the deployment
      # target defaults to 10.4. Don't you love it?
      case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
        10.0,*86*-darwin8*|10.0,*-darwin[[91]]*)
          _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;;
        10.[[012]][[,.]]*)
          _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;;
        10.*)
          _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;;
      esac

If I manually remove this flags library compiles succesfully. How can I turn off adding of this flags for iOS libraries compilation as they both are incompatible with LLVM bitcode?

uname -a:

Darwin Mac-mini.local 17.5.0 Darwin Kernel Version 17.5.0: Mon Mar  5 22:24:32 PST 2018; root:xnu-4570.51.1~1/RELEASE_X86_64 x86_64

My config for curl:

CLAGS="-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 -fembed-bitcode -Wc,-fembed-bitcode -DTARGET_OS_IPHONE=1" 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 -fembed-bitcode -Wc,-fembed-bitcode -DTARGET_OS_IPHONE=1" curl/configure --enable-shared --disable-static --host=armv7-apple-darwin --prefix=output/armv7-apple-darwin --enable-pic --without-zlib --enable-ipv6 --disable-dict --disable-gopher --disable-file --disable-ldap --disable-ldaps --disable-manual --disable-pop3 --disable-smtp --disable-imap --disable-proxy --disable-rtsp --disable-smb --disable-telnet --disable-verbose --disable-tftp --without-libidn --without-librtmp --with-sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk

Change History (10)

comment:1 Changed 11 months ago by raimue (Rainer Müller)

Component: baseports
Keywords: macos libtool.m4 bitcode shared removed
Owner: set to ryandesign
Port: curl added
Status: newassigned

comment:2 Changed 11 months ago by raimue (Rainer Müller)

Note that -fembed-bitcode is not officially supported by MacPorts. There was an attempt to get this into base, but the author abandoned it.

comment:3 Changed 11 months ago by pmetzger (Perry E. Metzger)

So is the issue that something we don't support isn't working? If so, this should probably be closed, and if and only if we feel the functionality should be supported, a new ticket should be opened on adding the functionality.

comment:4 Changed 11 months ago by AlexanderplUs (Alexander Ushakov)

My request isn’t about curl port. It is about libtool m4 script. I’m searcing a way to disable adding of two unneeded linker flags. Unfortunately they are hardcoded for all host_os begining with darwin.

I’ve used MacPorts for building different libraries for iOS for several years and it worked very well. It is the first time I’ve faced a problem.

comment:5 in reply to:  4 ; Changed 11 months ago by ryandesign (Ryan Schmidt)

Resolution: wontfix
Status: assignedclosed

Replying to AlexanderplUs:

My request isn’t about curl port. It is about libtool m4 script.

...which is distributed with curl. So you should report the problem to the developers of curl.

comment:6 in reply to:  5 ; Changed 11 months ago by AlexanderplUs (Alexander Ushakov)

Resolution: wontfix
Status: closedreopened

Replying to ryandesign:

Replying to AlexanderplUs:

My request isn’t about curl port. It is about libtool m4 script.

...which is distributed with curl. So you should report the problem to the developers of curl.

libtool.m4 is MacPorts script installed from /opt/local/share/aclocal/libtool.m4. It is included into the curl build by autotools. So it isn't curl script.

comment:7 Changed 11 months ago by AlexanderplUs (Alexander Ushakov)

The main problem is that by default libtool.m4 has a suggestion in it that compilation must have MACOSX_DEPLOYMENT_TARGET and if it isn't found script works as if it is "10.0". But in my case there is an IPHONEOS_DEPLOYMENT_TARGET instead of MACOSX_DEPLOYMENT_TARGET (see https://developer.apple.com/library/content/documentation/DeveloperTools/Conceptual/cross_development/Configuring/configuring.html). I think it'll be better to remove default value for MACOSX_DEPLOYMENT_TARGET or add check for IPHONEOS_DEPLOYMENT_TARGET in libtool.m4 section:

case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
        10.0,*86*-darwin8*|10.0,*-darwin[[91]]*)
          _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;;
        10.[[012]][[,.]]*)
          _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;;
        10.*)
          _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;;
      esac
Last edited 11 months ago by AlexanderplUs (Alexander Ushakov) (previous) (diff)

comment:8 in reply to:  6 ; Changed 11 months ago by raimue (Rainer Müller)

This is a bug report for an unsupported build configuration, as you changed the build flags of the port. There is also no patch provided we are supposed to apply. I am sorry, but I do not see the action we are supposed to take here.

The libtool.m4 script is distributed with the curl tarball. You will likely run into the same issue if you try to build with these flags outside of MacPorts. Therefore the issue is not specific to MacPorts.

We could reassign this ticket to the libtool port, but it is unlikely that this gets any kind of traction. You could try to get some more input on macports-dev, where this would be exposed to more developers. However, the issue that libtool.m4 does not respect IPHONEOS_DEPLOYMENT_TARGET and any proposed changes to solve that should eventually be discussed with the upstream developers. libtool.m4 is maintained by GNU libtool.

comment:9 Changed 11 months ago by pmetzger (Perry E. Metzger)

Resolution: wontfix
Status: reopenedclosed

comment:10 in reply to:  8 Changed 11 months ago by AlexanderplUs (Alexander Ushakov)

Replying to raimue:

We could reassign this ticket to the libtool port, but it is unlikely that this gets any kind of traction. You could try to get some more input on macports-dev, where this would be exposed to more developers. However, the issue that libtool.m4 does not respect IPHONEOS_DEPLOYMENT_TARGET and any proposed changes to solve that should eventually be discussed with the upstream developers. libtool.m4 is maintained by GNU libtool.

Ok, I didn't know that it is a part of libtool and not Macports fixes. Thank you for assistance.

Note: See TracTickets for help on using tickets.