Fast shared libraries statically linked for command line applications?

I am trying to use the external environment with my Swift application for Mac OS X. The external environment also uses Swift, and therefore depends on shared Swift libraries (for example, libswiftCore.dylib). This is confirmed by the team.

$ otool -L PromiseKit.framework/PromiseKit
PromiseKit.framework/PromiseKit:
    ...
    @rpath/libswiftCore.dylib (compatibility version 0.0.0, current version 0.0.0)

Search @rpathI see

$ otool -l PromiseKit.framework/PromiseKit
      ...
      cmd LC_RPATH
  cmdsize 40
     path @executable_path/Frameworks (offset 12)

So, at runtime, I expect it @rpathto resolve@executable_path/Frameworks

Problem

I get a runtime error

dyld: Library not loaded: @rpath/libswiftCore.dylib
  Referenced from: .../PromiseKit.framework/Versions/A/PromiseKit
  Reason: image not found

In the folder containing my embedded executable, I do not see the folder Frameworks.

Unsuccessful attempts to fix it

I tried installing EMBEDDED_CONTENT_CONTAINS_SWIFTon YESfor my application, but this does not create a folder yet Frameworks.

Frameworks Swift ( /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx). ​​ , , :

objc[64445]: Class _TtC10Foundation15NSSimpleCString is implemented in both
   .../Frameworks/libswiftFoundation.dylib and
   .../myApp.
   One of the two will be used. Which one is undefined.

, Swift ? , , XCode Frameworks?

, , . , Frameworks .app Swift

+4
1

, :

  • Frameworks ()
  • ,
  • ,

, :

"Embedded Content Contains Swift Code" = Yes

, Bundle Frameworks, :

"Embedded Content Contains Swift Code" = Yes

, LD_RUNPATH_SEARCH_PATHS:

. :

@executable_path/PromiseKit.framework/Versions/A/Frameworks

, Xcode /A/Framework Frameworks, , .

. Xcode:

$(DEVELOPER_DIR)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx

Xcode, , . .

. , :

@executable_path

, bin/, lib/:

@executable_path/../lib

, . , , Xcode.


, :

"Embedded Content Contains Swift Code" = Yes

Xcode :

2015-06-04 00:56:28.816 swift-stdlib-tool[5208:2453424] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSFileManager copyItemAtPath:toPath:error:]: destination path is nil'
*** First throw call stack:
(
    0   CoreFoundation                      0x00007fff8ee4503c __exceptionPreprocess + 172
    1   libobjc.A.dylib                     0x00007fff89f1c76e objc_exception_throw + 43
    2   CoreFoundation                      0x00007fff8ee44eed +[NSException raise:format:] + 205
    3   Foundation                          0x00007fff926569b7 -[NSFileManager copyItemAtPath:toPath:error:] + 185
    4   swift-stdlib-tool                   0x000000010526b485 _Z13copyLibrariesP8NSStringS0_P19NSMutableDictionary + 853
    5   swift-stdlib-tool                   0x000000010526c60b main + 3915
    6   libdyld.dylib                       0x00007fff97d785c9 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Copying libswiftCore.dylib from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx to (null)
+4

All Articles