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] The C/C++ flags are not replicated to ObjC (.m) files

See original GitHub issue

Environment Details (include every applicable attribute)

  • Operating System+version: macos monterey
  • Compiler+version: clang
  • Conan version: 1.54
  • Python version: 3.10

Steps to reproduce (Include if Applicable)

git clone https://github.com/nativium/nativium-modules.git
make build-ios

You can see that inside nativium/build/ios/release/ios/arm64/conan/conanbuildinfo.txt you will have:

[ENV_darwin-toolchain]
ASFLAGS=-isysroot/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS16.1.sdk -fembed-bitcode -fobjc-arc -fvisibility=hidden
CFLAGS=-isysroot/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS16.1.sdk -fembed-bitcode -fobjc-arc -fvisibility=hidden
CMAKE_XCODE_ATTRIBUTE_BITCODE_GENERATION_MODE=bitcode
CMAKE_XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_ARC=YES
CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE=YES
CMAKE_XCODE_ATTRIBUTE_GCC_SYMBOLS_PRIVATE_EXTERN=YES
CONAN_CMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS16.1.sdk
CPPFLAGS=-isysroot/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS16.1.sdk -fembed-bitcode -fobjc-arc -fvisibility=hidden
CXXFLAGS=-isysroot/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS16.1.sdk -fembed-bitcode -fobjc-arc -fvisibility=hidden
DYLD_FRAMEWORK_PATH=[]
DYLD_LIBRARY_PATH=[]
LDFLAGS=-isysroot/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS16.1.sdk -fembed-bitcode -fobjc-arc -fvisibility=hidden
LD_LIBRARY_PATH=[]
PATH=[]
SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS16.1.sdk

The C/CPP/CXX flags are passed to .cpp and .mm files, but not to .m files.

Example of .cpp is here: https://github.com/nativium/nativium-modules/actions/runs/3420851741/jobs/5696205720#step:15:437

Example of .mm is here: https://github.com/nativium/nativium-modules/actions/runs/3420851741/jobs/5696205720#step:15:183

Example of .m is here: https://github.com/nativium/nativium-modules/actions/runs/3420851741/jobs/5696205720#step:15:199

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

The compilation:

