Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Link Realm within a dynamic library ends in "ld: framework not found Realm for architecture i386"

I've created a custom dynamic library (let's call in LogLibrary.framework) in Swift 2.1. No I'd like to link the Realm.framework and RealmSwift.framework with it.

I did follow the installation instructions provided on https://realm.io/docs/swift/latest/.

These steps are:

  • Link Binary with Libraries (Realm.framework and RealmSwift.framework added)
  • Build Phase -> Add copy files Phase -> Destination "Frameworks"
  • Run Script Phase -> bash "${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/Realm.framework/strip-frameworks.sh"

enter image description here

Unfortionally, if l link the LogLibrary.framework in my sample Application, I always get the following compile error:

ld: framework not found Realm for architecture i386

I did not set any additional linker flags in the sample Application.

enter image description here

However, It works if I also link the Realm.framework and RealmSwift.framework in the sample Application - but that's not what I want, because they are already linked within the LogLibrary.framework

Any Ideas how I can get rid of the compile error? Sample Project: https://github.com/sehdich/RealmLinkError.git

like image 664
charlyatwork Avatar asked Dec 03 '25 09:12

charlyatwork


1 Answers

You should link Realm and RealmSwift.framework to PhotoApp target too. Because those frameworks are not static libraries. They are linked dynamically. So they are still specified to link app's target and included in app bundle.

enter image description here

like image 187
kishikawa katsumi Avatar answered Dec 06 '25 06:12

kishikawa katsumi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!