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

38 Posts
Sort by:
Post not yet marked as solved
1 Replies
526 Views
Does this exist? Apple seems to have a unique syntax it recognizes (vs GCC arm64 assembler) and getting assembly code cross compiled it for iOS in Xcode has been very frustrating and unfruitful. Is there any guidance on how to do this? The reason for assembly is to support "volk, vector optimized library".
Posted
by W1EBR.
Last updated
.
Post not yet marked as solved
2 Replies
480 Views
Hallo, I am co-author of an open source timetabling software. This software is running many years now on Windows, Linux and MacOS without crashing. So I compiled it with a lot of different compilers and it is always running fine. (with Windows mingw compiler, linux gcc compiler, ...) Now I compiled it on my new Mac and noticed and it is running fine as long as i am compiling it with -o1 or -o2 or -o3 or -ofast or -os or -oz. But as soon as I compile it with -o0, then it crashes with MacOS. It doesn't crash if I compile with -o0 under Linux gcc compiler. I tried to do a minimum example, but as soon as I remove some - in that situation unneeded - code, it is running fine again. So it looks like a memory limit in the compiler or something like that. I don't get it. Any ideas how I can locate and/or fix the bug? You can find the source here: https://lalescu.ro/liviu/fet/forum/index.php?topic=5729.0 I compiled with the latest clang version shipped with latest MacOS Sonoma. I am also attaching the crash report log. Thank you for your help. appleLog.txt.log
Posted
by Volker_D.
Last updated
.
Post not yet marked as solved
0 Replies
580 Views
I just started getting lots of "redefinition of" errors with headers that start with #pragma once. The C++ clang compiler is set to "C++17". Did something change with handling #pragma?
Posted
by W1EBR.
Last updated
.
Post marked as solved
4 Replies
1.5k Views
ld_prime of Xcode 15 produces duplicate symbols when linking a static library containing Objective-C++ object in case using the flags -ObjC and -Wl,force_load. // foo.h #pragma once int Inc(int i); // foo.mm #include "foo.h" #include <Foundation/Foundation.h> @interface Foo : NSObject @end @implementation Foo @end int Inc(int i) { return i + 1; }; // main.cpp #include "foo.h" int main(int argc, const char * argv[]) { return Inc(0); } ❯ clang++ -c foo.mm ❯ ar rcs libfoo.a foo.o ❯ clang++ -framework Foundation libfoo.a -x c++ main.cpp -Wl,-force_load,libfoo.a -ObjC duplicate symbol '__Z3Inci' in: libfoo.a[2](foo.o) libfoo.a[2](foo.o) duplicate symbol '_OBJC_CLASS_$_Foo' in: libfoo.a[2](foo.o) libfoo.a[2](foo.o) duplicate symbol '_OBJC_METACLASS_$_Foo' in: libfoo.a[2](foo.o) libfoo.a[2](foo.o) ld: 3 duplicate symbols clang: error: linker command failed with exit code 1 (use -v to see invocation)```
Posted Last updated
.
Post not yet marked as solved
17 Replies
23k Views
I've got an iOS framework that I've had around for ages. It's a mixture of Objective-C and Swift. Since installing Xcode 12, I'm now getting a bunch of warnings of the type: 'Double-quoted include in framework header, expected angle-bracketed instead' If I go to the various source files and say change: #import "Place.h" to #import &lt;VegasKit/Place.h&gt; then I get an error saying it can't find the file. If I try this: #import &lt;Place.h&gt; then I get an error telling me to go back to double-quotes, i.e. undo the change. Any idea what I can do to get this all setup correctly? Thanks.
Posted
by Hunter.
Last updated
.
Post not yet marked as solved
5 Replies
796 Views
On Ventura 13.5.2 (22G91), Macbook pro 13 2019 (Intel): The following combination of the C code and Assembly code fails to link conftest_c.c: //conftest_c.c: #ifdef __cplusplus extern "C" { #endif void gsym_test_func(void); #ifdef __cplusplus } #endif int main() { gsym_test_func(); return 0; } Obj compiled using the command clang -O3 -DNDEBUG -finline-functions -fno-strict-aliasing -mcx16 -I. conftest_c.c -c produces conftest_c.o That exposes the following symbols: SYMBOL TABLE: 0000000000000000 g F __TEXT,__text _main 0000000000000000 *UND* _gsym_test_func Now we create assembly conftest.s that define _gsym_test_func: .text # _gsym_test_func .globl _gsym_test_func _gsym_test_func: # _gsym_test_func with the objdumb symbols: SYMBOL TABLE: 0000000000000000 g F __TEXT,__text _gsym_test_func Trying to link the two object files into a binary using the following command clang -O3 -DNDEBUG -v -finline-functions -fno-strict-aliasing -mcx16 conftest_c.o conftest.o -o conftest -lz results in the following error: Apple clang version 15.0.0 (clang-1500.0.40.1) Target: x86_64-apple-darwin22.6.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin "/Library/Developer/CommandLineTools/usr/bin/ld" -demangle -lto_library /Library/Developer/CommandLineTools/usr/lib/libLTO.dylib -dynamic -arch x86_64 -platform_version macos 13.0.0 14.0 -syslibroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -O3 -o conftest -L/usr/local/lib conftest_c.o conftest.o -lz -lSystem /Library/Developer/CommandLineTools/usr/lib/clang/15.0.0/lib/darwin/libclang_rt.osx.a ld: Undefined symbols: _gsym_test_func, referenced from: _main in conftest_c.o clang: error: linker command failed with exit code 1 (use -v to see invocation) I do not understand why the linker cannot find the symbol _gsym_test_func defined in conftest.o
Posted Last updated
.
Post not yet marked as solved
1 Replies
1.5k Views
Hi All, I am using Xcode 15. I am trying to change the compiler in XCode to use the version of clang++ installed at /opt/homebrew/Cellar/llvm@14/14.0.6/bin/clang-14 However, when I set the compiler under Build Options > Compiler for C/C++/... It gives me an Unsupported Compiler Warning, and from the build messages, it looks like it is defaulting back to Apple's version of Clang. Is there something I am missing here? Are there additional steps required to get this to work? Thank you kindly in advance.
Posted
by ardier.
Last updated
.
Post not yet marked as solved
1 Replies
595 Views
Please tell me where I can find the documents for Apple Clang ARM assembler? After I compiled my C source code to ARM assembly code using Apple Clang, it of course generated a lot of ARM assembly code (GNU syntax), but for some of them I can't find related documents, for example the .build_version directive. The generated ARM assembly code is here: .section __TEXT,__text,regular,pure_instructions .build_version macos, 13, 0 sdk_version 13, 3 .globl _main ; -- Begin function main .p2align 2 _main: ; @main .cfi_startproc ; %bb.0: sub sp, sp, #64 str w8, [sp, #16] ; 4-byte Folded Spill stur wzr, [x29, #-4] ; implicit-def: $x8 ... add sp, sp, #64 ret .cfi_endproc ; -- End function .section __TEXT,__cstring,cstring_literals l_.str: ; @.str .asciz "a + b = %d\r\n" .subsections_via_symbols
Posted Last updated
.
Post not yet marked as solved
3 Replies
2.2k Views
Lately we have added swift code to our SDK. (especially swiftUI library). The SDK deployment target is ios9. While importing the SDK to the hosting app with the same deployment target and building via Xcode (13.4) everything works fine. When we try to build it via xcodebuild (xcodebuild -workspace UIKitCatalog.xcworkspace -scheme UIKitCatalog -sdk "iphonesimulator") the build is done successfully but the the app is crashing on app lunch (sim and device) . Increasing the deployment target of the hosting app to iOS 13 fixes the issue (unfortunately we cant force our customers to do the same) CrashReporter Key: 74B25560-EFCE-769F-F0B4-E4DD4C6B09A4 Hardware Model: MacBookPro15,1 Process: UIKitCatalog [63980] Path: /Users/USER/Library/Developer/CoreSimulator/Devices/F044CBD3-80D6-49FB-BAC9-FA48FA3CFF7E/data/Containers/Bundle/Application/72290230-2DB3-4F75-8327-75B6E4E9947C/UIKitCatalog.app/UIKitCatalog Identifier: ba.UIKitCatalog Version: 2.0.0.23386 (23386) Code Type: X86-64 (Native) Role: Foreground Parent Process: launchd_sim [56632] Coalition: com.apple.CoreSimulator.SimDevice.F044CBD3-80D6-49FB-BAC9-FA48FA3CFF7E [10638] Responsible Process: SimulatorTrampoline [2048] Date/Time: 2022-08-29 11:59:21.3026 +0300 Launch Time: 2022-08-29 11:59:19.9381 +0300 OS Version: macOS 12.5.1 (21G83) Release Type: User Report Version: 104 Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x0000000000000000, 0x0000000000000000 Exception Note: EXC_CORPSE_NOTIFY Triggered by Thread: 0 Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 libsystem_kernel.dylib 0x7fff7017300e __pthread_kill + 10 1 libsystem_pthread.dylib 0x7fff701cb1ff pthread_kill + 263 2 libsystem_c.dylib 0x7fff2010b6b7 abort + 130 3 libswiftCore.dylib 0x10e7c0af5 swift::fatalError(unsigned int, char const*, ...) + 149 4 libswiftCore.dylib 0x10e7b86ec checkVersion() + 44 5 dyld_sim 0x10d0689f7 invocation function for block in dyld4::Loader::findAndRunAllInitializers(dyld4::RuntimeState&) const + 182 6 dyld_sim 0x10d0850f5 invocation function for block in dyld3::MachOAnalyzer::forEachInitializer(Diagnostics&, dyld3::MachOAnalyzer::VMAddrConverter const&, void (unsigned int) block_pointer, void const*) const + 129 7 dyld_sim 0x10d07e58c invocation function for block in dyld3::MachOFile::forEachSection(void (dyld3::MachOFile::SectionInfo const&, bool, bool&) block_pointer) const + 555 8 dyld_sim 0x10d07d6e9 dyld3::MachOFile::forEachLoadCommand(Diagnostics&, void (load_command const*, bool&) block_pointer) const + 129 9 dyld_sim 0x10d07e31f dyld3::MachOFile::forEachSection(void (dyld3::MachOFile::SectionInfo const&, bool, bool&) block_pointer) const + 179 10 dyld_sim 0x10d084b56 dyld3::MachOAnalyzer::forEachInitializerPointerSection(Diagnostics&, void (unsigned int, unsigned int, unsigned char const*, bool&) block_pointer) const + 118 11 dyld_sim 0x10d084d98 dyld3::MachOAnalyzer::forEachInitializer(Diagnostics&, dyld3::MachOAnalyzer::VMAddrConverter const&, void (unsigned int) block_pointer, void const*) const + 386 12 dyld_sim 0x10d06892a dyld4::Loader::findAndRunAllInitializers(dyld4::RuntimeState&) const + 144 13 dyld_sim 0x10d068ac2 dyld4::Loader::runInitializersBottomUp(dyld4::RuntimeState&, dyld3::Array<dyld4::Loader const*>&) const + 190 14 dyld_sim 0x10d068aa5 dyld4::Loader::runInitializersBottomUp(dyld4::RuntimeState&, dyld3::Array<dyld4::Loader const*>&) const + 161 15 dyld_sim 0x10d068aa5 dyld4::Loader::runInitializersBottomUp(dyld4::RuntimeState&, dyld3::Array<dyld4::Loader const*>&) const + 161 16 dyld_sim 0x10d068b60 dyld4::Loader::runInitializersBottomUpPlusUpwardLinks(dyld4::RuntimeState&) const + 102 17 dyld_sim 0x10d077b5a dyld4::APIs::runAllInitializersForMain() + 222 18 dyld_sim 0x10d05b9fe dyld4::prepare(dyld4::APIs&, dyld3::MachOAnalyzer const*) + 2528 19 dyld_sim 0x10d05be42 _dyld_sim_prepare + 379 20 dyld 0x110e6eb78 dyld4::prepareSim(dyld4::RuntimeState&, char const*) + 1265 21 dyld 0x110e6d70e dyld4::prepare(dyld4::APIs&, dyld3::MachOAnalyzer const*) + 244 22 dyld 0x110e6d4e4 start + 388 How can we overcome this issue? What Xcode is doing under the hood that xcodebuild doesnt do? Is it possible to release an SDK which import swiftUI but will have deployment target lower than 13. (I have wrapped all the the swift code with @available() and #if canImport(SwiftUI) - less relevant as its compile time )
Posted Last updated
.
Post not yet marked as solved
4 Replies
1.9k Views
I use clang 12 to build some cpp project that needs semaphore.acquire() function. System version: MacOs Big Sur 12.0 However, Compiler shows that some function is unavailable. Detail messages: /concurrencpp/source/executors/worker_thread_executor.cpp:42:21: error: 'acquire' is unavailable [build] m_semaphore.acquire(); [build] ^ [build] /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/semaphore:202:10: note: 'acquire' has been explicitly marked unavailable here [build] void acquire() [build] ^ [build] /Users/mirocos/master/study/concurrencpp/source/executors/worker_thread_executor.cpp:106:21: error: 'release' is unavailable [build] m_semaphore.release(); [build] ^ [build] /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/semaphore:197:10: note: 'release' has been explicitly marked unavailable here [build] void release(ptrdiff_t __update = 1) [build] ^ [build] /Users/mirocos/master/study/concurrencpp/source/executors/worker_thread_executor.cpp:121:21: error: 'release' is unavailable [build] m_semaphore.release(); [build] ^ [build] /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/semaphore:197:10: note: 'release' has been explicitly marked unavailable here [build] void release(ptrdiff_t __update = 1) [build] ^ [build] /Users/mirocos/master/study/concurrencpp/source/executors/worker_thread_executor.cpp:160:17: error: 'release' is unavailable [build] m_semaphore.release(); [build] ^ [build] /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/semaphore:197:10: note: 'release' has been explicitly marked unavailable here [build] void release(ptrdiff_t __update = 1) [build] ^ [build] /Users/mirocos/master/study/concurrencpp/source/executors/thread_pool_executor.cpp:218:26: error: 'try_acquire_until' is unavailable [build] if (!m_semaphore.try_acquire_until(deadline)) { [build] ^ [build] /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/semaphore:219:10: note: 'try_acquire_until' has been explicitly marked unavailable here [build] bool try_acquire_until(chrono::time_point<Clock, Duration> const& __abs_time) [build] ^ [build] /Users/mirocos/master/study/concurrencpp/source/executors/thread_pool_executor.cpp:218:26: error: 'try_acquire_until<std::__1::chrono::steady_clock, std::__1::chrono::duration<long long, std::__1::ratio<1, 1000000000>>>' is unavailable [build] if (!m_semaphore.try_acquire_until(deadline)) { [build] ^ [build] /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/semaphore:219:10: note: 'try_acquire_until<std::__1::chrono::steady_clock, std::__1::chrono::duration<long long, std::__1::ratio<1, 1000000000>>>' has been explicitly marked unavailable here [build] bool try_acquire_until(chrono::time_point<Clock, Duration> const& __abs_time) [build] ^ [build] /Users/mirocos/master/study/concurrencpp/source/executors/thread_pool_executor.cpp:322:25: error: 'release' is unavailable [build] m_semaphore.release(); [build] ^ [build] /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/semaphore:197:10: note: 'release' has been explicitly marked unavailable here [build] void release(ptrdiff_t __update = 1) [build] ^ [build] /Users/mirocos/master/study/concurrencpp/source/executors/thread_pool_executor.cpp:420:17: error: 'release' is unavailable [build] m_semaphore.release(); [build] ^ [build] /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/semaphore:197:10: note: 'release' has been explicitly marked unavailable here [build] void release(ptrdiff_t __update = 1) [build] ^ [build] 4 errors generated. can anyone could help me with it?
Posted
by mirocos.
Last updated
.
Post not yet marked as solved
13 Replies
4.0k Views
Hi, What could be causing this on Monterey (M1 Max)? How to debug further? Reproduction steps filed in https://gitlab.haskell.org/haskell/ghcup-hs/-/issues/301 0 0x104768224 __assert_rtn + 128 1 0x10476e4e8 ld::tool::OutputFile::addDyldInfo(ld::Internal&, ld::Internal::FinalSection*, ld::Atom const*, ld::Fixup*, ld::Fixup*, ld::Fixup*, ld::Atom const*, ld::Atom const*, unsigned long long, unsigned long long) (.cold.1) + 0 2 0x1046b0b98 ld::tool::OutputFile::addDyldInfo(ld::Internal&, ld::Internal::FinalSection*, ld::Atom const*, ld::Fixup*, ld::Fixup*, ld::Fixup*, ld::Atom const*, ld::Atom const*, unsigned long long, unsigned long long) + 0 3 0x1046a3544 ld::tool::OutputFile::generateLinkEditInfo(ld::Internal&) + 1188 4 0x10469da90 ld::tool::OutputFile::write(ld::Internal&) + 140 5 0x10462b1d8 main + 584 A linker snapshot was created at: /tmp/libHSfuturice-integrations-0-inplace-ghc8.10.7.dylib-2022-00-08-222023.ld-snapshot ld: Assertion failed: (target->definition() != ld::Atom::definitionProxy), function addChainedFixupLocation, file OutputFile.cpp, line 5903. clang-12: error: linker command failed with exit code 1 (use -v to see invocation) `clang' failed in phase `Linker'. (Exit code: 1)
Posted Last updated
.
Post not yet marked as solved
3 Replies
2.8k Views
I have an old iOS project that I'm updating.It uses UIAlertView a lot, which was deprecated in iOS 9, but I'm not seeing any deprecation warnings when I build the app.(I've seen warnings when updating other apps.)This is concerning me. If I'm not seeing these warnings, what other warnings am I missing?I've checked the build settings for the app and under "Apple LLVM 8.1 - Warnings - All languages" the setting for "Deprecated Functions" is set to "Yes" as it seems like it should be.I've grepped my entire project for the words "deprecate" and "warning" and "pragma" and nothing's showing up that would suppress these warnings.Does anybody have any advice for other things to check? Thanks in advance! (BTW, I'm using XCode 8.3.3 8E3004b.)
Posted
by motrek.
Last updated
.
Post not yet marked as solved
0 Replies
629 Views
I am using OpenMP for a University project, and when using gcc or clang to compile my C code, I get an error that omp.h file is not found. I have tried installing libomp through homebrew, however, it seems that it installs a keg-only version. I have tried adding libomp to path and even to the homebrew directory, no luck however. Any help is much appreciated!
Posted Last updated
.
Post not yet marked as solved
0 Replies
1k Views
I have a customized view like below: import UIKit public class TestView: UIView { public struct Preference { } public static var global: Preference = Preference() public class func show(preference: Preference = TestView.global) { } } I used xcodebuild archive and xcodebuild -create-xcframework to create a xcframework. However, when I embeded it to my host project, there is an error: Main actor-isolated static property 'global' can not be referenced from a non-isolated context, which is in the ***.private.swiftinterface file. The content of this file is as below: // swift-interface-format-version: 1.0 // swift-compiler-version: Apple Swift version 5.7.1 (swiftlang-5.7.1.135.3 clang-1400.0.29.51) // swift-module-flags: -target x86_64-apple-ios16.1-simulator -enable-objc-interop -enable-library-evolution -swift-version 5 -enforce-exclusivity=checked -Onone -module-name SDK // swift-module-flags-ignorable: -enable-bare-slash-regex import Foundation @_exported import SDK import Swift import UIKit import _Concurrency import _StringProcessing @objc @_inheritsConvenienceInitializers @_Concurrency.MainActor(unsafe) public class TestView : UIKit.UIView { public struct Preference { } @_Concurrency.MainActor(unsafe) public static var global: SDK.TestView.Preference @_Concurrency.MainActor(unsafe) public class func show(preference: SDK.TestView.Preference = TestView.global) @_Concurrency.MainActor(unsafe) @objc override dynamic public init(frame: CoreFoundation.CGRect) @_Concurrency.MainActor(unsafe) @objc required dynamic public init?(coder: Foundation.NSCoder) @objc deinit } Is it a bug for Xcode? Now my workaround is to avoid static properties in the method declaration.
Posted
by Zhaocheng.
Last updated
.
Post not yet marked as solved
0 Replies
802 Views
Hi We had the following crash report from one of our customers that using our SDK: Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Subtype: KERN_INVALID_ADDRESS at 0x00009970accfd190 -> 0x00000070accfd190 (possible pointer authentication failure) Exception Codes: 0x0000000000000001, 0x00009970accfd190 VM Region Info: 0x70accfd190 is not in any region. Bytes after previous region: 2899300753 REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL commpage (reserved) 1000000000-7000000000 [384.0G] ---/--- SM=NUL ...(unallocated) ---> UNUSED SPACE AT END Termination Reason: SIGNAL 11 Segmentation fault: 11 Terminating Process: exc handler [8788] Triggered by Thread: 5 Any suggestion on the reason why it happens? I understand that msgSend is related to zombie but from the code I don't see where it might happen and it's only single client that has this issue. How to father investigate it crashlog.crash
Posted Last updated
.
Post not yet marked as solved
2 Replies
809 Views
For some reason <memory_resource> header is located in experimental subfolder while I have Clang 14.0.0. <memory_resource> is C++17 feature and Clang 14.0.0 is more then C++17 capable. clang -v Apple clang version 14.0.0 (clang-1400.0.29.202) Target: x86_64-apple-darwin21.6.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin find /Library/Developer/CommandLineTools/usr/include/c++/v1/ -name memory_resource -type f /Library/Developer/CommandLineTools/usr/include/c++/v1//experimental/memory_resource
Posted
by dshvets1.
Last updated
.
Post not yet marked as solved
2 Replies
3.3k Views
Hi, This is a weird one: We have a iOS project that has CorePlot as a sub-project that builds it's .a file that are linked with our binary. Everything worked fine on Xcode 14.2 but building the projects with 14.3 I get a massive amount of errors of this kind: "Mixing declarations and code is incompatible with standards before C99" That relates to declarations that are not at the top a functions and that has been normal for as long as I have written Obj-C. It only happen in the CorePlot files not in our own. I can't find any special differences between the sub-project and the enclosing projects settings. Since it's has worked for years in all older versions of Xcode, I suspect this is something related to 14.3 and perhaps some older project formats? Any ideas to try? I've already messed with the compiler version settings, but both projects had GNU99 set, and changing it would did nothing...
Posted
by Janne.
Last updated
.