6
SwiftをインストールしていないコンピュータでコンパイルしたSwiftスクリプトを実行したいと思います。しかし、デフォルトでSwift Compilerは動的リンクライブラリを使用しているようです。 これらのライブラリを静的に含めることは可能ですか?ドッカーを使用して再現するSwiftをSwiftコアライブラリでコンパイル
ステップ:
[email protected]:~# docker run -it swiftdocker/swift
[email protected]:/# swift --version
Swift version 3.0-dev (LLVM dffa09ffd8, Clang 9f0d189820, Swift 1c720b8f84)
Target: x86_64-unknown-linux-gnu
[email protected]:/# echo 'print("Hello, world")' > helloworld.swift
[email protected]:/# swiftc helloworld.swift
[email protected]:/# ./helloworld
Hello, world
[email protected]:/# exit
exit
[email protected]:~# docker cp 16974ad4edb1:/helloworld .
[email protected]:~# file helloworld
helloworld: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=c4d42f6185b3d53ecf2dfb0c386263c17cb34675, not stripped
[email protected]:~# ./helloworld
./helloworld: error while loading shared libraries: libswiftCore.so: cannot open shared object file: No such file or directory
そうでない、すなわち、(https://github.com/apple/swift/commit/d7f4d4c12beb0159dc7c537bbe846aa9e743900c)DEVELOPMENT-SNAPSHOT-2016年5月9日-Aからのみ入手可能]このフラグがあることが注目に値します以前の3.0プレビューまたは2.x RELEASE。 – sas
@sasが既に述べたように、これはswift 2.3のツールチェーンでは機能しません:( – Ben