On 9/19/16, Dave Abrahams via swift-dev <swift-dev@swift.org> wrote:
> on Mon Sep 19 2016, Eric Wing <swift-dev-AT-swift.org> wrote:
>> I've been trying to build Swift for Linux with --installable-package
>> to build a swift-package.tar.gz that I can install to another Linux
>> machine.
>> When I extract my package on the other machine, and try either
>> compiling a simple print("hello world") program either with swiftc, or
>> doing this in the swift repl, I get the error message:
>> opening import file for module 'SwiftShims': No such file or directory
>> I don't seem to get this problem on the machine I built Swift on.
>> I didn't have this problem with Swift 2.3, but I'm always getting it
>> now with Swift 3.
>> What am I doing wrong?
> There may be a bug in the build-script.  FWIW, the instructions in the
> build-script seem to indicate the correct syntax is
> installable_package="/tmp/xcode-xyz-root.tar.gz" but that's probably not
> the issue.  It seems more likely that the code building the tarball is
> leaving out the SwiftShims module.
> --
> -Dave

I did more digging on this. I believe the Swift build-script is
correct, and the problem has something to do with my environment.

I am using something called Steam-Runtime as my build environment.
Essentially, it uses schroot to create a mini Linux environment inside
your Linux distro which comes supplied with its own version of shared
libraries. The idea is that anybody who builds in this environment can
ship a Linux binary that is guaranteed to work in any Steam
environment. Steam-Runtime is derived from Ubuntu 12.04, so as a
side-effect, because the libraries and GLIBC are kind of old, the
binaries produced in Steam-Runtime generally work on most modern Linux
distros (if you are careful about dependencies).

So I've been building a Swift compiler that works on most Linux
distros, without having to make separate builds for each distro and
version. Then compiling Swift programs inside Steam-Runtime will also
produce binaries that work on most Linux distros.

This worked fine for me before Swift 3, but now with 3.0, there seems
to be something different now. I discovered that if I run my built
Swift compiler inside Steam-Runtime on another computer it works. But
if I do not run inside Steam-Runtime, then I get the 'SwiftShims': no
such file or directory at runtime. (This used to work before 3.0.) To
be clear, swift and swiftc actually do run in this case which means
all the symbols in all the dependent dynamic libraries resolved on my
system (without Steam-Runtime). The Swift REPL starts correctly and
shows me a prompt. It is only when I try to do some code do I get the
'SwiftShims' message. So the strange part is why it can't find the
SwiftShims stuff.

Can you tell me what file(s) Swift looking for when it produces this
error?  What does it use to determine the search path (hardcoded at
build time?, relative to something?, environmental variable?). And is
there a way to print out debug information of what search paths it is

swift-dev mailing list

Reply via email to