question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[bug] Problem when build with Bitcode enabled

See original GitHub issue

Environment Details (include every applicable attribute)

  • Operating System+version: macos mont
  • Compiler+version: clang 13
  • Conan version: 1.48
  • Python version: 3.7

Steps to reproduce (Include if Applicable)

  1. Build: conan install openssl/1.1.1k@ -c:h tools.apple:enable_bitcode=True -pr:h conan/profiles/nativium_ios_profile --build

  2. Check: otool -l apps/app_rand.o | grep bitcode

When check, it need show:

  sectname __bitcode

The generated compiler command don’t include -fembed-bitcode:

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang  -I. -Iinclude -fPIC -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.4.sdk -fno-common -O3 -fPIC -mios-version-min=9.0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.4.sdk -arch armv7 -O3 -fPIC -DOPENSSL_PIC -DOPENSSLDIR="\"/Users/paulo/.conan/data/openssl/1.1.1k/_/_/package/4ac31d5d0c1627657f3e62f1b22936dec2100590/res\"" -DENGINESDIR="\"/Users/paulo/.conan/data/openssl/1.1.1k/_/_/package/4ac31d5d0c1627657f3e62f1b22936dec2100590/lib/engines-1.1\"" -D_REENTRANT -DNDEBUG -DNDEBUG  -MMD -MF apps/app_rand.d.tmp -MT apps/app_rand.o -c -o apps/app_rand.o apps/app_rand.c

Profile:

include(default)

[settings]
os=iOS
os.version=9.0
arch=armv7

Logs (Executed commands with output) (Include/Attach if Applicable)

conan install openssl/1.1.1k@ -c:h tool.enable_bitcode=True -pr:h conan/profiles/nativium_ios_profile --build
Configuration:
[settings]
arch=armv7
arch_build=x86_64
build_type=Release
compiler=apple-clang
compiler.libcxx=libc++
compiler.version=13
os=iOS
os.version=9.0
os_build=Macos
[options]
[build_requires]
[env]
[conf]
tool.enable_bitcode=True

openssl/1.1.1k: Forced build from source
Installing package: openssl/1.1.1k
Requirements
    openssl/1.1.1k from 'conancenter' - Cache
Packages
    openssl/1.1.1k:4ac31d5d0c1627657f3e62f1b22936dec2100590 - Build

Cross-build from 'Macos:x86_64' to 'iOS:armv7'
Installing (downloading, building) binaries...
openssl/1.1.1k: WARN: Build folder is dirty, removing it: /Users/paulo/.conan/data/openssl/1.1.1k/_/_/build/4ac31d5d0c1627657f3e62f1b22936dec2100590
openssl/1.1.1k: Copying sources to build folder
openssl/1.1.1k: Building your package in /Users/paulo/.conan/data/openssl/1.1.1k/_/_/build/4ac31d5d0c1627657f3e62f1b22936dec2100590
openssl/1.1.1k: Generator txt created conanbuildinfo.txt
openssl/1.1.1k: Aggregating env generators
openssl/1.1.1k: Calling build()
openssl/1.1.1k: using target: conan-Release-iOS-armv7-apple-clang-13 -> iphoneos-cross
openssl/1.1.1k: my %targets = (
    "conan-Release-iOS-armv7-apple-clang-13" => {
        inherit_from => [ "iphoneos-cross" ],
        cflags => add("-O3 -fPIC -mios-version-min=9.0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.4.sdk -arch armv7"),
        cxxflags => add("-O3 -fPIC -mios-version-min=9.0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.4.sdk -arch armv7"),
        defines => add("NDEBUG"),
        includes => add(),
        lflags => add(""),
        
        
        
        cc => "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang",
        cxx => "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++",
        ar => "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar",
        ranlib => "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib",
        perlasm_scheme => "ios32",
    },
);

openssl/1.1.1k: ['"conan-Release-iOS-armv7-apple-clang-13"', 'no-shared', '--prefix="/Users/paulo/.conan/data/openssl/1.1.1k/_/_/package/4ac31d5d0c1627657f3e62f1b22936dec2100590"', '--openssldir="/Users/paulo/.conan/data/openssl/1.1.1k/_/_/package/4ac31d5d0c1627657f3e62f1b22936dec2100590/res"', 'no-unit-test', 'threads', 'PERL=perl', 'no-tests', '--release', '-fPIC']
Configuring OpenSSL version 1.1.1k (0x101010bfL) for conan-Release-iOS-armv7-apple-clang-13
Using os-specific seed configuration
Creating configdata.pm
Creating Makefile