CompileC /Users/paulo/Developer/workspaces/cpp/nativium-modules/nativium/build/ios/release/ios/arm64/target/nativium.build/Release-iphoneos/nativium.build/Objects-normal/arm64/NTVFileHelperPlatformServiceImpl.o /Users/paulo/Developer/workspaces/cpp/nativium-modules/nativium/modules/file-helper/implementation/objc/nativium/io/NTVFileHelperPlatformServiceImpl.m normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler (in target 'nativium' from project 'nativium')
    cd /Users/paulo/Developer/workspaces/cpp/nativium-modules/nativium
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c -target arm64-apple-ios11.0 -fmessage-length\=245 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit\=0 -fcolor-diagnostics -Wno-trigraphs -fpascal-strings -O3 -Wno-missing-field-initializers -Wno-missing-prototypes -Wno-return-type -Wno-implicit-atomic-properties -Wno-objc-interface-ivars -Wno-arc-repeated-use-of-weak -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wno-unused-variable -Wunused-value -Wno-empty-body -Wno-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wno-constant-conversion -Wno-int-conversion -Wno-bool-conversion -Wno-enum-conversion -Wno-float-conversion -Wno-non-literal-null-conversion -Wno-objc-literal-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wno-undeclared-selector -Wno-deprecated-implementations -Wno-implicit-fallthrough -DCMAKE_INTDIR\=\"Release-iphoneos\" -Dnativium_EXPORTS -DNATIVIUM_VERSION\=\"1.0.0\" -DNATIVIUM_VERSION_CODE\=\"1\" -DHAS_UNCAUGHT_EXCEPTIONS\=0 -DSQLITE_OMIT_LOAD_EXTENSION -DPOCO_STATIC\=ON -DPOCO_UNBUNDLED -DPCRE2_STATIC -DXML_STATIC -DOBJC_OLD_DISPATCH_PROTOTYPES\=1 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS16.1.sdk -fstrict-aliasing -Wprotocol -Wdeprecated-declarations -Wno-sign-conversion -Wno-infinite-recursion -Wno-comma -Wno-block-capture-autoreleasing -Wno-strict-prototypes -Wno-semicolon-before-method-body -I/Users/paulo/Developer/workspaces/cpp/nativium-modules/nativium/build/ios/release/ios/arm64/target/lib/include -I/Users/paulo/Developer/workspaces/cpp/nativium-modules/nativium/modules/app-core/gluecode/generated-src/cpp -I/Users/paulo/Developer/workspaces/cpp/nativium-modules/nativium/modules/app-core/implementation/cpp -I/Users/paulo/Developer/workspaces/cpp/nativium-modules/nativium/modules/app-core/gluecode/generated-src/objc -I/Users/paulo/Developer/workspaces/cpp/nativium-modules/nativium/modules/app-domain/gluecode/generated-src/cpp -I/Users/paulo/Developer/workspaces/cpp/nativium-modules/nativium/modules/app-domain/implementation/cpp -I/Users/paulo/Developer/workspaces/cpp/nativium-modules/nativium/modules/app-domain/gluecode/generated-src/objc -I/Users/paulo/Developer/workspaces/cpp/nativium-modules/nativium/modules/app-enumerator/gluecode/generated-src/cpp -I/Users/paulo/Developer/workspaces/cpp/nativium-modules/nativium/modules/app-enumerator/implementation/cpp -I/Users/paulo/Developer/workspaces/cpp/nativium-modules/nativium/modules/app-enumerator/gluecode/generated-src/objc -I/Users/paulo/Developer/workspaces/cpp/nativium-modules/nativium/modules/app-helper/gluecode/generated-src/cpp -I/Users/paulo/Developer/workspaces/cpp/nativium-modules/nativium/modules/app-helper/implementation/cpp -I/Users/paulo/Developer/workspaces/cpp/nativium-modules/nativium/modules/app-helper/gluecode/generated-src/objc -I/Users/paulo/Developer/workspaces/cpp/nativium-modules/nativium/modules/app-repository/gluecode/generated-src/cpp -I/Users/paulo/Developer/workspaces/cpp/nativium-modules/nativium/modules/app-repository/implementation/cpp -I/Users/paulo/Developer/workspaces/cpp/nativium-modules/nativium/modules/app-repository/gluecode/generated-src/objc -I/Users/paulo/Developer/workspaces/cpp/nativium-modules/nativium/modules/app-system-service/gluecode/generated-src/cpp -I/Users/paulo/Developer/workspaces/cpp/nativium-modules/nativium/modules/app-system-service/implementation/cpp -I/Users/paulo/Developer/workspaces/cpp/nativium-modules/nativium/modules/app-system-service/gluecode/generated-src/objc -I/Users/paulo/Developer/workspaces/cpp/nativium-modules/nativium/modules/datetime/gluecode/generated-src/cpp -I/Users/paulo/Developer/workspaces/cpp/nativium-modules/nativium/modules/datetime/implementation/cpp -I/Users/paulo/Developer/workspaces/cpp/nativium-modules/nativium/modules/datetime/gluecode/generated-src/objc -I/Users/paulo/Developer/workspaces/cpp/nativium-modules/nativium/modules/file-helper/gluecode/generated-src/cpp -I/Users/paulo/Developer/workspaces/cpp/nativium-modules/nativium/modules/file-helper/implementation/cpp -I/Users/paulo/Developer/workspaces/cpp/nativium-modules/nativium/modules/file-helper/gluecode/generated-src/objc -I/Users/paulo/Developer/workspaces/cpp/nativium-modules/nativium/modules/http-client/gluecode/generated-src/cpp -I/Users/paulo/Developer/workspaces/cpp/nativium-modules/nativium/modules/http-client/implementation/cpp -I/Users/paulo/Developer/workspaces/cpp/nativium-modules/nativium/modules/http-client/gluecode/generated-src/objc -I/Users/paulo/Developer/workspaces/cpp/nativium-modules/nativium/modules/http-server/gluecode/generated-src/cpp -I/Users/paulo/Developer/workspaces/cpp/nativium-modules/nativium/modules/http-server/implementation/cpp -I/Users/paulo/Developer/workspaces/cpp/nativium-modules/nativium/modules/http-server/gluecode/generated-src/objc -I/Users/paulo/Developer/workspaces/cpp/nativium-modules/nativium/modules/logger/gluecode/generated-src/cpp -I/Users/paulo/Developer/workspaces/cpp/nativium-modules/nativium/modules/logger/implementation/cpp -I/Users/paulo/Developer/workspaces/cpp/nativium-modules/nativium/modules/logger/gluecode/generated-src/objc -I/Users/paulo/Developer/workspaces/cpp/nativium-modules/nativium/modules/shared-data/gluecode/generated-src/cpp -I/Users/paulo/Developer/workspaces/cpp/nativium-modules/nativium/modules/shared-data/implementation/cpp -I/Users/paulo/Developer/workspaces/cpp/nativium-modules/nativium/modules/shared-data/gluecode/generated-src/objc -I/Users/paulo/Developer/workspaces/cpp/nativium-modules/nativium/modules/string-helper/gluecode/generated-src/cpp -I/Users/paulo/Developer/workspaces/cpp/nativium-modules/nativium/modules/string-helper/implementation/cpp -I/Users/paulo/Developer/workspaces/cpp/nativium-modules/nativium/modules/string-helper/gluecode/generated-src/objc -I/Users/paulo/Developer/workspaces/cpp/nativium-modules/nativium/modules/support-lib -isystem /Users/paulo/.conan/data/openssl/1.1.1q/_/_/package/017047d5a3b54185794afd5f5d6495b8ec9b03ac/include -isystem /Users/paulo/.conan/data/nlohmann_json/3.11.2/_/_/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/include -isystem /Users/paulo/.conan/data/sqlite3/3.39.3/_/_/package/d986c0023d9a68e674021a1fd2fde8ec1b3fcea2/include -isystem /Users/paulo/.conan/data/sqlitecpp/3.2.0/_/_/package/58bdcbedf450c9d2630e5e43e6b28667ffcf3468/include -isystem /Users/paulo/.conan/data/date/3.0.1/_/_/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/include -isystem /Users/paulo/.conan/data/poco/1.12.2/_/_/package/65dd8f2a61abcea5cbad6d62b5d9a662ff8a7fb9/include -isystem /Users/paulo/.conan/data/pcre2/10.40/_/_/package/a5879f4d30a8285f9362fb1e5f11e238708e63de/include -isystem /Users/paulo/.conan/data/zlib/1.2.12/_/_/package/017047d5a3b54185794afd5f5d6495b8ec9b03ac/include -isystem /Users/paulo/.conan/data/bzip2/1.0.8/_/_/package/ad605cb1ccccaf92aa12e203ca245c8c2a2a6a94/include -isystem /Users/paulo/.conan/data/expat/2.4.8/_/_/package/6d6101c7afcb327b6c38a41be5f7ac3b443ff55a/include -I/Users/paulo/Developer/workspaces/cpp/nativium-modules/nativium/build/ios/release/ios/arm64/target/nativium.build/Release-iphoneos/nativium.build/DerivedSources-normal/arm64 -I/Users/paulo/Developer/workspaces/cpp/nativium-modules/nativium/build/ios/release/ios/arm64/target/nativium.build/Release-iphoneos/nativium.build/DerivedSources/arm64 -I/Users/paulo/Developer/workspaces/cpp/nativium-modules/nativium/build/ios/release/ios/arm64/target/nativium.build/Release-iphoneos/nativium.build/DerivedSources -F/Users/paulo/Developer/workspaces/cpp/nativium-modules/nativium/build/ios/release/ios/arm64/target/lib -MMD -MT dependencies -MF /Users/paulo/Developer/workspaces/cpp/nativium-modules/nativium/build/ios/release/ios/arm64/target/nativium.build/Release-iphoneos/nativium.build/Objects-normal/arm64/NTVFileHelperPlatformServiceImpl.d --serialize-diagnostics /Users/paulo/Developer/workspaces/cpp/nativium-modules/nativium/build/ios/release/ios/arm64/target/nativium.build/Release-iphoneos/nativium.build/Objects-normal/arm64/NTVFileHelperPlatformServiceImpl.dia -c /Users/paulo/Developer/workspaces/cpp/nativium-modules/nativium/modules/file-helper/implementation/objc/nativium/io/NTVFileHelperPlatformServiceImpl.m -o /Users/paulo/Developer/workspaces/cpp/nativium-modules/nativium/build/ios/release/ios/arm64/target/nativium.build/Release-iphoneos/nativium.build/Objects-normal/arm64/NTVFileHelperPlatformServiceImpl.o

