Intra-Package Module Dependencies - swift

I have a Swift Package (you can download here, its a pure Swift markdown implementation) that has two modules, one a library and the second an executable. Running swift build will correctly figure out to build the library, then builds the executable, but fails when it tries to link with the error
Undefined symbols for architecture x86_64:
"__TFE9SmarkDownSSg8markdownSS", referenced from:
_main in main.swift.o
ld: symbol(s) not found for architecture x86_64
Of course the referenced symbol is the method (or in this case property) I am trying to use (an extension to String).
I guess the question is: is there anything specific that must be done for modules within a package to ensure that they are linked together?

I've check your project and it compiles for me.
Here are few things to check:
1. Follow Install instructions from Swift.or
2. Setup you PATH.
export PATH=/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin:"${PATH}"
export TOOLCHAINS=swift
export SWIFT_EXEC=/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin/swiftc
3. Make sure you use git 2.0 or higher.
git --version

Related

Xcode test build fails

Every time I run cmd + u I get this error:
If I run cmd + b the build is successful.
I tried to install for testing same pods as debug build but it seems that is not the problem. Also clean derived data also does not work.
Please, if you have any clue share it. Also feel free for asking about more information.
Edited:
ld: warning: Could not find or use auto-linked framework 'Lottie'
ld: warning: Could not find or use auto-linked framework 'Airship'
Undefined symbols for architecture arm64
Thanks
In podfile, after stopping using inherit from test target, and set this one to use Lottie and Airship directly, it works properly. In this way I can use this frameworks with my tests.

Flutter Plugin containing static library (.a File) is not linked correctly

I have a Flutter Plugin, which for iOS uses a static library (.a file). If I add the plugin to my pubspec.yaml and install it via flutter pub get, it installs a pod, which I can see in my app`s XCode project, everything correct so far.
pubspec.yaml:
XXX_flutter:
git:
url: git#gitlab:XXX-solutions/app/flutter/plugin_XXX.git
ref: "develop"
However if I build the app, I get the following error:
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_XXX", referenced from:
objc-class-ref in XXX.o
ld: symbol(s) not found for architecture arm64
In the XCode workspace, in the Pods project, if I select the XXX pod, I can add the .a file manually to "Pod Project -> TARGETS XXX -> Build Phases -> Link Binary With Libraries". This would solve the problem, but I had to do it any time I do a flutter clean, pub upgrade, team member checks out project etc.. since the Pods are not under source control, so this solution is not good.
I tried to add the .a file to my app`s project "Link Binary With Libraries", but this didnt fix it. I have no idea how to solve this.
Note: The library is proprietary software, so it´s blacked out because I think the developers dont want to see problems issued with their software. The plugin itself is just Flutter wrappers for the library and is written by our team.
This is because the static lib you are using isn't compiled for arm64 devices, so you need to exclude this architecture from your build. See pic.
*Note: it's only on release, you may have issues excluding arm64 for debug if you have an M1/M2 mac and using simulators.
You can release to App Store for ios devices with arm64 excluded with no issue.
Alternatively, you could include a version of your static lib that is compiled for arm64 arc.

ProgressHUD: Undefined symbols for architecture x86_64:

I always get the same error using ProgressHUD.
Implementation is no problem but when I call PRogressHUD.show...
I get the error:
Undefined symbols for architecture x86_64:
xCode version: 10.1
Swift version: 4.2
Thanks for your help!
According to the ProgressHUD documentation, the recommended way install the library is through CocoaPods
CocoaPods is the recommended way to add ProgressHUD to your project.
Now I don't know how exactly did you add the library to the project, but trying to install it with CocoaPods will most probably solve your issue.
The rest of your implementation should remain intact.

`swift test` produces "symbol(s) not found for architecture x86_64" linker error

I'm currently trying to add support for the Swift Package Manager to a side-project I've been working on and am running into trouble when trying to run the unit tests I have for the project.
When running them within XCode, I have no problem building and running all of my unit tests; however, when I try to run my tests with the package manager using swift test, I get the following linker error:
ld: symbol(s) not found for architecture x86_64
<unknown>:0: error: link command failed with exit code 1 (use -v to see invocation)
I ended up figuring out a solution that I'm happy with. I've added a link to the PR here that fixed things, but the general solution was to create a new shared framework target that both my executable and test targets linked to!

deezer-ios adding static library

I'm trying to use the iOS SDK provided by Deezer to develop an iPhone application. I downloaded the framework here.
I started a new projet on Xcode (xcode 3.2.6), then I imported all the headers files (and the pics in Resources). Then I made right click on Frameworks and chose "add > add existing framework" and selected the "libDeezer.a" provided by deezer.
I wrote some code in my application delegate class, and when I try to build and run the project I got one warning and one error :
ld: warning: in /Users/.../deezer-ios-sdk-0.5 3/deezer-ios-0.5/libDeezer.a, missing required architecture i386 in file
Undefined symbols:
"_OBJC_CLASS_$_DeezerConnect", referenced from:
objc-class-ref-to-DeezerConnect in deezer5AppDelegate.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
How can I link the library to my project? Any ideas?
Double click on project target, and in the search path group, there is a attribute called Library Search path. please specify the path correctly.
if you have still doubt let me know , i will specify more
Are you building for simulator or device ?
The Deezer's iOS SDK is not working on simulator, but devices only.