colemancda / Pedido

Open Source suite of apps and frameworks for restaurants, powered by NetworkObjects
MIT License
12 stars 5 forks source link

Archiving command line tool #4

Open danthorpe opened 8 years ago

danthorpe commented 8 years ago

I know this is a little bit old... but following on from this blog post: https://colemancda.github.io/programming/2015/02/12/embedded-swift-frameworks-osx-command-line-tools/

This all works fine for running the command line tool from within Xcode. However, how can the tool be packaged up into a single binary which can then be run from the command line? For example:

  1. Select the bundle scheme
  2. Run Archive from Xcode's Product menu
  3. Export the Build Products from within Xcode Organizer.
  4. Manually $ chmod a+x MyTool

After doing this, and then running the binary in Terminal will give:

dyld: Library not loaded: @rpath/MyToolFramework.framework/Versions/A/MyToolFramework Referenced from: /Users/daniel/Desktop/MyToolBundle 2016-06-28 23-50-40/Products/usr/local/bin/./MyTool Reason: image not found Trace/BPT trap: 5

Any ideas on how to make this work - everything works okay running from within Xcode.

AJamesPhillips commented 8 years ago

Have you had any success? I don't know if it's related but I have the same error and on debugging in XCode it appears to be an intermittent error from trying to access a property of of a CoreData object which returns EXC_1386_BPT

danthorpe commented 8 years ago

Hi @AJamesPhillips - no, I've not been able to progress further down this route. At the moment, I'm holding on to hope that SwiftPM will solve this for me.

colemancda commented 8 years ago

I saw a Twitter post that showed that WebKit is compiled like this, gonna find it.

colemancda commented 8 years ago

Here http://promisekit.org/news/2016/08/Multiplatform-Single-Scheme-Xcode-Projects/ An Apple engineer confirmed they use this method internally.