The error:

Ld /Users/paulo/Developer/workspaces/cpp/nativium-modules/nativium/build/ios/release/ios/arm64/target/lib/nativium.framework/nativium normal (in target 'nativium' from project 'nativium')
    cd /Users/paulo/Developer/workspaces/cpp/nativium-modules/nativium
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -target arm64-apple-ios11.0 -dynamiclib -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS16.1.sdk -L/Users/paulo/Developer/workspaces/cpp/nativium-modules/nativium/build/ios/release/ios/arm64/target/EagerLinkingTBDs -L/Users/paulo/Developer/workspaces/cpp/nativium-modules/nativium/build/ios/release/ios/arm64/target/lib -F/Users/paulo/Developer/workspaces/cpp/nativium-modules/nativium/build/ios/release/ios/arm64/target/EagerLinkingTBDs -F/Users/paulo/Developer/workspaces/cpp/nativium-modules/nativium/build/ios/release/ios/arm64/target/lib -filelist /Users/paulo/Developer/workspaces/cpp/nativium-modules/nativium/build/ios/release/ios/arm64/target/nativium.build/Release-iphoneos/nativium.build/Objects-normal/arm64/nativium.LinkFileList -install_name @loader_path/Frameworks/nativium.framework/nativium -dead_strip -stdlib\=libc++ -fobjc-link-runtime -isysroot/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS16.1.sdk -fembed-bitcode -fobjc-arc -fvisibility\=hidden /Users/paulo/.conan/data/sqlitecpp/3.2.0/_/_/package/58bdcbedf450c9d2630e5e43e6b28667ffcf3468/lib/libSQLiteCpp.a /Users/paulo/.conan/data/sqlite3/3.39.3/_/_/package/d986c0023d9a68e674021a1fd2fde8ec1b3fcea2/lib/libsqlite3.a /Users/paulo/.conan/data/poco/1.12.2/_/_/package/65dd8f2a61abcea5cbad6d62b5d9a662ff8a7fb9/lib/libPocoNetSSL.a /Users/paulo/.conan/data/poco/1.12.2/_/_/package/65dd8f2a61abcea5cbad6d62b5d9a662ff8a7fb9/lib/libPocoUtil.a /Users/paulo/.conan/data/poco/1.12.2/_/_/package/65dd8f2a61abcea5cbad6d62b5d9a662ff8a7fb9/lib/libPocoJWT.a /Users/paulo/.conan/data/poco/1.12.2/_/_/package/65dd8f2a61abcea5cbad6d62b5d9a662ff8a7fb9/lib/libPocoCrypto.a /Users/paulo/.conan/data/openssl/1.1.1q/_/_/package/017047d5a3b54185794afd5f5d6495b8ec9b03ac/lib/libssl.a /Users/paulo/.conan/data/openssl/1.1.1q/_/_/package/017047d5a3b54185794afd5f5d6495b8ec9b03ac/lib/libcrypto.a /Users/paulo/.conan/data/poco/1.12.2/_/_/package/65dd8f2a61abcea5cbad6d62b5d9a662ff8a7fb9/lib/libPocoXML.a /Users/paulo/.conan/data/expat/2.4.8/_/_/package/6d6101c7afcb327b6c38a41be5f7ac3b443ff55a/lib/libexpat.a /Users/paulo/.conan/data/poco/1.12.2/_/_/package/65dd8f2a61abcea5cbad6d62b5d9a662ff8a7fb9/lib/libPocoNet.a /Users/paulo/.conan/data/poco/1.12.2/_/_/package/65dd8f2a61abcea5cbad6d62b5d9a662ff8a7fb9/lib/libPocoJSON.a /Users/paulo/.conan/data/poco/1.12.2/_/_/package/65dd8f2a61abcea5cbad6d62b5d9a662ff8a7fb9/lib/libPocoFoundation.a /Users/paulo/.conan/data/pcre2/10.40/_/_/package/a5879f4d30a8285f9362fb1e5f11e238708e63de/lib/libpcre2-32.a /Users/paulo/.conan/data/pcre2/10.40/_/_/package/a5879f4d30a8285f9362fb1e5f11e238708e63de/lib/libpcre2-16.a /Users/paulo/.conan/data/pcre2/10.40/_/_/package/a5879f4d30a8285f9362fb1e5f11e238708e63de/lib/libpcre2-posix.a /Users/paulo/.conan/data/pcre2/10.40/_/_/package/a5879f4d30a8285f9362fb1e5f11e238708e63de/lib/libpcre2-8.a /Users/paulo/.conan/data/bzip2/1.0.8/_/_/package/ad605cb1ccccaf92aa12e203ca245c8c2a2a6a94/lib/libbz2.a /Users/paulo/.conan/data/zlib/1.2.12/_/_/package/017047d5a3b54185794afd5f5d6495b8ec9b03ac/lib/libz.a -compatibility_version 1.0.0 -current_version 1.0.0 -Xlinker -dependency_info -Xlinker /Users/paulo/Developer/workspaces/cpp/nativium-modules/nativium/build/ios/release/ios/arm64/target/nativium.build/Release-iphoneos/nativium.build/Objects-normal/arm64/nativium_dependency_info.dat -o /Users/paulo/Developer/workspaces/cpp/nativium-modules/nativium/build/ios/release/ios/arm64/target/lib/nativium.framework/nativium
ld: '/Users/paulo/Developer/workspaces/cpp/nativium-modules/nativium/build/ios/release/ios/arm64/target/nativium.build/Release-iphoneos/nativium.build/Objects-normal/arm64/NTVFileHelperPlatformServiceImpl.o' does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. file '/Users/paulo/Developer/workspaces/cpp/nativium-modules/nativium/build/ios/release/ios/arm64/target/nativium.build/Release-iphoneos/nativium.build/Objects-normal/arm64/NTVFileHelperPlatformServiceImpl.o'
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Full log: https://github.com/nativium/nativium-modules/actions/runs/3420851741/jobs/5696205720#step:15:466

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
paulocoutinhoxcommented, Nov 17, 2022