**********************************************************************
***                                                                ***
***   OpenSSL has been successfully configured                     ***
***                                                                ***
***   If you encounter a problem while building, please open an    ***
***   issue on GitHub <https://github.com/openssl/openssl/issues>  ***
***   and include the output from the following command:           ***
***                                                                ***
***       perl configdata.pm --dump                                ***
***                                                                ***
***   (If you are new to OpenSSL, you might want to consult the    ***
***   'Troubleshooting' section in the INSTALL file first)         ***
***                                                                ***
**********************************************************************
perl "-I." -Mconfigdata "util/dofile.pl" \
	    "-oMakefile" include/crypto/bn_conf.h.in > include/crypto/bn_conf.h
perl "-I." -Mconfigdata "util/dofile.pl" \
	    "-oMakefile" include/crypto/dso_conf.h.in > include/crypto/dso_conf.h
perl "-I." -Mconfigdata "util/dofile.pl" \
	    "-oMakefile" include/openssl/opensslconf.h.in > include/openssl/opensslconf.h
/Applications/Xcode.app/Contents/Developer/usr/bin/make depend && /Applications/Xcode.app/Contents/Developer/usr/bin/make _all
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang  -I. -Iinclude -fPIC -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.4.sdk -fno-common -O3 -fPIC -mios-version-min=9.0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.4.sdk -arch armv7 -O3 -fPIC -DOPENSSL_PIC -DOPENSSLDIR="\"/Users/paulo/.conan/data/openssl/1.1.1k/_/_/package/4ac31d5d0c1627657f3e62f1b22936dec2100590/res\"" -DENGINESDIR="\"/Users/paulo/.conan/data/openssl/1.1.1k/_/_/package/4ac31d5d0c1627657f3e62f1b22936dec2100590/lib/engines-1.1\"" -D_REENTRANT -DNDEBUG -DNDEBUG  -MMD -MF apps/app_rand.d.tmp -MT apps/app_rand.o -c -o apps/app_rand.o apps/app_rand.c
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang  -I. -Iinclude -fPIC -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.4.sdk -fno-common -O3 -fPIC -mios-version-min=9.0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.4.sdk -arch armv7 -O3 -fPIC -DOPENSSL_PIC -DOPENSSLDIR="\"/Users/paulo/.conan/data/openssl/1.1.1k/_/_/package/4ac31d5d0c1627657f3e62f1b22936dec2100590/res\"" -DENGINESDIR="\"/Users/paulo/.conan/data/openssl/1.1.1k/_/_/package/4ac31d5d0c1627657f3e62f1b22936dec2100590/lib/engines-1.1\"" -D_REENTRANT -DNDEBUG -DNDEBUG  -MMD -MF apps/apps.d.tmp -MT apps/apps.o -c -o apps/apps.o apps/apps.c

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:14 (14 by maintainers)

github_iconTop GitHub Comments

1reaction
franramirez688commented, May 27, 2022

Hi @paulocoutinhox

The problem is exactly the same as @memsharded said above (https://github.com/conan-io/conan/issues/11191#issuecomment-1120301634). Those recipes are using legacy generators instead of CMakeToolchain which is the new one that contains this bitcode logic.

To see how it works, you can try it easily by creating your own mytest recipe and running the conan create:

$ mkdir conan_test && cd conan_test
$ conan new mytest/1.0 -m cmake_lib
$ conan create . -c tools.apple:enable_bitcode=True

That mytest/1.0 recipe is using the new generators (including the CMakeToolchain one):

    # ...
    def generate(self):
        tc = CMakeToolchain(self)
        tc.generate()

Checking the library created now:

$ otool -l [PATH_TO_CONAN_DATA_LIB]/libmytest.a | grep bitcode
  sectname __bitcode

And there it is.

0reactions
paulocoutinhoxcommented, Sep 20, 2022

Thanks, i will wait all the recipes be updated to remove it from my project.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Xcode setting ENABLE_BITCODE | Apple Developer Forums
ld: warning: URGENT: all bitcode will be dropped because '***' was built without bitcode. You must rebuild it with bitcode enabled (Xcode setting ......
Read more >
Bug of the Month: Bitcode Compilation Errors
iOS developers run into bitcode compilation errors when building their app with an old version of Xcode. Use the latest version of LLVM...
Read more >
Flutter build ios bitcode problem, how to fix bitcode error
Firstly, if the library that you are using enables bitcode by default you won't have to go through the trouble of setting it...
Read more >
Bug - UnityFramework Bitcode error with Google mobile Ads
I've recently fixed this problem. You first disable "Enable Bitcode" via build settings : Enable Bitcode -> No
Read more >
Anyone else having trouble with bitcode? - Google Groups
Hello Sean,. Same problem here, apparently since Xcode 7 update. I was able to have linkage work again changing Build Settings -> Enable...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found