The 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

36 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

change the way build c++ code
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)
1
1
76
2d
Compiling the JPEG-XL reference for iOS, or, "Is compiling C++ for iOS really this difficult!?"
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.
5
0
190
1w
Crowdstrike Falcon vs Xcode build performance
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.
0
2
280
2w
Invalid XCFramweork when generated with BUILD_LIBRARY_FOR_DISTRIBUTION=YES
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
0
0
317
Apr ’24
Invalid XCFramweork when generated with BUILD_LIBRARY_FOR_DISTRIBUTION=YES
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.
0
0
303
Apr ’24
Install .app file on simulator m1
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).
2
0
583
Mar ’24
Identifying "required reason" API call locations from app binary
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?
12
2
2.8k
Apr ’24
Random C++ compiler errors in Xcode 15.3 (15E204a)
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
4
0
628
Mar ’24
#include <inttypes.h> from C library.
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.
2
0
575
Mar ’24
C++ code not working
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; }
2
0
376
Mar ’24
LLVM Profile Error
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
0
0
333
Mar ’24
Segmented Fault 11: error (Xcode 15)
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.
3
1
661
Feb ’24
Can you still define a struct in Assembly?
Using Xcode 15.2, x86_64, and for the life of me, I can't figure out how to declare a data structure in assembly. All the "current"ish references I've read for Clang LLVM & "as" assembly have no references to data structure directives. Tons of different types of sections, but I haven't seen any that would apply. I've looked at .bss, and while I can defines different fields in it, it still reserves space in the program, and I don't need space reserved - I just need a data structure definition so I'm not using magic numbers. Perhaps there is a utility to convert a C struct to an assembly struct that I haven't seen? Surely there has to be a way to define a data structure in assembly.
2
0
544
Jan ’24
`setlocale` sets `errno` to `0`
The setlocale C/C++ function writes the global variable errno to 0. In Linux it doesn't have this behavior and the documentation doesn't says anything about setting errno (as I understand, no function should set errno to 0 The following code allows to reproduce it #include <iostream> #include <fstream> using namespace std; int main() { ifstream myStream; myStream.open("NONEXISTENT.txt", ios::in); cout << errno << endl; setlocale(LC_ALL, "en_US.UTF-8"); cout << errno << endl; } // Output: // 2 // 0 I don't think is a compiler issue as the error also happens with gcc but rather a libc issue.
3
0
542
Jan ’24
Xcode 15: MacOSX SDK headers disappear during heavy build
I am facing very strange issue on the last version of Xcode. At some point during heavy build (like building QtWebEngine from the sources) some headers from MacOSX SDK may disappear for the compiler, what leads to the errors. The issue happens build to build. I haven't found any other issue even close to be similar anywhere. The errors during the build looks like this: ../../../../../../../../../../../Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -MMD -MF obj/pdf/internal/pdfium_permissions.o.d -DOFFICIAL_BUILD -DTOOLKIT_QT -D_LIBCPP_HAS_NO_ALIGNED_ALLOCATION -DCR_XCODE_VERSION=1510 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES=0 -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0 -DWEBP_EXTERN=extern -DUSE_EGL -DU_USING_ICU_NAMESPACE=0 -DU_ENABLE_DYLOAD=0 -DUSE_CHROMIUM_ICU=1 -DU_ENABLE_TRACING=1 -DU_ENABLE_RESOURCE_TRACING=0 -DU_STATIC_IMPLEMENTATION -DICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_FILE -DUCHAR_TYPE=uint16_t -DV8_COMPRESS_POINTERS -DV8_31BIT_SMIS_ON_64BIT_ARCH -DV8_DEPRECATION_WARNINGS -DV8_REVERSE_JSARGS -DGOOGLE_PROTOBUF_NO_RTTI -DGOOGLE_PROTOBUF_NO_STATIC_INITIALIZER -DHAVE_PTHREAD -DSK_CODEC_DECODES_PNG -DSK_CODEC_DECODES_WEBP -DSK_ENCODE_PNG -DSK_ENCODE_WEBP -DSK_USER_CONFIG_HEADER=\"../../skia/config/SkUserConfig.h\" -DSK_GL -DSK_CODEC_DECODES_JPEG -DSK_ENCODE_JPEG -DSK_USE_LIBGIFCODEC -DSK_SUPPORT_GPU=1 -DSK_GPU_WORKAROUNDS_HEADER=\"gpu/config/gpu_driver_bug_workaround_autogen.h\" -DSK_BUILD_FOR_MAC -DSK_METAL -DPDF_ENABLE_V8 -DPDFIUM_PRINT_TEXT_WITH_GDI -DFT_CONFIG_MODULES_H=\"freetype-custom/freetype/config/ftmodule.h\" -DFT_CONFIG_OPTIONS_H=\"freetype-custom/freetype/config/ftoption.h\" -DPDFIUM_REQUIRED_MODULES -DCHROMIUM_RESTRICT_VISIBILITY -Igen -I../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium -I../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/third_party/pdfium -I../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/third_party/perfetto/include -Igen/third_party/perfetto/build_config -Igen/third_party/perfetto -I../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/third_party/libwebp/src -I../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/third_party/libyuv/include -I../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/third_party/jsoncpp/source/include -I../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/third_party/khronos -I../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/gpu -Igen/third_party/dawn/src/include -I../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/third_party/dawn/src/include -I../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/third_party/abseil-cpp -I../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/third_party/boringssl/src/include -I../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/third_party/protobuf/src -Igen/protoc_out -I../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/third_party/ced/src -I../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/third_party/icu/source/common -I../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/third_party/icu/source/i18n -I../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/v8/include -Igen/v8/include -I../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/third_party/protobuf/src -I../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/third_party/skia -I../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/third_party/libgifcodec -I../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/third_party/freetype/include -I../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/third_party/freetype/include/freetype-custom -I../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/third_party/freetype/src/include -I../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/third_party/harfbuzz-ng/src/src -fno-strict-aliasing -fstack-protector -Wno-unknown-attributes -Wno-unknown-pragmas -Wno-unknown-warning-option -fcolor-diagnostics -fmerge-all-constants -arch x86_64 -Wall -Wextra -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -Wimplicit-fallthrough -Wunreachable-code -Wthread-safety -Wextra-semi -Wunguarded-availability -Wno-missing-field-initializers -Wno-unused-parameter -Wno-c++11-narrowing -Wno-unneeded-internal-declaration -Wno-undefined-var-template -Wno-psabi -Wno-ignored-pragma-optimize -Wno-implicit-int-float-conversion -Wno-final-dtor-non-final-class -Wno-builtin-assume-aligned-alignment -Wno-deprecated-copy -Wno-non-c-typedef-for-linkage -Wno-max-tokens -O2 -fno-omit-frame-pointer -g0 -isysroot ../../../../../../../../../../../Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk -mmacosx-version-min=10.13 -fvisibility=hidden -Wheader-hygiene -Wstring-conversion -Wtautological-overlap-compare -Wshadow -Wno-shorten-64-to-32 -Wno-parentheses-equality -Wno-tautological-compare -Wno-thread-safety-attributes -Wno-undefined-bool-conversion -Wno-tautological-undefined-compare -std=c++14 -fno-trigraphs -Wno-trigraphs -stdlib=libc++ -fno-exceptions -fno-rtti -fvisibility-inlines-hidden -Wno-deprecated-declarations -c ../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/pdf/pdfium/pdfium_permissions.cc -o obj/pdf/internal/pdfium_permissions.o In file included from ../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/pdf/pdfium/pdfium_permissions.cc:5: In file included from ../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/pdf/pdfium/pdfium_permissions.h:8: In file included from ../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/pdf/pdf_engine.h:10: ../../../../../../../../../../../Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/memory:899:10: fatal error: '__memory/temporary_buffer.h' file not found Failed single commands in proper environment never fails. Errors occur only during really big build. I've opened a bug (https://bugreports.qt.io/browse/QTBUG-119115) in Qt bug tracker. But it seems to be more like a clang bug, because this can happen during any heavy build on 2 different machines (x64 and arm64). There was a suggestion about reaching the limit of opened files. This shouldn't be the case, as clang opens only small amount of them (up to 20 I guess), but I can be wrong.
0
0
653
Dec ’23
Building iOS/Mac Projects With Open Source LLVM
I'd like to use the Clang AST tools for iOS/Mac projects. I want to write C++ programs that link to the Clang libraries. I will use that to analyze the AST from my IOS/Mac projects. I understand you can generate an AST dump from Apple's Clang but I instead want the full capabilities of the Clang libraries, not just the AST output. I believe I need to build compilation databases in order for many Clang libraries to be used. For instance, l'd like to use the CommonOptionsParser which requires arguments for the compilation database. Building these compilation databases is where I'm running to challenges. Its my understanding I will need to use the same LLVM version I'm using for the tooling (open source 17.x) to also build my compilation database. I already tried to use Apple's build-in LLVM to build the database but that led to build arguments such as -index-store-path being included in the JSON, which I don't think Open source LLVM can understand (failing to build). I instead attempted to use the Open Source LLVM installation with my iOS/Mac project. I got it kind of working but am not quite there. My question is whether this approach is worth pursuing? I'm dealing a lot of build errors doing this, particularly in nested swift packages that build fine with Apple Clang. Before I try to fix all these errors, I just wanted to ask whether using Open Source LLVM to build compilation databases for iOS/Mac projects is the right high-level approach for my goals mentioned initially? Is anyone doing this for complicated projects? Another option I thought of is maybe I can "clean up" the compilation database that is generated from Apple's Clang to remove the -index-store-path arguments. Then I could use that as an input to Open Source Clang.
2
0
825
Jan ’24
Beginner Problem: Static Linking
Hi, I just started practicing Static Linking, and I tried to link a third party library into my code, but it kept bugging error: "The header file not found", so I believe there're some steps missing from my code, wish someone can help! Here is the situation: I use OpenGL as the target library, it contains two directories: "Include" directory which holds header files and "lib-arm64"directory which holds "libglfw3.a" and "libglfw.3.dylib". I believe .dylib is related to dynamic linking, so I am not gonna touch that and .a file is the source code I need. Therefore: In Build Phase -&gt; Linking Binary with Library, I attach "libglfw3.a". In Build Setting -&gt; Search Path, I include the address of header directory "Include" in "Header Search Path" and "lib-arm64" in "Library Search Path". "#include &lt;GLFW/glfw3.h&gt;" is the command I copied from OpenGL website template and used in my code. The error is: " 'GLFW/glfw3.h' file not found " If anyone has any advice, feel free to share it, I really appreciate! Another question I have, non-relevant to linking, but to debugging.
3
0
861
Dec ’23
Problem with variadic C functions
I am the author of the open-source Dynace. This is an OO extension to C. It has been in production use for around 20 years. It has been used on DOS, all Windows, Linux, macOS/Intel, VMS, PLAN9, COSMIC, SUNOS, etc. all without a problem. However it does not run on Apple M1, M2 machines. I traced the problem to variadic function calls. I am creating a va_list in a ... function. I then pass the va_list to a second function. I wrote something to copy the the va_list (via va_copy) to see what I am getting. The first function works okay. But the second function does not. (I know you can't re-use a va_list.) I have spend a couple of days on this and can't find a problem with my code. I tried creating a simple example but it worked. Apparently the problem is situational. Anyway, I have no idea what is wrong or what to do next. I'd sure appreciate any help! Thanks!
2
0
577
Nov ’23
Bug Using Ninja when Generate the Xcode project.
I used the command: utils/build-script --swift-darwin-supported-archs "$(uname -m)" --xcode --clean and encountered the following error: CMake Error at cmake/modules/SwiftUtils.cmake:24 (message): Error! Variable THIN_INPUT_TARGETS is false, empty or not set. Call Stack (most recent call first): stdlib/cmake/modules/AddSwiftStdlib.cmake:3068 (precondition) stdlib/public/libexec/swift-backtrace/CMakeLists.txt:39 (add_swift_target_executable) Please let me know the solution to this error. Thank you. Have a great day as well. 👍
1
0
575
Nov ’23