hi
i want create a commande line tool for arm64 et intel x86-64
Xcode 16 macbook pro M3
my setting :
and
but my application compile only for arm64
who can explain to me ?
LLVM
RSS for tagThe LLVM compiler is the next-generation compiler introduced in Xcode 3.2 for Snow Leopard based on the open source LLVM.org project.
Posts under LLVM tag
29 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
Hello,
It appears that clang version provided by Xcode 16 brings this compilation error seen in previous LLVM version : https://github.com/llvm/llvm-project/issues/91362
Fixed in : https://github.com/llvm/llvm-project/pull/90760
#include <type_traits>
template <typename T>
struct class_tmpl {
template <bool B> static int call_e() { return 0; }
template <bool B> static int call_ne() noexcept { return 0; }
template <bool B> static int call() noexcept(std::is_nothrow_copy_assignable<T>::value) { return 0; }
};
int main(int argc, char *argv[])
{
using function_ptr = int (*)();
function_ptr f1 = &class_tmpl<int>::call_e<false>;
function_ptr f2 = &class_tmpl<int>::call_ne<false>;
function_ptr f3 = &class_tmpl<int>::call<false>;
return 0;
}
$ clang -std=c++17 main.cpp
main.cpp:15:24: error: address of overloaded function 'call' does not match required type 'int ()'
15 | function_ptr f3 = &class_tmpl<int>::call<false>;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.cpp:7:34: note: candidate template ignored: substitution failure [with B = false]
7 | template <bool B> static int call() noexcept(std::is_nothrow_copy_assignable<T>::value) { return 0; }
| ^
1 error generated.
Compiler informations :
clang --version
Apple clang version 16.0.0 (clang-1600.0.26.3)
Target: arm64-apple-darwin24.0.0
I'm encountering a bug with Xcode 16's clang's code generation. It seems to be generating incorrect optimized code (-O2 setting) when functions are inlined and then optimized. This is a behavior that didn't exist in Xcode 15, and also doesn't happen in open source clang (I tested open source clang 17/18/19 on my M1 Max MacBook Pro).
The entire code snippet is slightly too long to post here so I'm including a link to the godbolt compiler explorer instead: https://godbolt.org/z/KhG3x7E1d . This piece of code attempts to find a sequence of illegal UTF-8 characters and report the index of the character in a string.
Not that in godbolt, the program works fine and finishes correctly. When I test it in Xcode 16 though (with -O2), it doesn't, and utf_find_illegal returns 4 instead of 3, which is incorrect. Digging through the disassembly it seems to be doing some complicated optimizations by inlining both utf_ptr2len and utf_ptr2char together but it doesn't perform correctly and jumped to the wrong place when the illegal character was found.
I did try to see if there are some undefined behaviors or something which caused the optimizer to go to town with the code. Funnily when I use UBSAN (by compiling the code with -O2 -fsanitize=undefined) the code works just fine and the bug doesn't happen.
Wonder if other people have seen similar issues? Code generation bugs seem really dangerous considering that people rely on the compiler to… work. I tried to scrub the code to see if there are anything that could suggest the compiler to behave incorrectly but not having any luck as well.
I have also tested Xcode 16.1 beta and it doesn't seem to help.
Note: Yes, I know I'm supposed to use the Feedback Assistant but I have never received any responses on it even when filing legit bugs and their statuses are still open, with their bugs unfixed. Pardon me for not trusting it too much.
Hi there, I’m having issue with the python3 installation provided by Xcode’s toolchain. I’m currently writing a LLDB plugin, using the LLDB python API, to allow the user to visualize audio data from the current debugged program in a GUI, using tkinter and matplotlib. I'm using those because I'm developing a cross-platform plugin, as I'm initially a Linux developer who wants to make this available to my fellow Apple audio devs.
My issue arise at least on two setups
MacOS 12.7.6 Monterey with Xcode 14.2
MacOS 14 with Xcode 15.4 (not my machine)
Because I wanna support Xcode’s toolchain, I want to use Xcode’s lldb. Xcode’s lldb uses Xcode’s provided python, which I’m having issues with when loading tkinter.The issue can be reproduced like this :
> xcrun python3 -c "import tkinter;tkinter._test()"
macOS 12 (1207) or later required, have instead 12 (1206) !
zsh: abort xcrun python3 -c "import tkinter;tkinter._test()"
On MacOS 14 the version numbers are :
macOS 14 (1407) or later required, have instead 14 (1406) !
You can see it fails to load tkinter. From what I understood so far, it looks like the tkinter/tcl/tk version distributed with Xcode is not supported by MacOS ?I checked and the imported tkinter module is definitely the one provided by Xcode’s toolchain :
# Checking where tkinter is installed
> fd "^tkinter$" /Applications/Xcode.app
/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/tkinter/
/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/tkinter/
/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/site-packages/future/moves/tkinter/
# Checking that Xcode python uses the right module - it matches
> xcrun python3 -c "import tkinter;print(tkinter.sys.modules['tkinter'])"
<module 'tkinter' from '/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/tkinter/__init__.py'>
I can get a working tkinter working by installing it using homebrew or macports, but I’m not able to use it with Xcode’s python installation. I tried overwriting sys.path to force Xcode’s python to import homebrew’s tkinter module, but it still loads Xcode’s tkinter .so.
In the crash report I can see it indeed loads tcl/tk 8.5 and loads _tkinter.cpython-39-darwin.so from Xcode. I could disable the SIP (System Integrity Protection) to force to load another version of the library, but that wouldn’t be something I can ask the users.
On the LLDB forum, they advise against using another python interpreter that the one provided by the toolchain. So is there a way to get the provided tkinter/tcl/tk installation to work ? If not I’m confused about why it’s provided in the first place.
Thanks a lot for your time and please tell me if you have any questions.
PS: if possible i'll post the head of the crash report in the comment of this post
ld: symbol(s) not found for architecture arm64
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
Undefined symbol: nominal type descriptor for CoreGraphics.CGFloat
Undefined symbol: type metadata for CoreGraphics.CGFloat
Undefined symbol: protocol conformance descriptor for CoreGraphics.CGFloat : Swift.BinaryFloatingPoint in CoreGraphics
Undefined symbol: protocol conformance descriptor for CoreGraphics.CGFloat : Swift.Encodable in CoreGraphics
Undefined symbol: protocol conformance descriptor for CoreGraphics.CGFloat : Swift.FloatingPoint in CoreGraphics
Undefined symbol: protocol conformance descriptor for CoreGraphics.CGFloat : Swift.Hashable in CoreGraphics
Undefined symbol: protocol conformance descriptor for CoreGraphics.CGFloat : Swift.Comparable in CoreGraphics
Undefined symbol: protocol conformance descriptor for CoreGraphics.CGFloat : Swift.Equatable in CoreGraphics
Undefined symbol: protocol conformance descriptor for CoreGraphics.CGFloat : Swift.Decodable in CoreGraphics
Undefined symbol: protocol conformance descriptor for CoreGraphics.CGFloat : Swift.SignedNumeric in CoreGraphics
Hi i am currently using XCode 15 to build a Swift command line application.
But when I try to build & debug my project, it throws an error saying that it could not launch the executable.
It does build but as the error suggests, the Build dir does not have a executable in it. I have messed around with DerivedData & Build location settings for quite a bit with no luck.
Currently both of them are at default settings as I cleared XCode caches from ~/Library/Caches & created a new project. I tried compiling the basic Hello World but that seems to "build" but with no executable.
I have attached the report for the Could not launch error
Error report
Am i missing something with respect to build location / configuration?
Thanks for any assistance.
I'm trying to use
#if hasFeature(ADDRESS_SANITIZER)
#endif
But it doesn't work.
Is there a way with a precompile directive to check if the Address Sanitizer is active?
when building my project with Xcode16 Beta, I came across several compile errors in c++ code, which used to be ok when building with Xcode15. It's not easy to fix them because some of them came from third part libraries. Is there a way to configure Xcode to build c++ code conforming to the Xcode 15 manner? (I know I can get back to Xcode15 temporarily, but I worry these issue can not be fixed even in the official release version)
I'm trying to add JPEG-XL encoding/decoding capabilities to my app and haven't been able to find a trustworthy pre-compiled version. The only one I've found is in https://github.com/awxkee/jxl-coder-swift.
As a result I've been trying to compile my own iOS version from the reference implementation (https://github.com/libjxl/libjxl), having done virtually no compiling before. When I started out, my gut said, "Compiling for a different platform should be easy since it's not like I'm actually writing or modifying the implementation", but the more I research and try, the more doubtful I've become. So far I've figured out it means compiling all the dependencies (brotli, highway, libpng, skcms, etc.) too, but I've also gotten nowhere with them, having tried my hand at modifying cmake toolchains and CMakeList.txt files.
As a novice, am I biting off more than I can chew with this? Is the seemingly simple task, "Compile this C++ library for iOS" actually something that freelancers charge huge amounts for? (If so, this makes the free compiled version mentioned above even more questionable)
Any help or pointers would be greatly appreciated.
Crowdstrike Falcon vs Xcode performance
Our IT department is using CrowdStrike Falcon, an ML-security tool, on all the Mac hardware. It will flag processes as malicious, and it sounds like it may sandbox such processes that are deemed malicious and / or scan anything the process touches.
TLDR
Does anybody know how to make CrowdStrike Falcon behave nicely with Xcode and its tools and prevent it from consuming high CPU and interfering with the build and debugging processes? Xcode, SwiftUI previews and building should be as performant as possible.
Details
Perplexity describes CrowdStrike Falcon as follows:
CrowdStrike Falcon is a cloud-based endpoint security platform that provides real-time protection against malware, ransomware, and other cyber threats. It uses artificial intelligence and machine learning to detect and prevent known and unknown threats across endpoints (laptops, desktops, servers, etc.), cloud workloads, and cloud environments. The Falcon platform includes next-generation antivirus, endpoint detection and response (EDR), managed threat hunting, vulnerability management, and other security capabilities delivered through a lightweight sensor that streams data to the CrowdStrike cloud for analysis and response.
The problem is that apparently Falcon's ML signatures will flag Xcode as malicious. So when building in Xcode, Falcon will use a huge amount of CPU (I have seen it go up to 456%), affecting build performance. I am getting the impression it is sandboxing and / or scanning every single file Xcode touches. The same goes for the iOS Simulator which will also cause Falcon to consume lots of CPU. It's clear this is affecting our build performance a lot.
Falcon supports a number of exclusions:
Machine learning (ML) exclusion: For trusted file paths, stop all ML-based detections and preventions, or stop files from being uploaded to the CrowdStrike cloud.
Indicator of attack (IOA) exclusion: Stop all behavioral detections and preventions for an IOA that’s based on a CrowdStrike-generated detection.
Sensor visibility exclusion: For trusted file paths that you want to exclude from sensor monitoring, minimize sensor event collection, and stop all associated detections and preventions. Use sensor visibility exclusions with extreme caution. Potential attacks and malware associated with excluded files will not be recorded, detected, or prevented.
Using Sensor Visibility Exclusions it is possible to exclude applications on file pattern basis and preventing Falcon's ML signatures for flagging any such process as malicious. Which means that it is possible to exclude /Applications/Xcode.app/** and prevent it, or the processes it spawns, as malicious.
However, Xcode and the toolchain are much more complicated than just excluding a single binary. Switching toolchains via sudo xcode-select -s will also update a lot of files in /usr (see Xcode.app/Contents/Developer/usr) such as /usr/bin/swift*, /usr/bin/ibtool*, /usr/bin/lldb and /usr/bin/xcrun (there are many more).
For testing Xcode performance we excluded /Applications/Xcode.app/** and /usr/bin from Falcon, but just launching the simulator and a simulator build of the app will still cause Falcon to go up to about 300%. I assume this will affect SwiftUI live previews as well. Probably /Users/*/Library/Developer/** should be excluded as well then?
Obviously, Falcon's AI/ML should just identify all of this as legitimate software development tools and no exclusions should be necessary...
IMHO a file-pattern based exclusion seems to contradict what this tool is supposed to do. I would think it should evaluate signing (codesign / spctl) or validate checksums, rather than file pattern based exclusions. But as long as Xcode becomes more performant I am not complaining. The less an IT tool is flagging legitimate software as malicious and interfering with our daily work, the better.
So my question is if anybody knows how to make CrowdStrike Falcon behave nicely with Xcode and its tools and prevent it from consuming high CPU and interfering with the build and debugging processes? Xcode, SwiftUI previews and building should be as performant as possible.
Hi all,
I'm attempting to generate an XCFramework that must maintain ABI stability. The framework is created from an SPM using the attached script generate-FK.sh.
I does not work. Removing the flag BUILD_LIBRARY_FOR_DISTRIBUTION=YES and adding the flag -allow-internal-distribution to xcodebuild -create-xcframework everything is fine. Despite this resolves the problem, it results in the generated module not being ABI stable. However, when attempting the script approach, it generates the XCFramework but when used it raises an error in arm64-apple-ios-private.swiftinterface with no such file or module as soon as it encounters an import statement for ModuleX reading it.
The package structure is attached as Package.swift and te obtained result XCFramework structure is as follows:
MyLibrary.xcframework
├── Info.plist
├── ios-arm64
│ └── MyLibrary.framework
│ ├── Headers
│ │ ├── ModuleH-Swift.h
│ │ ├── ModuleH.modulemap
│ │ ├── ModuleC-Swift.h
│ │ ├── ModuleC.modulemap
│ │ ├── ModuleA-Swift.h
│ │ ├── ModuleA.modulemap
│ │ ├── MyLibrary-Swift.h
│ │ └── MyLibrary.modulemap
│ ├── Info.plist
│ ├── Modules
│ │ └── MyLibrary.swiftmodule
│ │ ├── arm64-apple-ios.abi.json
│ │ ├── arm64-apple-ios.swiftdoc
│ │ └── arm64-apple-ios.swiftmodule
│ └── MyLibrary
└── ios-arm64_x86_64-simulator
└── MyLibrary.framework
├── Headers
│ ├── ModuleH-Swift.h
│ ├── ModuleH.modulemap
│ ├── ModuleC-Swift.h
│ ├── ModuleC.modulemap
│ ├── ModuleA-Swift.h
│ ├── ModuleA.modulemap
│ ├── MyLibrary-Swift.h
│ └── MyLibrary.modulemap
├── Info.plist
├── Modules
│ └── MyLibrary.swiftmodule
│ ├── arm64-apple-ios-simulator.abi.json
│ ├── arm64-apple-ios-simulator.swiftdoc
│ ├── arm64-apple-ios-simulator.swiftmodule
│ ├── x86_64-apple-ios-simulator.abi.json
│ ├── x86_64-apple-ios-simulator.swiftdoc
│ └── x86_64-apple-ios-simulator.swiftmodule
├── MyLibrary
└── _CodeSignature
└── CodeResources
It's worth mentioning that the library must be compatible with both Objective-C and Swift, and Modules A, C, and H are imported into the MyLibrary module as @_exported modules, that is why I've included the headers and module maps.
What is wrong?
Thank you in advance for your assistance.
Files:
generate-FK.sh
Package.swift
Hi all,
I'm attempting to generate an XCFramework that must maintain ABI stability. The framework is created from an SPM using the attached script generate-FK.sh.
I does not work. Removing the flag BUILD_LIBRARY_FOR_DISTRIBUTION=YES and adding the flag -allow-internal-distribution to xcodebuild -create-xcframework everything is fine. Despite this resolves the problem, it results in the generated module not being ABI stable. However, when attempting the script approach, it generates the XCFramework but when used it raises an error in arm64-apple-ios-private.swiftinterface with no such file or module as soon as it encounters an import statement for ModuleX reading it.
The package structure is attached as Package.swift and te obtained result XCFramework structure is as follows:
MyLibrary.xcframework
├── Info.plist
├── ios-arm64
│ └── MyLibrary.framework
│ ├── Headers
│ │ ├── ModuleH-Swift.h
│ │ ├── ModuleH.modulemap
│ │ ├── ModuleC-Swift.h
│ │ ├── ModuleC.modulemap
│ │ ├── ModuleA-Swift.h
│ │ ├── ModuleA.modulemap
│ │ ├── MyLibrary-Swift.h
│ │ └── MyLibrary.modulemap
│ ├── Info.plist
│ ├── Modules
│ │ └── MyLibrary.swiftmodule
│ │ ├── arm64-apple-ios.abi.json
│ │ ├── arm64-apple-ios.swiftdoc
│ │ └── arm64-apple-ios.swiftmodule
│ └── MyLibrary
└── ios-arm64_x86_64-simulator
└── MyLibrary.framework
├── Headers
│ ├── ModuleH-Swift.h
│ ├── ModuleH.modulemap
│ ├── ModuleC-Swift.h
│ ├── ModuleC.modulemap
│ ├── ModuleA-Swift.h
│ ├── ModuleA.modulemap
│ ├── MyLibrary-Swift.h
│ └── MyLibrary.modulemap
├── Info.plist
├── Modules
│ └── MyLibrary.swiftmodule
│ ├── arm64-apple-ios-simulator.abi.json
│ ├── arm64-apple-ios-simulator.swiftdoc
│ ├── arm64-apple-ios-simulator.swiftmodule
│ ├── x86_64-apple-ios-simulator.abi.json
│ ├── x86_64-apple-ios-simulator.swiftdoc
│ └── x86_64-apple-ios-simulator.swiftmodule
├── MyLibrary
└── _CodeSignature
└── CodeResources
It's worth mentioning that the library must be compatible with both Objective-C and Swift, and Modules A, C, and H are imported into the MyLibrary module as @_exported modules, that is why I've included the headers and module maps.
What is wrong?
Thank you in advance for your assistance.
help me with this issue ,it happens when running c in vs code I have everything installed code runner ,c extensions mingw 64 ;help me out
I have a general question that confusing me.
I am on M1 and I can build my app on Xcode (or create an archive) for device. Looking in to derived data I can see Debug-iphones (and simulators) folders, I can get the .app and drag/drop it to the simulator. When trying to run the app the app will crash with error:
EXEC 14 Binary with wrong platform
I understand that it wasn't build for simulators but rather it was build for devices and there fore the crash, but when thinking about it I dont understand why? (at least theoretically it shouldn't crash as it was build for arm64 ). Inspected the binary with lipo it was build for arm64. Comparing the binaries for simulator and device (with otool) I dont see a lot of difference except the rpath.
So how does IOS knows it was build for device and not simulator (wrong platform)?
is there a way to add some sort of relaxation (in the end both binaries were build for arm64).
Dear Experts,
I've just received the exciting new email from App Store Connect telling me that I'm using a "required reason" API call and need to declare it in my privacy manifest. Of course this is easy to fix, I'll just add the code to my privacy manifest - but I thought I'd at least go through the motions of trying to work out what function I am calling and from where.
First issue is that the email just tells me that the app "references one or more APIs that require reasons ... including NSPrivacyAcceeedAPICategoryFileTimestamp". Dear Apple, why on earth can't you actually tell me the specific function that I am calling? (FB13689896).
So let's see if I can work out what has been detected. I look at the app binary:
% objdump --syms App.app
I think that is probably more or less what App Review must get from their scan, right? So I can see _stat in there but it doesn't know the corresponding source file.
So I go to the build directory with the object files and extract symbols from them all individually, using objdump --syms. Provided that I've not enabled link-time optimisation that works and I can find ... zero calls to stat(). Which tells me that my C++ std::filesystem calls have not been detected! Interesting. So if you want to bypass this amazing new privacy technology, I guess that's the way to go.
Anyway if there's a call to stat() in the binary but not in the object files, it must be coming from one of my .a files. That's a bit more difficult to track down as (1) my .a files are not in a convenient single directory, and (2) they may have calls to stat() in archive members that aren't needed and aren't included in this binary.
So the question: is there some convenient way to take the binary and identify which object files or static library archive members resulted in which of its UND symbols?
After upgrading to Xcode 15.3 (15E204a) trivial C++ code of mine no longer compiles:
const string text = textComponent->GetText();
auto isEmpty = text.empty() || std::all_of(text.begin(), text.end(), std::isspace);
now yields compiler error "No matching function for call to 'all_of'" while working as expected on Version 15.2 (15C500b) and older.
Is there a regression in the latest Xcode update C++ support..?
Thanks,
Jay
I have a library written in C. In the header file it contains #include <inttypes.h>. Library is imported from C++ code as
extern "C" {
#include <lib.h>
}
After update to Xcode 15.3 i can't use it because it complains on:
Import of C++ module 'std_inttypes_h' appears within extern "C" language linkage specification
As I understand inttypes.h is a header from both worlds C and C++ and it could be used in .c code or inside of headers for that code.
What would you suggest? I don't want to change library from one side nor disable module validation. It's a valid case and it should compile without an error.
I was trying to run some c++ code on clang (I have command line tools installed)
but it just showed this error:
Undefined symbols for architecture arm64:
then it showed bunch of random gibberish
here is my code:
#include <iostream>
#include <vector>
using namespace std;
typedef std::string type_t;
int main(){
type_t name = "Yashar";
cout << "Hello " << name << '\n';
return 0;
}
My app encountered this error, but I did not use any decompilation project, monkey, etc., and this error occurs occasionally.Has anyone ever encountered a similar error?
LLVM Profile Error: Failed to write file "default.profraw": Operation not permitted
I'm encountering an **error Segmentation fault: 11 ** during the archiving process. If the issue is happing with the my code. Then how can I diagnosing the problem. or figure out pin point in code base?
I changed the compiler optimization level. It works for me when I use the Osize compiler optimization level. Previously, it was set to Ospeed.
Want to know about the impact of the Osize compiler optimization level on the app.