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 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
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 <VegasKit/Place.h> then I get an error saying it can't find the file. If I try this: #import <Place.h> 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
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
Post not yet marked as solved
13 Replies
3.9k 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
by
Post not yet marked as solved
3 Replies
2.1k 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 )
Post not yet marked as solved
1 Replies
1.4k Views
While running the unit tests of our iOS project, we encounter the error I mentioned below. We tried with different iOS versions in XCode 13.4.1 and 14 versions, but the result did not change. Because of this error, Coverage.profdata file cannot be created and we cannot obtain coverage data. Has anyone ever encountered such an error or does anyone know how to solve it? We would be glad if you help. Test Suite 'All tests' passed at 2022-10-07 11:25:19.487. Executed 2110 tests, with 0 failures (0 unexpected) in 7.292 (10.705) seconds LLVM Profile Error: Runtime and instrumentation version mismatch : expected 4, but get 5 Failed to merge raw profiles in directory /Users/*** /Build/Intermediates.noindex/CodeCoverage/ProfileData/7FFCA33C-01FF-46BE-923D-A1A0CCF11A16 to destination /Users/*** /Build/Intermediates.noindex/CodeCoverage/ProfileData/7FFCA33C-01FF-46BE-923D-A1A0CCF11A16/Coverage.profdata: Aggregation tool '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/llvm-profdata' failed with exit code 1: warning: /Users/*** /Build/Intermediates.noindex/CodeCoverage/ProfileData/7FFCA33C-01FF-46BE-923D-A1A0CCF11A16/B5268FD3-2A23-4CA3-BE5F-AEFA9869C8ED-14839.profraw: failed to uncompress data (zlib) error: no profile can be merged
Posted
by
Post not yet marked as solved
2 Replies
3.2k 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
Post not yet marked as solved
2 Replies
794 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
Post not yet marked as solved
0 Replies
788 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
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
Post not yet marked as solved
0 Replies
608 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
by
Post not yet marked as solved
6 Replies
1.8k Views
Our Kotlin MPP code which compiled/linked fine using Xcode 15 Beta 2 no longer links using Xcode 15 Beta 3: ld: unknown options: -ios_simulator_version_min -sdk_version Is the option ios_simulator_version_min removed/renamed? (Intentionally?) Should Apple or JetBrains fix this? (also reported to JetBrains as KT-60238).
Posted
by
Post not yet marked as solved
4 Replies
984 Views
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the crash backtrace. Stack dump: 0. Program arguments: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-frontend -frontend -c /Users/lawrey/Documents/GitHub/IPPTPLUS-IOS/IPPT/Common/Toast/Toast.swift /Users/lawrey/Documents/GitHub/IPPTPLUS-IOS/IPPT/Shop/CheckOutViewController.swift /Users/lawrey/Documents/GitHub/IPPTPLUS-IOS/IPPT/Common/UITextField/NLPaddedTextFieldView.swift ... ... /IPPT.build/Release-iphoneos/IPPT.build/Objects-normal/arm64/SettingsVC.o -index-unit-output-path /IPPT.build/Release-iphoneos/IPPT.build/Objects-normal/arm64/DGElasticPullToRefreshConstants.o -index-unit-output-path /IPPT.build/Release-iphoneos/IPPT.build/Objects-normal/arm64/DGElasticPullToRefreshView.o -index-unit-output-path /IPPT.build/Release-iphoneos/IPPT.build/Objects-normal/arm64/CountDownRouterVC.o -index-unit-output-path /IPPT.build/Release-iphoneos/IPPT.build/Objects-normal/arm64/DatePickerTableViewCell.o -index-unit-output-path /IPPT.build/Release-iphoneos/IPPT.build/Objects-normal/arm64/CircularProgress.o 1. Apple Swift version 5.8 (swiftlang-5.8.0.124.2 clang-1403.0.22.11.100) 2. Compiling with the current language version 3. While evaluating request ExecuteSILPipelineRequest(Run pipelines { PrepareOptimizationPasses, EarlyModulePasses, HighLevel,Function+EarlyLoopOpt, HighLevel,Module+StackPromote, MidLevel,Function, ClosureSpecialize, LowLevel,Function, LateLoopOpt, SIL Debug Info Generator } on SIL for IPPT) 4. While running pass #670343 SILModuleTransform "DeadFunctionAndGlobalElimination". Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it): 0 swift-frontend 0x0000000109b7f300 llvm::sys::PrintStackTrace(llvm::raw_ostream&amp;, int) + 56 1 swift-frontend 0x0000000109b7e2e4 llvm::sys::RunSignalHandlers() + 112 2 swift-frontend 0x0000000109b7f910 SignalHandler(int) + 344 3 libsystem_platform.dylib 0x000000019418aa24 _sigtramp + 56 4 swift-frontend 0x00000001052bb65c (anonymous namespace)::DeadFunctionAndGlobalEliminationPass::run() + 424 5 swift-frontend 0x00000001052bb65c (anonymous namespace)::DeadFunctionAndGlobalEliminationPass::run() + 424 6 swift-frontend 0x00000001054214a0 swift::SILPassManager::executePassPipelinePlan(swift::SILPassPipelinePlan const&amp;) + 15312 7 swift-frontend 0x0000000105442a04 swift::SimpleRequest&lt;swift::ExecuteSILPipelineRequest, std::__1::tuple&lt;&gt; (swift::SILPipelineExecutionDescriptor), (swift::RequestFlags)1&gt;::evaluateRequest(swift::ExecuteSILPipelineRequest const&amp;, swift::Evaluator&amp;) + 56 8 swift-frontend 0x0000000105428dd4 llvm::Expected&lt;swift::ExecuteSILPipelineRequest::OutputType&gt; swift::Evaluator::getResultUncached&lt;swift::ExecuteSILPipelineRequest&gt;(swift::ExecuteSILPipelineRequest const&amp;) + 484 9 swift-frontend 0x000000010542b714 swift::runSILOptimizationPasses(swift::SILModule&amp;) + 400 10 swift-frontend 0x0000000104c09c10 swift::CompilerInstance::performSILProcessing(swift::SILModule*) + 524 11 swift-frontend 0x0000000104a6d51c performCompileStepsPostSILGen(swift::CompilerInstance&amp;, std::__1::unique_ptr&lt;swift::SILModule, std::__1::default_delete&lt;swift::SILModule&gt; &gt;, llvm::PointerUnion&lt;swift::ModuleDecl*, swift::SourceFile*&gt;, swift::PrimarySpecificPaths const&amp;, int&amp;, swift::FrontendObserver*) + 1040 12 swift-frontend 0x0000000104a70ab8 performCompile(swift::CompilerInstance&amp;, int&amp;, swift::FrontendObserver*) + 3288 13 swift-frontend 0x0000000104a6e944 swift::performFrontend(llvm::ArrayRef&lt;char const*&gt;, char const*, void*, swift::FrontendObserver*) + 4308 14 swift-frontend 0x0000000104a3368c swift::mainEntry(int, char const**) + 4116 15 dyld 0x0000000193e03f28 start + 2236 Command SwiftCompile failed with a nonzero exit code I need help understanding the root cause to resolve. Overwhelmed by the log :(
Posted
by
Post not yet marked as solved
1 Replies
585 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
by
Post not yet marked as solved
1 Replies
1.4k 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
Post not yet marked as solved
5 Replies
777 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
by
Post not yet marked as solved
6 Replies
1.8k Views
After upgrading my Xcode from 14.3 to 15.0, there is a compilation error "Unsupported mach-o filetype (only MH_OBJECT and MH_DYLIB can be linked) in libLLVM.dylib". There is no solution found anywhere (Google, Stackoverflow, This forum). The error message is not helpful to locate the root cause. I also tried to read through this page https://iphonedev.wiki/Mach-O_File_Format to know more about LLVM, MH_OBJECT. So far, i cannot find any good reference.
Posted
by
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
by
Post not yet marked as solved
0 Replies
560 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