OS X command line project can't find RxAtomic framework

I’m attempting to compile an OSX command line project with RxSwift. The project has nothing in it, except what is auto-generated by xcode. The RxAtomic framework can not be found at run time.

dyld: Library not loaded: @rpath/libswiftAppKit.dylib
Referenced from: /Users/user1/Library/Developer/Xcode/DerivedData/CommandLine_Project-bwkerycnadvzcsaxraloxwknylzq/Build/Products/Debug/RxSwift.framework/Versions/A/RxSwift
Reason: image not found

What is the correct way to configure this type of project? My Podfile is simple:

use_frameworks!

target ‘CommandLine_Project’ do
pod ‘RxSwift’, ‘4.4.0’
end

Try with 4.4.1, I heard there was some issue with the versioning of the libs in the previous release

Changed to 4.4.1, same problem

I am not sure what the prolem might be but have a look at the chapter on Schedulers - I remember the example project in that chapter is a command line tool so you might want to look into its setup to see if there is anything special to make it work.

I took the Podfile from the schedulers chapter and I only changed the target name to my project and otherwise left the Podfile identical. Then with nothing in my command line tool project but the default code, I ran the project and got the same error. This is why I am asking how to configure this type of project. The scheduler project works and mine does not. What am I missing?

This is a copy of the Scheduler chapter Podfile:

use_frameworks!

target ‘Schedulers’ do
pod ‘RxSwift’, ‘4.0.0’
end

post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings[‘CONFIGURATION_BUILD_DIR’] = ‘$PODS_CONFIGURATION_BUILD_DIR’
end
end
end

I found the problem. This is the sort of thing that makes me hate writing software!

Under project “build settings”, “Other Linker Flags”, add:

-rpath
$DT_TOOLCHAIN_DIR/usr/lib/swift/macosx/

The next question is, what does this code from the Podfile actually do to the project, because it is necessary to make the project run:

post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings[‘CONFIGURATION_BUILD_DIR’] = ‘$PODS_CONFIGURATION_BUILD_DIR’
end
end
end

ANSWER:

This code changes the value at:
Pods → Targets → RxAtomic(and RxSwift) → Build Settings → Per-configuration Build Products Path → Debug(and Release)

to
${PODS_CONFIGURATION_BUILD_DIR}

That’s it. It’s all “build settings” issues in various targets through the workspace.

Update for March 5, 2019

The situation has changed.

  • Same Xcode version 10B61
  • Create a command line tool project in Xcode. I named mine “CLT”
  • Create and install this Podfile:
    target ‘CLT’ do
    use_frameworks!
    pod ‘RxSwift’
    end
  • import RxSwift in main.swift
  • run
  • crash:
    dyld: Library not loaded: @rpath/RxAtomic.framework/Versions/A/RxAtomic
    Referenced from: /Users/userXYZ/Library/Developer/Xcode/DerivedData/CLT-fcpegvkpwcnbgkahumvrvwssxqnk/Build/Products/Debug/CLT
    Reason: image not found
  • work around:
    in project CLT → Targets → CLT → Build Settings → Runpath Search Paths
    add two entries:
    @executable_path/RxAtomic’
    @executable_path/RxSwift’
    in Pods → Targets → RxSwift → Build Settings → Always Embed Swift Standard Libraries → YES

Now CLT will run.

@evs718 Do you still have issues with this?

This topic was automatically closed after 166 days. New replies are no longer allowed.