Compiler

RSS for tag

Discuss the various compiler and toolchain technologies used in development.

Posts under Compiler tag

112 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

Xcode 12.5 Multiple commands produce framework and ProcessXCFramework
Hi, I'm from the App Center SDKs team. After updating Xcode from 12.4 to 12.5 our team faced build issues similar to this: Multiple commands produce '/Users/user/Library/Developer/Xcode/DerivedData/AppCenter/Build/Products/Debug-iphonesimulator/AppCenter.framework': 1) Command: ProcessXCFramework /Users/user/appcenter-sdk-apple/AppCenter-SDK-Apple/XCFramework/AppCenter.xcframework /Users/user/Library/Developer/Xcode/DerivedData/AppCenter/Build/Products/Debug-iphonesimulator/AppCenter.framework ios simulator 2) Target 'AppCenter iOS Framework' has create directory command with output '/Users/user/Library/Developer/Xcode/DerivedData/AppCenter/Build/Products/Debug-iphonesimulator/AppCenter.framework' Repro steps: Build AppCenter iOS Framework target. Build AppCenter target which creates an xcframework for iOS, macOS, and tvOS platforms. Build AppCenter iOS Framework and/or AppCenter Analytics iOS Framework target. Build SasquatchPuppet target (it uses AppCenter iOS Framework and AppCenter Analytics Framework targets). After the issue happened only Product > Clean build folder can help. We've tried to automate cleaning the build artifacts (BUILD_DIR) etc, but it doesn't help. Also, we've tried to use separate Product Names for XCFramework and mere Frameworks, but it was not possible for us in the end because of the xcconfig variables visibility. Similar issue: https://developer.apple.com/forums/thread/679542
3
0
46k
Nov ’23
Xcode 13 beta | Failed to build module 'Network' for importation due to the errors above; the textual interface may be broken by project issues or a compiler bug
I have a project which has iOS 10.0 deployment target in which I import Network framework in some class and conditionally using it depending on the host app’s iOS version.   With Xcode 13 beta 4(13A5201i), I am able to compile and run the project successfully while debugging on iPhone device but it gives below error. This was working fine with Xcode 12.5.1 /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.0.sdk/usr/lib/swift/Network.swiftmodule/armv7-apple-ios.swiftinterface:1254:19: 'NWConnection' is only available in iOS 12.0 or newer /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.0.sdk/usr/lib/swift/Network.swiftmodule/armv7-apple-ios.swiftinterface:1254:1: Add @available attribute to enclosing extension /Application/NWBrowserManager.swift:10:8: Failed to build module 'Network' for importation due to the errors above; the textual interface may be broken by project issues or a compiler bug
12
0
10k
Nov ’23
How to fully apply parallel computing on CPU and GPU of M1max
Project is based on python3.8 and 3.9, containing some C and C++ source How can I do parallel computing on CPU and GPU of M1max In deed, I buy Mac m1max for the strong GPU to do quantitative finance, for which the speed is extremely important. Unfortunately, cuda is not compatible with Mac. Show me how to do it, thx. Are Accelerate(for CPU) and Metal(for GPU) can speed up any source by building like this: Step 1: download source from github Step 2: create a file named "site.cfg"in this souce file, and add content: [accelerate] libraries=Metal, Acelerate, vecLib Step 3: Terminal: NPY_LAPACK_Order=accelerate python3 setup.py build Step 4: pip3 install . or python3 setup.py install ? (I am not sure which method to apply) 2、how is the compatibility of such method? I need speed up numpy, pandas and even a open souce project, such as https://github.com/microsoft/qlib 3、just show me the code 4、when compiling C++, C source, a lot of errors were reported, which gcc and g++ to choose? the default gcc installed by brew is 4.2.1, which cannot work. and I even tried to download gcc from the offical website of ARM, still cannot work. give me a hint. thx so much urgent
1
1
2.2k
Oct ’23
How to include <bits/stdc++.h> file using clang++ compiler?
Hi, I am a student and I wanted to include &lt;bits/stdc++.h&gt; file in my code so that it will help me avoid including many files in my program to save time during competitive programming, but while including above file in my program, it gives error "file not found", since clang++ do not have it present by default, so I want to add it manually. Please help me fix the issue. I already added bits folder at this location : /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1 following which I also created stdc++.h file but still error persists!!. I also made bits folder with stdc++.h file at this location too : /Library/Developer/CommandLineTools/usr/include/c++/v1 but again couldn't fix the error!! I also made respective changes in Homebrew folder (to fix it in g++ too, but again couldn't fix it!!)
6
2
4.9k
Nov ’23
Xcode 14.3 - Multiple commands produce swiftsourceinfo
Hello, I am with a long running project that is written in Objective-c and Swift (more). I have added a widget target extension to the project, but can't compile since there is this issue: What is the potential problem and how to solve it? = swiftsourceinfo Multiple commands produce '.../Build/Products/Debug-iphonesimulator/MyApp.swiftmodule/Project/arm64-apple-ios-simulator.swiftsourceinfo' Target 'MyApp' (project 'MyApp') has copy command from '.../Build/Intermediates.noindex/MyApp.build/Debug-iphonesimulator/MyApp.build/Objects-normal/arm64/MyApp.swiftsourceinfo' to '.../Build/Products/Debug-iphonesimulator/MyApp.swiftmodule/Project/arm64-apple-ios-simulator.swiftsourceinfo' Target 'MyAppWidgetsExtension' (project 'MyApp') has copy command from '.../Build/Intermediates.noindex/MyApp.build/Debug-iphonesimulator/MyAppWidgetsExtension.build/Objects-normal/arm64/MyApp.swiftsourceinfo' to '.../Build/Products/Debug-iphonesimulator/MyApp.swiftmodule/Project/arm64-apple-ios-simulator.swiftsourceinfo' = arm64-apple-ios-simulator.abi.json Multiple commands produce '.../Build/Products/Debug-iphonesimulator/MyApp.swiftmodule/arm64-apple-ios-simulator.abi.json' Target 'MyApp' (project 'MyApp') has copy command from '.../Build/Intermediates.noindex/MyApp.build/Debug-iphonesimulator/MyApp.build/Objects-normal/arm64/MyApp.abi.json' to '.../Build/Products/Debug-iphonesimulator/MyApp.swiftmodule/arm64-apple-ios-simulator.abi.json' Target 'MyAppWidgetsExtension' (project 'MyApp') has copy command from '.../Build/Intermediates.noindex/MyApp.build/Debug-iphonesimulator/MyAppWidgetsExtension.build/Objects-normal/arm64/MyApp.abi.json' to '.../Build/Products/Debug-iphonesimulator/MyApp.swiftmodule/arm64-apple-ios-simulator.abi.json' = .swiftdoc Multiple commands produce '.../Build/Products/Debug-iphonesimulator/MyApp.swiftmodule/arm64-apple-ios-simulator.swiftdoc' Target 'MyApp' (project 'MyApp') has copy command from '.../Build/Intermediates.noindex/MyApp.build/Debug-iphonesimulator/MyApp.build/Objects-normal/arm64/MyApp.swiftdoc' to '.../Build/Products/Debug-iphonesimulator/MyApp.swiftmodule/arm64-apple-ios-simulator.swiftdoc' Target 'MyAppWidgetsExtension' (project 'MyApp') has copy command from '.../Build/Intermediates.noindex/MyApp.build/Debug-iphonesimulator/MyAppWidgetsExtension.build/Objects-normal/arm64/MyApp.swiftdoc' to '.../Build/Products/Debug-iphonesimulator/MyApp.swiftmodule/arm64-apple-ios-simulator.swiftdoc' = .swiftmodule Multiple commands produce '.../Build/Products/Debug-iphonesimulator/MyApp.swiftmodule/arm64-apple-ios-simulator.swiftmodule' Target 'MyApp' (project 'MyApp') has copy command from '.../Build/Intermediates.noindex/MyApp.build/Debug-iphonesimulator/MyApp.build/Objects-normal/arm64/MyApp.swiftmodule' to '.../Build/Products/Debug-iphonesimulator/MyApp.swiftmodule/arm64-apple-ios-simulator.swiftmodule' Target 'MyAppWidgetsExtension' (project 'MyApp') has copy command from '.../Build/Intermediates.noindex/MyApp.build/Debug-iphonesimulator/MyAppWidgetsExtension.build/Objects-normal/arm64/MyApp.swiftmodule' to '.../Build/Products/Debug-iphonesimulator/MyApp.swiftmodule/arm64-apple-ios-simulator.swiftmodule'
3
1
2k
Oct ’23
error: no member named 'nullptr_t' in the global namespace
clang++ compilation appears to be completely broken under the latest version of macos Ventura (13.3)/Xcode (14.3)/CommandLineTools/MacOsX.sdk (13.3) This is easy to reproduce. Here's the simplest example I can come up with: Create a file named Test.cpp with the following contents: #include &lt;cstddef&gt; int main() { return 0; } Try to compile it with the following command on a command line in Terminal.app window clang++ -std=c++17 -stdlib=libc++ -g -c -o Test.o Test.cpp This should compile successfully and create the file Test.o, but instead it generates an error that appears to come from bug(s) within the SDK (Entire error response shown below) Error response: In file included from Test.cpp:4: /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/cstddef:52:9: error: no member named 'nullptr_t' in the global namespace using ::nullptr_t; ~~^ 1 error generated. Unfortunately the error seems to occur early in the include chain of many headers. For example if instead of #include &lt;cstddef&gt; you use #include &lt;vector&gt; or #include &lt;list&gt; the number of errors returned increases dramatically. This has had the effect of derailing almost ALL of my C++ compilation on the latest version of Ventura -- a major problem for me, since I (and presumably many others) develop on the mac for a living. There are similar questions already posted on Stack Overflow / Stack Exchange: • https://stackoverflow.com/questions/75921280/updating-to-macos-13-3-broke-compiling-cpp • https://apple.stackexchange.com/questions/458062/unable-to-find-include-file-on-newly-updated-macosc-c/459037 I have also submitted the issue to Apple through the Feedback tool though I'm not sure this link is publicly viewable: • https://feedbackassistant.apple.com/feedback/12156695 A possible hint: Other internet research indicates that this problem may not occur when using Xcode to compile. I do not use Xcode, Visual Studio or any other IDE, so I haven't tested this. (I've always found it much quicker to operate "closer to the metal" with the command line and basic makefiles, so I haven't learned the IDEs.) I'd love it if anyone has any insights into how to fix this bug that has seemingly broken C++ development in the latest macos release. Thanks! Dave Lumieria
14
3
4.3k
Aug ’23
C++ Linker Error on M1 Mac running Hello World Program
I'm trying to run the program below on my M1 Pro MacBook Pro from the command line, but I am getting linker errors. Also, I do not want to use XCode, I like to develop in vim in my terminal and want to develop in the terminal rather than XCode. #include <iostream> #include <string> inline void print_string(std::string s = "Hello World!") { std::cout << s << std::endl; } int main() { print_string(); } The above program generates these errors: Undefined symbols for architecture arm64: "std::__1::locale::use_facet(std::__1::locale::id&) const", referenced from: std::__1::ctype<char> const& std::__1::use_facet<std::__1::ctype<char> >(std::__1::locale const&) in hello_world-fcbd23.o "std::__1::ios_base::getloc() const", referenced from: std::__1::basic_ios<char, std::__1::char_traits<char> >::widen(char) const in hello_world-fcbd23.o "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__init(char const*, unsigned long)", referenced from: std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string<std::__1::nullptr_t>(char const*) in hello_world-fcbd23.o "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__init(unsigned long, char)", referenced from: std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string(unsigned long, char) in hello_world-fcbd23.o "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_string()", referenced from: _main in hello_world-fcbd23.o std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> > std::__1::__pad_and_output<char, std::__1::char_traits<char> >(std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> >, char const*, char const*, char const*, std::__1::ios_base&, char) in hello_world-fcbd23.o "std::__1::basic_ostream<char, std::__1::char_traits<char> >::put(char)", referenced from: std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::endl<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) in hello_world-fcbd23.o "std::__1::basic_ostream<char, std::__1::char_traits<char> >::flush()", referenced from: std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::endl<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) in hello_world-fcbd23.o "std::__1::basic_ostream<char, std::__1::char_traits<char> >::sentry::sentry(std::__1::basic_ostream<char, std::__1::char_traits<char> >&)", referenced from: std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in hello_world-fcbd23.o "std::__1::basic_ostream<char, std::__1::char_traits<char> >::sentry::~sentry()", referenced from: std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in hello_world-fcbd23.o "std::__1::cout", referenced from: print_string(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in hello_world-fcbd23.o "std::__1::ctype<char>::id", referenced from: std::__1::ctype<char> const& std::__1::use_facet<std::__1::ctype<char> >(std::__1::locale const&) in hello_world-fcbd23.o "std::__1::locale::~locale()", referenced from: std::__1::basic_ios<char, std::__1::char_traits<char> >::widen(char) const in hello_world-fcbd23.o "std::__1::ios_base::__set_badbit_and_consider_rethrow()", referenced from: std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in hello_world-fcbd23.o "std::__1::ios_base::clear(unsigned int)", referenced from: std::__1::ios_base::setstate(unsigned int) in hello_world-fcbd23.o "std::terminate()", referenced from: ___clang_call_terminate in hello_world-fcbd23.o "___cxa_begin_catch", referenced from: ___clang_call_terminate in hello_world-fcbd23.o std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in hello_world-fcbd23.o "___cxa_call_unexpected", referenced from: std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> >::failed() const in hello_world-fcbd23.o std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> >::ostreambuf_iterator(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) in hello_world-fcbd23.o "___cxa_end_catch", referenced from: std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in hello_world-fcbd23.o "___gxx_personality_v0", referenced from: _main in hello_world-fcbd23.o std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in hello_world-fcbd23.o std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> > std::__1::__pad_and_output<char, std::__1::char_traits<char> >(std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> >, char const*, char const*, char const*, std::__1::ios_base&, char) in hello_world-fcbd23.o std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> >::failed() const in hello_world-fcbd23.o std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> >::ostreambuf_iterator(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) in hello_world-fcbd23.o std::__1::basic_ios<char, std::__1::char_traits<char> >::widen(char) const in hello_world-fcbd23.o ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation) If I run c code with gcc it works, but for some reason this c++ code isn't working. Is there a fix for this that does not require me to use Xcode?
3
0
1.7k
Sep ’23
Weird Swift concurrency warnings when building Swift project with Xcode 14.3
When building our project in Xcode 14.3, numerous weird warnings do not seem to be related to our code: <unknown>:0: warning: cannot form key path that captures non-sendable type 'KeyPath<AttributeScopes.FoundationAttributes, AttributeScopes.FoundationAttributes.DateFieldAttribute>' Swift.KeyPath:1:14: note: generic class 'KeyPath' does not conform to the 'Sendable' protocol public class KeyPath<Root, Value> : PartialKeyPath<Root> { ^ <unknown>:0: warning: cannot form key path that captures non-sendable type 'KeyPath<AttributeScopes.UIKitAttributes, AttributeScopes.UIKitAttributes.FontAttribute>' Swift.KeyPath:1:14: note: generic class 'KeyPath' does not conform to the 'Sendable' protocol public class KeyPath<Root, Value> : PartialKeyPath<Root> { ^ <unknown>:0: warning: cannot form key path that captures non-sendable type 'KeyPath<AttributeScopes.UIKitAttributes, AttributeScopes.UIKitAttributes.FontAttribute>' Swift.KeyPath:1:14: note: generic class 'KeyPath' does not conform to the 'Sendable' protocol public class KeyPath<Root, Value> : PartialKeyPath<Root> { ^ It is just a tiny portion of warnings we wee in build results each time. Hundreds of them make it impossible to spot other warnings that these logs might obscure. We can't figure out where they come from, what triggers them, and, more importantly, how to eliminate or at least suppress them. Can anyone suggest any workaround or give a clue on how to fix these warnings?
7
2
1.4k
Jun ’23
XCode 14.3.x and XCode 15 Beta Hangs On Compiling
We have a 7-year old codebase that uses a mix of frameworks including Rx and Firebase through Cocoapods. The compilation works fine up to XCode 14.2 but for some unknown reason the compilation just stuck / hang on XCode 14.3.x and XCode 15. There are several warnings in the codebase but the compiler does not output any error. Which is why we don't know what the exact issue(s) is/are. What's the change in XCode 14.3.x that could be causing this issue? If anyone has an idea on possible fix, willing to try it out.
2
0
1.2k
Oct ’23
Command PhaseScriptExecution Failed
Hello All, I am stuck in this error for a week. I tried reinstalling Xcode 14.1, adding '-f' in frameworks.sh but neither worked. Below is the error. I would really appreciate if you can help. Also, build gets succeeded and also I can run the app on the simulator, but I cannot archive it. Error PhaseScriptExecution [CP]\ Embed\ Pods\ Frameworks /Users/dhiralpanjwani/Library/Developer/Xcode/DerivedData/Lupus_Decision_Aid-haxtkzwojyytuwedvxiexocoohxi/Build/Intermediates.noindex/ArchiveIntermediates/Lupus\ Decision\ Aid/IntermediateBuildFilesPath/Lupus\ Decision\ Aid.build/Release-iphoneos/Lupus\ Decision\ Aid.build/Script-570BD887603D2E782013C015.sh (in target 'Lupus Decision Aid' from project 'Lupus Decision Aid') cd /Users/dhiralpanjwani/Downloads/iOS/Lupus\ Decision\ Aid\ copy /bin/sh -c /Users/dhiralpanjwani/Library/Developer/Xcode/DerivedData/Lupus_Decision_Aid-haxtkzwojyytuwedvxiexocoohxi/Build/Intermediates.noindex/ArchiveIntermediates/Lupus\\ Decision\\ Aid/IntermediateBuildFilesPath/Lupus\\ Decision\\ Aid.build/Release-iphoneos/Lupus\\ Decision\\ Aid.build/Script-570BD887603D2E782013C015.sh mkdir -p /Users/dhiralpanjwani/Library/Developer/Xcode/DerivedData/Lupus_Decision_Aid-haxtkzwojyytuwedvxiexocoohxi/Build/Intermediates.noindex/ArchiveIntermediates/Lupus Decision Aid/BuildProductsPath/Release-iphoneos/Lupus Decision Aid.app/Frameworks /Users/dhiralpanjwani/Downloads/iOS/Lupus Decision Aid copy/Pods/Target Support Files/Pods-Lupus Decision Aid/Pods-Lupus Decision Aid-frameworks.sh: line 43: source: unbound variable Command PhaseScriptExecution failed with a nonzero exit code
1
1
1.4k
Oct ’23
Problem Installing Cocoapods
I am losing my mind over this trying to prepare my react-native dev environment. fresh install of macOS 12.6.7, installed Xcode 14.2 and it went smooth, homebrew too, node and watchman too, however, when installing pod it fails for what it seems to be a gcc issue, I looked for gcc4.2 and llvm-gcc4.2 and found nothing, below the 2 logs current directory: /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.5/ext/ffi_c /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0 -r ./siteconf20230709-835-1hev0kq.rb extconf.rb checking for ffi.h... *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options. Provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/$(RUBY_BASE_NAME) --with-ffi_c-dir --without-ffi_c-dir --with-ffi_c-include --without-ffi_c-include=${ffi_c-dir}/include --with-ffi_c-lib --without-ffi_c-lib=${ffi_c-dir}/lib --enable-system-libffi --disable-system-libffi --with-libffi-config --without-libffi-config --with-pkg-config --without-pkg-config /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:467:in `try_do': The compiler failed to generate an executable file. (RuntimeError) You have to install development tools first. from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:585:in `block in try_compile' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:534:in `with_werror' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:585:in `try_compile' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:1109:in `block in have_header' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:959:in `block in checking_for' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:361:in `block (2 levels) in postpone' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:331:in `open' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:361:in `block in postpone' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:331:in `open' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:357:in `postpone' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:958:in `checking_for' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:1108:in `have_header' from extconf.rb:10:in `system_libffi_usable?' from extconf.rb:42:in `<main>' To see why this extension failed to compile, please check the mkmf.log which can be found here: /Library/Ruby/Gems/2.6.0/extensions/universal-darwin-21/2.6.0/ffi-1.15.5/mkmf.log extconf failed, exit code 1 package configuration for libffi is not found "xcrun clang -o conftest -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/universal-darwin21 -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/ruby/backward -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -g -Os -pipe -DHAVE_GCC_ATOMIC_BUILTINS -DUSE_FFI_CLOSURE_ALLOC conftest.c -L. -L/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib -L. -L/AppleInternal/Library/BuildRoots/c188b140-2ff3-11ed-a7e5-ca9c01dc79de/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.6.Internal.sdk/usr/local/lib -lruby.2.6 " In file included from conftest.c:1: In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/ruby.h:33: /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/ruby/ruby.h:24:10: fatal error: 'ruby/config.h' file not found #include "ruby/config.h" ^~~~~~~~~~~~~~~ /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/ruby/ruby.h:24:10: note: did not find header 'config.h' in framework 'ruby' (loaded from '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks') 1 error generated. checked program was: /* begin */ 1: #include "ruby.h" 2: 3: int main(int argc, char **argv) 4: { 5: return 0; 6: } /* end */
1
0
1.3k
Jul ’23
Swift Compiler Crashes with Internal Error (NSInvalidArgumentException)
Hello, I am a first-time app developer and I have not posted on forums before, so please bear with me if my question is basic or amateur. I have created an app on Xcode with storyboard. I have not added any code yet except for the AppDelegate, Scene Delegate, and View Controller files which are automatically added when the project is created. When I try to build, I get the following error: Description: Internal error. Please file a bug at feedbackassistant.apple.com and attach "/var/folders/w5/32zs74y9287ddqdp_yjkkdbw0000gn/T/IB-agent-diagnostics_2023-07-09_09-58-08_842000" I have filed a bug, but was wondering if any of you know of a workaround. Looking into Log.txt, I see the following error: Failed to compile nib consisting of IBCLLocationButton (x1), IBMKMapView (x1), IBProxyObject (x4), IBUIButton (x3), IBUIContainerView (x2), IBUIView (x2), IBUIViewAutolayoutGuide (x1), and IBWKWebView (x1). Exception name: NSInvalidArgumentException Exception reason: UIImage instances should generally not be encoded in NIBs - attempting to encode '<UIImage:0x6000002b1830 anonymous {41, 41} renderingMode=automatic(original)>' for key 'UIImage' of <UIImageView: 0x7f7e45f32a60; frame = (0 0; 41 41); opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x60000311c8c0>> My Main.storyboard file consists of a scrollview, with a table view inside. The table view has a custom prototype cell. My Xcode version is 14.2, and my deployment target is ios 16.2. I am using MacOS Monterrey. I have seen similar errors being discussed on this forum and others, but none exactly pertaining to the specific platform I am using. I have already tried cleaning the build folder and resetting my image views. Any help would be appreciated. Thank you.
1
1
638
Jul ’23
FirstTimeDebugging - compile warning
Dear community, I'm reading "Develop in Swift Fundamentals", and on page 89 it asks us to open a file from the downloaded file (page 9 - Download Student Materials link). I was running the last part of the exercise of page 89 and it seems I got stuck when trying to remove the last compile warning message: "1. Condition always evaluates to false" "Will never be executed" Please take a look at the screenshot, where you can see the whole code and context. I have tried to add a few breakpoints (rows 10 to 12) in order to see if they would get ignored but it looks like it's still there. Any idea how to remove / get rid of this compile warning message? Thanks, Rodrigo
4
0
704
Jul ’23
Investigating Third-Party IDE Integration Problems
I regularly see questions from folks who’ve run into problems with their third-party IDE on macOS. Specifically, the issue is that their IDE is invoking Apple’s command-line tools — things like clang and ld — and that’s failing in some way. This post collects my ideas on how to investigate, and potentially resolve, issues like this. If you have any questions or comments, please put them in a new thread here on DevForums. Tag it appropriately so that I see it. Good tags include Compiler, Linker, LLVM, and Command Line Tools. Share and Enjoy — Quinn “The Eskimo!” @ Developer Technical Support @ Apple let myEmail = "eskimo" + "1" + "@" + "apple.com" Investigating Third-Party IDE Integration Problems Many third-party IDEs rely on Apple tools. For example, the IDE might run clang to compile C code or run ld to link object files. These IDEs typically don’t include the tools themselves. Rather, they rely on you to install Xcode or Apple’s Command Line Tools package. These are available at Apple > Developer > Downloads Occasionally I see folks having problems with this. They most typically report that basic stuff, like compiling a simple C program, fails with some mysterious error. If you’re having such a problem, follow the steps below to investigate it. IMPORTANT Some IDEs come with their own tools for compiling and linking. Such IDEs are not the focus of this post. If you have problems with an IDE like that, contact its vendor. Select Your Tools macOS has a concept of the current command-line tools. This can either point to the tools within Xcode or to an installed Command Line Tools package. To see which tools are currently selected, run xcode-select with the --print-path argument. This is what you’ll see if you have Xcode installed in the Applications folder: % xcode-select --print-path /Applications/Xcode.app/Contents/Developer Note All of the tools I discuss here are documented in man pages. If you’re not familiar with those, see Reading UNIX Manual Pages. And this is what you’ll see with a Command Line Tools package selected. % xcode-select --print-path /Library/Developer/CommandLineTools There are two common problems with this: It points to something you’ve deleted. It points to something unexpected. Run the command above to see the current state. If necessary, change the state using the --switch option. For example: % xcode-select --print-path /Applications/Xcode.app/Contents/Developer % clang -v Apple clang version 14.0.3 (clang-1403.0.22.14.1) … % sudo xcode-select --switch ~/XcodeZone/Xcode-beta.app % clang -v Apple clang version 15.0.0 (clang-1500.0.38.1) … I have Xcode 14.3 in the Applications foledr and thus clang runs Clang 14.0.3. I have Xcode 15.0b5 in ~/XcodeZone, so switching to that yields Clang 15.0.0. It’s possible to run one specific command with different tools. See Select Your Tools Temporarily, below. Run a Simple Test A good diagnostic test is to use the selected command-line tools to compile a trivial test program. Consider this C [1] example: % cat hello.c #include <stdio.h> int main(int argc, char ** argv) { printf("Hello Cruel World!\n"); return 0; } % clang -o hello hello.c % ./hello Hello Cruel World! IMPORTANT If possible, run this from Terminal rather than, say, over SSH. You may need to expand this test program to exercise your specific case. For example, if your program is hitting an error when it tries to import the Core Foundation framework, add that import to your test program: % cat hello.c #include <stdio.h> #include <CoreFoundation/CoreFoundation.h> int main(int argc, char ** argv) { printf("Hello Cruel World!\n"); return 0; } When you compile your test program, you might see one of these results: Your test program compiles. Your test program fails with a similar error. Your test program fails with a different error. I’ll explore each case in turn. [1] For a C++ example, see C++ Issues, below. If your test program compiles… If your test program compiles from the shell, that proves that your basic command-line tools setup is fine. If the same program fails to compile in your IDE, there’s something IDE-specific going on here. I can’t help you with that. I recommend that you escalate the issue via the support channel for your IDE. If your test program fails with a similar error… If your test program fails with an error similar to the one you’re seeing in your IDE, there are two possibilities: There’s a bug in your test program’s code. There’s an environmental issue that’s affecting your command-line tools setup. Don’t rule out the first possibility. I regularly see folks bump into problems like this, where it turns out to be a bug in their code. For a specific example, see C++ Issues, below. Assuming, however, that your test program’s code is OK, it’s time to investigate environmental issues. See Vary Your Environment, below. If your test program fails with a different error… If your test program fails with a different error, look at the test program’s code to confirm that it’s correct, and that it accurately reflects the code you’re trying to run in your IDE. Vary Your Environment If your test program fails with the same error as you’re seeing in your IDE, and you are sure that the code is correct, it’s time to look for environmental factors. I typically do this with the steps described in the next sections, which are listed from most to least complex. These steps only tell you where things are going wrong, not what is going wrong. However, that’s often enough to continue the investigation of your issue. Vary Your Shell Try running your commands in a different shell. macOS’s default shell is zsh. Try running your commands in bash instead: % bash … bash-3.2$ clang -o hello hello.c bash-3.2$ ./hello Hello Cruel World! Or if you’ve switched your shell to bash, try it in zsh. Vary Your User Account Some problems are caused by settings tied to your user account. To investigate whether that’s an issue here: Use System Settings > Users & Groups to create a new user. Log in as that user. Run your test again. Vary Your Mac Some problems are system wide, so you need to test on a different Mac. The easiest way to do that is to set up a virtual machine (VM) and run your test there. Or, if you have a separate physical Mac, run your test on that. Vary Your Site If you’re working for an organisation, they may have installed software on your Mac that causes problems. If you have a Mac at home, try running your test there. It’s also possible that your network is causing problems [1]. If you have a laptop, try taking it to a different location to see if that changes things. [1] I rarely see this when building a simple test program, but it do see it with other stuff, like code signing. C++ Issues If you’re using C++, here’s a simple test you can try: % cat hello.cpp #include <iostream> int main() { std::cout << "Hello Cruel World!\n"; } % clang++ -o hello hello.cpp % ./hello Hello Cruel World! A classic problem with C++ relates to name mangling. Consider this example: % cat hello.c #include <stdio.h> #include "hello-core.h" int main(int argc, char ** argv) { HCSayHello(); return 0; } % cat hello-core.cpp #include "hello-core.h" #include <iostream> extern void HCSayHello() { std::cout << "Hello Cruel World!\n"; } % cat hello-core.h extern void HCSayHello(); % clang -c hello.c % clang++ -c hello-core.cpp % clang++ -o hello hello.o hello-core.o Undefined symbols for architecture x86_64: "_HCSayHello", referenced from: _main in hello.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) The issue here is that C++ generates a mangled name for HCSayHello: % nm hello-core.o | grep HCSayHello 0000000000000000 T __Z10HCSayHellov whereas C uses the non-mangled name: % nm hello.o | grep HCSayHello U _HCSayHello The fix is an appropriate application of extern "C": % cat hello-core.h extern "C" { extern void HCSayHello(); }; Select Your Tools Temporarily Sometimes you want to temporarily run a command from a particular tools package. To continue my earlier example, I currently have Xcode 14.3 installed in the Applications folder and Xcode 15.0b5 in ~/XcodeZone. Xcode 14.3 is the default but I can override that with the DEVELOPER_DIR environment variable: % clang -v Apple clang version 14.0.3 (clang-1403.0.22.14.1) … % DEVELOPER_DIR=~/XcodeZone/Xcode-beta.app/Contents/Developer clang -v Apple clang version 15.0.0 (clang-1500.0.38.1) …
0
0
623
Jul ’23
App trying to use compilation condition defined in SPM module
I'm defining a compilation condition in a SPM module that is being used by my iOS app. I'd like to be able to use the same compilation condition in my app code to determine behavior, but the condition doesn't seem to be getting set within my app. The condition is working as expected within the SPM module, just not in the iOS app that is importing the module. Package.swift excerpt target(..., swiftSettings: [.define("CONDITION", .when(configuration: .debug))] ) SPM Module #if CONDITION // Compiled and executes as expected #endif App #if CONDITION // Never compiled / triggered #endif
1
0
716
Aug ’23
Framework compatible issue
Hello everybody, I am a junior on iOS app development with Swift and Xcode IDE. I want to ask about the framework compatible issue. I got a framework called "RFIDBleFramework" which provided by vendor and this framework can help connecting to a RFID device and function well. After imported this framework to my project and build, I got the following error: "Failed to build module 'RFIDBleFramework'; this SDK is not supported by the compiler (the SDK is built with 'Apple Swift version 5.7.2 (swift-5.7.2-RELEASE)', while this compiler is 'Apple Swift version 5.7.2 (swiftlang-5.7.2.135.5 clang-1400.0.29.51)'). Please select a toolchain which matches the SDK." I want to know whether that means xcode for the same major, minor, and patch version of Swift(in this case, 5.7.2) still not compatible? Or I have some mistakes on import a framework? Sorry for my poor English, if there are some additional information required, I am willing to provide. Thank you for helping. My xcode version: Version 14.2 (14C18)
1
0
954
Aug ’23