I solved the problem.

The flags are not filled because of C support of CMake.

I need enable it changing from:

project(nativium LANGUAGES CXX)

to

project(nativium LANGUAGES C CXX)
1reaction
paulocoutinhoxcommented, Nov 10, 2022

Hi @franramirez688,

I already tried it, but it don’t work with all dependencies.

I open an issue in the past to talk about this: https://github.com/conan-io/conan/issues/12197

Because this o created mine that work with all dependencies.

Read more comments on GitHub >

github_iconTop Results From Across the Web

M-Files User Guide
M -Files Mobile is a mobile application available for iOS and Android devices. ... The version history is not copied to the new...
Read more >
Importing Project-Swift.h into a Objective-C class...file not found
I was running into the same issue and couldn't get my project to import swift into obj-c classes. Using Xcode 6, (should work...
Read more >
gcc(1) - Linux manual page - man7.org
M refers to a literal capital M. file.mii Objective-C++ source code that should not be preprocessed. file.h C, C++, Objective-C or Objective-C++ header...
Read more >
Objective-C - Wikipedia
Objective-C source code 'messaging/implementation' program files usually have .m filename extensions, while Objective-C 'header/interface' files have .h ...
Read more >
Objective-C Rules - Bazel 0.20.0
The lipo tool is used to combine files of multiple architectures. One of several flags may control which architectures are included in the...
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