Use dyld to link in frameworks at runtime. Use ld to make your programs and link archive libraries at build time.

Linker Documentation

Pinned Posts

Posts under Linker tag

162 Posts
Sort by:
Post not yet marked as solved
2 Replies
2.3k Views
Hi, is it possible to make a .dll project in C++ with Xcode?Thank you.Thierry
Posted
by
Post not yet marked as solved
2 Replies
1k Views
Hi all, I have an xcframework for iOS that only contains an arm64 framework, not a simulator framework. When run on the simulator, no code from the framework is needed (it is stubbed/mocked out). However, I'm struggling to find how to link the xcframework only for device builds. So the situation is this: If I link the framework, device builds compile and run fine. For simulator, it fails with this error: error: While building for iOS Simulator, no library for this platform was found If I don't link the framework, simulator builds and runs fine, but on devices I get a dyld error at runtime. These results are understandable, but I'd like to know if it's possible to include the xcframework only for device builds, as this would seem to solve my problems... Any help would be appreciated.
Posted
by
Post marked as solved
11 Replies
6.2k Views
Suddenly, I'm having this problem where my app crashes when I install it over testflight. I initially thought it was the CI infrastructure using Xcode 13.0 but moving it to Xcode 13.1 had the same result. Also, the problem persists when distributing from my local development machine. Building directly to my device works perfectly. It's the testflight build that fails. This is the crash Report crashlog.crash The good thing is that the App we are developing is completely Open Source and the code can be found here https://github.com/zcash/secant-ios-wallet/releases/tag/0.0.1-7 We are not using any crash reporter. The only external code we are using is the TCA dependency.
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
6 Replies
19k Views
Hi,all I'm writing a simple c program on my m1 MacBook with vscode ,but when I complied the project, error occurs: Undefined symbols for architecture arm64: "_main", referenced from: implicit entry/start for main executable ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation) I installed Xcode and used vscose and my program is : #include <cstdio> int main() { char name[100];printf("please input your name:"); scanf("%s",name); printf("hello,%s",name); }
Posted
by
Post not yet marked as solved
0 Replies
5.0k Views
Apple’s library technology has a long and glorious history, dating all the way back to the origins of Unix. This does, however, mean that it can be a bit confusing to newcomers. This is my attempt to clarify some terminology. If you have any questions or comments about this, start a new thread and tag it with Linker so that I see it. Share and Enjoy — Quinn “The Eskimo!” @ Developer Technical Support @ Apple let myEmail = "eskimo" + "1" + "@" + "apple.com" An Apple Library Primer Apple’s tools support two related concepts: Platform — This is the platform itself; macOS, iOS, iOS Simulator, and Mac Catalyst are all platforms. Architecture — This is a specific CPU architecture used by a platform. arm64 and x86_64 are both architectures. A given architecture might be used by multiple platforms. The most obvious example of this arm64, which is used by all of the platforms listed above. Code built for one platform will not work on another platform, even if both platforms use the same architecture. Code is usually packaged in either a Mach-O file or a static library. Mach-O is used for executables, dynamic libraries, bundles, and object files. These can have a variety of different extensions; the only constant is that .o is always used for a Mach-O containing an object file. Use otool and nm to examine a Mach-O file. Use vtool to quickly determine the platform for which it was built. Use size to get a summary of its size. Use dyld_info to get more details about a dynamic library. IMPORTANT All the tools mentioned here are documented in man pages; for information on how to access that documentation, see Reading UNIX Manual Pages. The term Mach-O image refers to a Mach-O that can be loaded and executed without further processing. That includes executables, dynamic libraries, and bundles, but not object files. A dynamic library has the extension .dylib. You may also see this called a shared library. A framework is a bundle structure with the .framework extension that has both compile-time and run-time roles: At compile time, the framework combines the library’s headers and its stub library (stub libraries are explained below). At run time, the framework combines the library’s code, as a Mach-O dynamic library, and its associated resources. The exact structure of a framework varies by platform. For the details, see Placing Content in a Bundle. macOS supports both frameworks and standalone dynamic libraries. Other Apple platforms support frameworks but not standalone dynamic libraries. Historically these two roles were combined, that is, the framework included the headers, the dynamic library, and its resources. These days Apple ships different frameworks for each role. That is, the macOS SDK includes the compile-time framework and macOS itself includes the run-time one. Most third-party frameworks continue to combine these roles. A static library is an archive of one or more object files. It has the extension .a. Use ar, libtool, and ranlib to inspect and manipulate these archives. The static linker, or just the linker, runs at build time. It combines various inputs into a single output. Typically these inputs are object files, static libraries, dynamic libraries, and various configuration items. The output is most commonly a Mach-O image, although it’s also possible to output an object file. The linker may also output metadata, such as a link map (see Using a Link Map to Track Down a Symbol’s Origin). The linker has seen three major implementations: ld — This dates from the dawn of Mac OS X. ld64 — This was a rewrite started in the 2005 timeframe. Eventually it replaced ld completely. If you type ld, you get ld64. ld_prime — This was introduced with Xcode 15. This isn’t a separate tool. Rather, ld now supports the -ld_classic and -ld_new options to select a specific implementation. Note During the Xcode 15 beta cycle these options were -ld64 and -ld_prime. I continue to use those names because the definition of new changes over time (some of us still think of ld64 as the new linker ;–). The dynamic linker loads Mach-O images at runtime. Its path is /usr/lib/dyld, so it’s often referred to as dyld, dyld, or DYLD. Personally I pronounced that dee-lid, but some folks say di-lid and others say dee-why-el-dee. The dynamic linker has seen 4 major revisions. See WWDC 2017 Session 413 (referenced below) for a discussion of versions 1 through 3. Version 4 is basically a merging of versions 2 and 3. The dyld man page is chock-full of useful info, including a discussion of how it finds images at runtime. One of the most common points of confusion with dynamic linker is the way that the dynamic linker identifies dynamic libraries. There are two standard approaches to this, as described in Dynamic Library Identification. Xcode 15 introduced the concept of a mergeable library. This a dynamic library with extra metadata that allows the linker to embed it into the output Mach-O image, much like a static library. Mergeable libraries have many benefits. For all the backstory, see WWDC 2023 Session 10268 Meet mergeable libraries. For instructions on how to set this up, see Configuring your project to use mergeable libraries. If you put a mergeable library into a framework structure you get a mergeable framework. Xcode 15 also introduced the concept of a static framework. This is a framework structure where the framework’s dynamic library is replaced by a static library. Note It’s not clear to me whether this offers any benefit over creating a mergeable framework. Earlier versions of Xcode did not have proper static framework support. That didn’t stop folks trying to use them, which caused all sorts of weird build problems. A universal binary is a file that contains multiple architectures for the same platform. Universal binaries always use the universal binary format. Use the file command to learn what architectures are within a universal binary. Use the lipo command to manipulate universal binaries. A universal binary’s architectures are either all in Mach-O format or all in the static library archive format. The latter is called a universal static library. A universal binary has the same extension as its non-universal equivalent. That means a .a file might be a static library or a universal static library. Most tools work on a single architecture within a universal binary. They default to the architecture of the current machine. To override this, pass the architecture in using a command-line option, typically -arch or --arch. An XCFramework is a single document package that includes libraries for any combination of platforms and architectures. It has the extension .xcframework. An XCFramework holds either a framework, a dynamic library, or a static library. All the elements must be the same type. Use xcodebuild to create an XCFramework. For specific instructions, see Xcode Help > Distribute binary frameworks > Create an XCFramework. Historically there was no need to code sign libraries in SDKs. If you shipped an SDK to another developer, they were responsible for re-signing all the code as part of their distribution process. Xcode 15 changes this. You should sign your SDK so that a developer using it can verify this dependency. For more details, see WWDC 2023 Session 10061 Verify app dependencies with digital signatures and Verifying the origin of your XCFrameworks. A stub library is a compact description of the contents of a dynamic library. It has the extension .tbd, which stands for text-based description (TBD). Apple’s SDKs include stub libraries to minimise their size; for the backstory, read this post. Stub libraries currently use YAML format, a fact that’s relevant when you try to interpret linker errors. Use the tapi tool to create and manipulate these files. In this context TAPI stands for a text-based API, an alternative name for TBD. Oh, and on the subject of tapi, I’d be remiss if I didn’t mention tapi-analyze! Mach-O uses a two-level namespace. When a Mach-O image imports a symbol, it references the symbol name and the library where it expects to find that symbol. This improves both performance and reliability but it precludes certain techniques that might work on other platforms. For example, you can’t define a function called printf and expect it to ‘see’ calls from other dynamic libraries because those libraries import the version of printf from libSystem. To help folks who rely on techniques like this, macOS supports a flat namespace compatibility mode. This has numerous sharp edges — for an example, see the posts on this thread — and it’s best to avoid it where you can. If you’re enabling the flat namespace as part of a developer tool, search the ’net for dyld interpose to learn about an alternative technique. WARNING Dynamic linker interposing is not documented as API. While it’s a useful technique for developer tools, do not use it in products you ship to end users. Apple platforms use DWARF. When you compile a file, the compiler puts the debug info into the resulting object file. When you link a set of object files into a executable, dynamic library, or bundle for distribution, the linker does not include this debug info. Rather, debug info is stored in a separate debug symbols document package. This has the extension .dSYM and is created using dsymutil. Use symbols to learn about the symbols in a file. Use dwarfdump to get detailed information about DWARF debug info. Use atos to map an address to its corresponding symbol name. Over the years there have been some really good talks about linking and libraries at WWDC, including: WWDC 2023 Session 10268 Meet mergeable libraries WWDC 2022 Session 110362 Link fast: Improve build and launch times WWDC 2022 Session 110370 Debug Swift debugging with LLDB WWDC 2021 Session 10211 Symbolication: Beyond the basics WWDC 2019 Session 416 Binary Frameworks in Swift — Despite the name, this covers XCFrameworks in depth. WWDC 2018 Session 415 Behind the Scenes of the Xcode Build Process WWDC 2017 Session 413 App Startup Time: Past, Present, and Future WWDC 2016 Session 406 Optimizing App Startup Time Note The older talks are no longer available from Apple, but you may be able to find transcripts out there on the ’net. Historically Apple published a document, Mac OS X ABI Mach-O File Format Reference, or some variant thereof, that acted as the definitive reference to the Mach-O file format. This document is no longer available from Apple. If you’re doing serious work with Mach-O, I recommend that you find an old copy. It’s definitely out of date, but there’s no better place to get a high-level introduction to the concepts. The Mach-O Wikipedia page has a link to an archived version of the document. For the most up-to-date information about Mach-O, see the declarations and doc comments in <mach-o/loader.h>. Revision History 2024-03-02 Updated the discussion of static frameworks to account for Xcode 15 changes. Removed the link to WWDC 2018 Session 415 because it no longer works )-: 2024-03-01 Added the WWDC 2023 session to the list of sessions to make it easier to find. Added a reference to Using a Link Map to Track Down a Symbol’s Origin. Made other minor editorial changes. 2023-09-20 Added a link to Dynamic Library Identification. Updated the names for the static linker implementations (-ld_prime is no more!). Removed the beta epithet from Xcode 15. 2023-06-13 Defined the term Mach-O image. Added sections for both the static and dynamic linkers. Described the two big new features in Xcode 15: mergeable libraries and dependency verification. 2023-06-01 Add a reference to tapi-analyze. 2023-05-29 Added a discussion of the two-level namespace. 2023-04-27 Added a mention of the size tool. 2023-01-23 Explained the compile-time and run-time roles of a framework. Made other minor editorial changes. 2022-11-17 Added an explanation of TAPI. 2022-10-12 Added links to Mach-O documentation. 2022-09-29 Added info about .dSYM files. Added a few more links to WWDC sessions. 2022-09-21 First posted.
Posted
by
Post not yet marked as solved
4 Replies
5.5k Views
Hello, My app runs fine on Monterey, but on Ventura we get a crash upon launch with the following Termination Reason: Termination Reason: Namespace DYLD, Code 1 Library missing Library not loaded: @rpath/libmylibrary-sdk.dylib Referenced from: <B2C025A7-2A52-3D29-93CF-EB0AE93077AA> /Applications/MyApp.app/Contents/MacOS/MyApp Reason: tried: '/usr/lib/swift/libmylibrary-sdk.dylib' (no such file, not in dyld cache), '/System/Volumes/Preboot/Cryptexes/OS/usr/lib/swift/libmylibrary-sdk.dylib' (no such file), '/usr/lib/swift/libmylibrary-sdk.dylib' (no such file, not in dyld cache), '/System/Volumes/Preboot/Cryptexes/OS/usr/lib/swift/libmylibrary-sdk.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS@rpath/libmylibrary-sdk.dylib' (no such file), '/usr/lib/swift/libmylibrary-sdk.dylib' (no such file, not in dyld cache), '/System/Volumes/Preboot/Cryptexes/OS/usr/lib/swift/libmylibrary-sdk.dylib' (no such file), '/usr/lib/swift/libmylibrary-sdk.dylib' (no such file, not in dyld cache), '/System/Volumes/Preboot/Cryptexes/OS/usr/lib/swift/libmylibrary-sdk.dylib' (no such file), '/usr/lib/libmylibrary-sdk.dylib' (no such file, not in dyld cache) (terminated at launch; ignore backtrace) My app depends on mylibrary-sdk.dylib, which I've included in the target using SPM. Again, this setup runs produces an app that runs fine on Monterey. This is very odd, because it seems to be looking for mylibrary-sdk.dylib in /usr/lib/swift/ and /usr/lib/libmylibrary-sdk.dylib ?! If I look at the binary, the dylib is indeed in its Frameworks directory. I've also added @executable_path/../Frameworks to my Runpath Search Paths but that didn't help.
Posted
by
Post not yet marked as solved
11 Replies
3.5k Views
When I try to run a simple executable from Cmake, I get this error. dyld[5005]: dyld cache '(null)' not loaded: syscall to map cache into shared region failed dyld[5005]: Library not loaded: /usr/lib/libSystem.B.dylib Referenced from: <7EB1C677-BB05-338C-8B29-CC2803CB8C21> /Users/pop/Desktop/Lang Reason: tried: '/usr/lib/libSystem.B.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/lib/libSystem.B.dylib' (no such file), '/usr/lib/libSystem.B.dylib' (no such file, no dyld cache), '/usr/local/lib/libSystem.B.dylib' (no such file) I have tried looking for my file sudo find / -name libSystem.B.dylib but not luck. I am using an M1 chip and Ventura 13.1. Please ask for more details if you need them, as I really have no idea what to do about my problem.
Posted
by
Post marked as Apple Recommended
39k Views
Downloaded Xcode 14.3 this morning and it will not build the project. It fails building the CocoaPods project with this error: It varies which pod causes the failure, but always the first to link. cd'ing into there confirms that there is no arc dir. The regular Xcode app (Version 14.2 (14C18)) runs just fine. Any ideas? Potentially useful information: Project with objc, swift and c Uses CocoaPods Uses automatic reference counting macOS Ventura 13.2.1 (22D68) Version 14.3 beta (14E5197f)
Posted
by
Post not yet marked as solved
3 Replies
2.5k Views
My project was building fine with Xcode 14.1. After upgrading Xcode to 14.3 (and MacOS to Ventura), the project at first reported that build succeeded. But then when I tried to run the project, it suddenly reported that build failed, with the following error: ld: file not found: /Applications/Xcode 14.3.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_iphoneos.a clang: error: linker command failed with exit code 1 (use -v to see invocation) The build fails while trying to link a cocoa pod library we use called SVProgressHUD. The full link command as found in the build log is as follows: Ld /Users/username/Library/Developer/Xcode/DerivedData/Dudleys-awqewehuamgjgrfgdpuqcillyxfo/Build/Products/Debug-iphoneos/SVProgressHUD/SVProgressHUD.framework/SVProgressHUD normal (in target 'SVProgressHUD' from project 'Pods') cd /Users/username/lineskip_dev/ios_apps/dudleys/Pods /Applications/Xcode\ 14.3.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -Xlinker -reproducible -target arm64-apple-ios8.0 -dynamiclib -isysroot /Applications/Xcode\ 14.3.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS16.4.sdk -L/Users/username/Library/Developer/Xcode/DerivedData/Dudleys-awqewehuamgjgrfgdpuqcillyxfo/Build/Intermediates.noindex/EagerLinkingTBDs/Debug-iphoneos -L/Users/username/Library/Developer/Xcode/DerivedData/Dudleys-awqewehuamgjgrfgdpuqcillyxfo/Build/Products/Debug-iphoneos/SVProgressHUD -F/Users/username/Library/Developer/Xcode/DerivedData/Dudleys-awqewehuamgjgrfgdpuqcillyxfo/Build/Intermediates.noindex/EagerLinkingTBDs/Debug-iphoneos -F/Users/username/Library/Developer/Xcode/DerivedData/Dudleys-awqewehuamgjgrfgdpuqcillyxfo/Build/Products/Debug-iphoneos/SVProgressHUD -filelist /Users/username/Library/Developer/Xcode/DerivedData/Dudleys-awqewehuamgjgrfgdpuqcillyxfo/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/SVProgressHUD.build/Objects-normal/arm64/SVProgressHUD.LinkFileList -install_name @rpath/SVProgressHUD.framework/SVProgressHUD -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -rpath -Xlinker @loader_path/Frameworks -dead_strip -Xlinker -object_path_lto -Xlinker /Users/username/Library/Developer/Xcode/DerivedData/Dudleys-awqewehuamgjgrfgdpuqcillyxfo/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/SVProgressHUD.build/Objects-normal/arm64/SVProgressHUD_lto.o -Xlinker -export_dynamic -Xlinker -no_deduplicate -fobjc-arc -fobjc-link-runtime -framework QuartzCore -framework Foundation -framework QuartzCore -compatibility_version 1 -current_version 1 -Xlinker -dependency_info -Xlinker /Users/username/Library/Developer/Xcode/DerivedData/Dudleys-awqewehuamgjgrfgdpuqcillyxfo/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/SVProgressHUD.build/Objects-normal/arm64/SVProgressHUD_dependency_info.dat -o /Users/username/Library/Developer/Xcode/DerivedData/Dudleys-awqewehuamgjgrfgdpuqcillyxfo/Build/Products/Debug-iphoneos/SVProgressHUD/SVProgressHUD.framework/SVProgressHUD What's strange is that we are successfully building other projects with Xcode 14.3 that use this same library. And I can't find the reason why the linker is trying to link to the file libarclite_iphoeos.a in the first place.
Posted
by
Post not yet marked as solved
3 Replies
756 Views
The iOS version of the app is functioning correctly on TestFlight, and there are no issues when building the Mac Catalyst version of the app from Xcode. However, when distributing the app to TestFlight for Mac Catalyst, the FFmpegkit library fails to load, resulting in a crash. The crash report indicates that the library is missing and cannot be located in the designated file path. Specifically, the crash report states that the library could not be loaded from "@rpath/ffmpegkit.framework/ffmpegkit". Despite extensive efforts, I have been unable to resolve this issue. This is error message in the crash report. Termination Reason: Namespace DYLD, Code 1 Library missing Library not loaded: @rpath/ffmpegkit.framework/ffmpegkit Referenced from: <9162F8B0-7112-310B-8EDA-59766087927F> /Applications/MyApp.app/Contents/MacOS/MyApp Reason: tried: '/System/Library/Frameworks/ffmpegkit.framework/ffmpegkit' (no such file, not in dyld cache), (security policy does not allow @ path expansion) (terminated at launch; ignore backtrace) Are there any alternative solutions to resolve this problem? This is all the things I have already tried: I tried most of the solutions mentioned in the post below. https://stackoverflow.com/questions/24333981/ios-app-with-framework-crashed-on-device-dyld-library-not-loaded-xcode-6-beta I checked the package content found in Testflight and the paths are correctly matching the following /System/Library/Frameworks/ffmpegkit.framework/ffmpegkit I ran the app scheme as release within Xcode and it build and ran fine with no issues I manually loaded the signing certificates for mac catalyst and still getting the error Deleted all derived data Deleted and reinstalled Xcode and also tried previous Xcode versions. Deleted the project completely
Posted
by
Post not yet marked as solved
2 Replies
320 Views
i use xcode to practice coding in c++ but i cannot see to overcome this error "2 duplicate symbols for architecture arm64" and "Linker command failed with exit code 1 (use -v to see invocation)" it is becoming a big problem now please help me out here
Posted
by
Post not yet marked as solved
0 Replies
353 Views
(fat file, but missing compatible architecture (have 'x86_64,arm64', need ''))
Posted
by
Post not yet marked as solved
5 Replies
351 Views
We are having the issue with our our cmake made ....cpython-39-darwin.so. The issue is with libSystem and libc++. Any comments you can help us with would be much appreciated. Arman [garakana@garakana-GYXMF4]$ otool -L MultiResImagePy.cpython-39-darwin.so MultiResImagePy.cpython-39-darwin.so: @rpath/libPlacement.dylib (compatibility version 0.0.0, current version 0.0.0) @rpath/libImageBuffer.dylib (compatibility version 0.0.0, current version 0.0.0) @rpath/libImageBufferIO.dylib (compatibility version 0.0.0, current version 0.0.0) @rpath/libMultiResImage.dylib (compatibility version 0.0.0, current version 0.0.0) @rpath/libCore.dylib (compatibility version 0.0.0, current version 0.0.0) @rpath/libEncode.dylib (compatibility version 0.0.0, current version 0.0.0) @rpath/libImage.dylib (compatibility version 0.0.0, current version 0.0.0) @rpath/libUtils.dylib (compatibility version 0.0.0, current version 0.0.0) /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1300.36.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.0.0)
Posted
by
Post not yet marked as solved
2 Replies
846 Views
I'm trying to upload the app which uses static.framework &amp; resounce.bundle. I have included static framework and resource bundle in my app. I archive the app for development everything works fine but when tried to upload it to app store encountered an error "Invalid bundle Structure" Thanks for any help in advance!
Posted
by
Post marked as solved
5 Replies
8.8k Views
Hi! Xcode 14.3 on MacOS 13.3.1 I'm developing in iOS app targeting iOS 14.0 and higher. I've included 4 cocoa pods in my project and my code has compiled and run just fine. When I started to try to build an archive to submit to the app store, things started falling apart. Now nothing compiles for simulators and test devices and I end up with linking errors with undefined symbols. I've tried clean builds, pod updating, pod installing, explicitly importing the modules in my swift code. I'm ready to pull my hair out. Undefined symbols for architecture arm64: "OBJC_CLASS$_SFGeometryUtils", referenced from: objc-class-ref in MGRS.o ld: symbol(s) not found for architecture arm64 Any suggestions? Randomly I can get past this road block and then I run into: cannot find type 'TIFFImage' in scope var tiffImage: TIFFImage! Then randomly back to unresolved symbols by linker. Thanks, Bobby
Posted
by
Post not yet marked as solved
0 Replies
415 Views
I was testing my framework APIs. My framework has the following sample code open class TestManager { let appendStringHandler: (String, String) -&gt; String public init(appendHandler: @escaping (String, String) -&gt; String = TestManager.appendStringObject(text1:text2:)) { self.appendStringHandler = appendHandler } public class func appendStringObject(text1: String, text2: String) -&gt; String { return text1+text2 } public func printString() { print(appendStringHandler("test1", "test2")) } } I am creating an object like this let test = TestManager() in my project which is using the framework. I am getting the following error while building in Debug mode and in Xcode 14.3 Undefined symbols for architecture x86_64: "_$s17ReusableComponent11TestManagerC18appendStringObject5text15text2S2S_SStFZ", referenced from: $s17ReusableComponent11TestManagerC13appendHandlerACS2S_SStc_tcfcfA_S2S_SStcfu in ViewController.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) After some investigation found out that changing the debug Compilation Mode to "Incremental" is fixing the issue. Observations: Xcode 14.2: There is no issue when Compilation Mode is "Whole Module" in Debug/Release both Xcode 14.3: Having issue when Compilation Mode is "Whole Module" in Debug. Release Mode doesn't have any issue with "Whole Module" mode. I was wondering what changed in xcode 14.3? Please let us know how can I stick with the "Whole Module" compilation mode without the error.
Posted
by
Post not yet marked as solved
1 Replies
346 Views
Hi, ALL, WHat is the way to use "~" with the "install_name_tool -change" command? Problem: I'm using self-build library in my development. I build this library in my home directory and then successfully link it to my application. Then I make a script that copies all dylib that my application uses inside the Bundle and using "install_name_tool -change" command to relink them from new location. The current commands look like this: [code] cp -f /home/igorkorot/wxWidgets/buildC11/libwx-* "$TARGET_BUILD_DIR/$TARGET_NAME.app/Contents/Frameworks/libwx-*" install_name_tool -change "/Users/igorkorot/wxWidgets/buildC11/lib/libwx_" @executable_path/../Frameworks/libwx_"$TARGET_BUILD_DIR/$TARGET_NAME.app/Contents/Frameworks/libwx_*" [/code] I'd like to remove the references to "/Users/igorkorot" and instead use "~" to reference a "home directory" How can I do that? Thank you.
Posted
by
Post not yet marked as solved
1 Replies
563 Views
My situation: I am developing a dynamically linked framework called A, wrapped into .xcframework I depend upon other frameworks B and C that are linked statically However, I don't want the consumers of A to learn about the existence of B and C And because of this, I would like to perform single object pre-link during the linkage of A so that B and C are totally consumed by A and are to be never seen again. This task would be relatively easy if instead of static frameworks (.framework), I used static libraries (.a). In this case, I would be able to easily plop the path to the .a into the Prelink Libraries setting, set Perform Single-Object Prelink to YES, disable the embedding - and the goal would be accomplished. However, I am facing the linkage against frameworks, not libs. The problem is that it has resources and bundles inside of it. If I put a path to the .xcframework or .framework into the Prelink Libraries Build Setting, the build fails: Command MasterObjectLink failed with a nonzero exit code can't map file, errno=22 file '/Users/*****/B/B.xcframework/ios-arm64/B.framework' And if I put a path to the actual executable inside the framework (B.xcframework/ios-arm64/B.framework/B), the build succeeds. However, none of the resources of B.framework are present in the resulting output. Is there a way to automatically copy resources during Single-Object Prelink?
Posted
by
Post not yet marked as solved
3 Replies
726 Views
Hi! I have a objc static lib with some depending framework files. I want to build a kind of wrapper to intercept some functions of the objc library. How can this be done? It's no problem to use the static lib and the framework files within a App-Target but I don't understand what to do to build a Swift static lib that uses this lib? Thanks!
Posted
by