Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-23] Build fails on Ubuntu 14.04.1 -> error: opening ... 'SwiftShims': No such file #42646

Open
swift-ci opened this issue Dec 3, 2015 · 19 comments
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior.

Comments

@swift-ci
Copy link
Collaborator

swift-ci commented Dec 3, 2015

Previous ID SR-23
Radar None
Original Reporter manyoso (JIRA User)
Type Bug

Attachment: Download

Environment

apple/swift (master)> uname -a
Linux atreat-thinkpad 3.16.0-38-generic #52~14.04.1-Ubuntu SMP Fri May 8 09:43:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

Following the instructions on README.md with new clones of all repos...

Additional Detail from JIRA
Votes 5
Component/s
Labels Bug
Assignee @bitjammer
Priority Medium

md5: e8eced68282d2665cd7e220f9f5f2b15

is duplicated by:

  • SR-333 Compiling hello world fails on ARM Linux

Issue Description:

apple/swift (master)> uname -a
Linux atreat-thinkpad 3.16.0-38-generic #52~14.04.1-Ubuntu SMP Fri May 8 09:43:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

Compiling /home/atreat/dev/personal/apple/build/Ninja-DebugAssert/swift-linux-x86_64/stdlib/public/core/linux/x86_64/Swift.o

...

/home/atreat/dev/personal/apple/swift/stdlib/public/core/ArrayBody.swift:18:8: error: opening import file for module 'SwiftShims': No such file or directory
import SwiftShims
^
ninja: build stopped: subcommand failed.
./utils/build-script: command terminated with a non-zero exit status 1, aborting

I've attached the full compile line and error

@swift-ci
Copy link
Collaborator Author

Comment by Peter Kunze (JIRA)

I have the same problem, but on a Gentoo system.
Followed the build instructions and during while Swift is being build, the same error occurs.

Let me know, if I shall provide the complete build log.
Thanks!

@swift-ci
Copy link
Collaborator Author

Comment by Massimiliano (JIRA)

Same issue on OpenSUSE leap 42.1!

Let me know
Tks!

@bitjammer
Copy link
Member

manyoso (JIRA User) tolotos (JIRA User) alcester (JIRA User) Can you please provide the exact build-script invocation you used to build on your system?

@swift-ci
Copy link
Collaborator Author

Comment by Peter Kunze (JIRA)

David Farler
Thank you for looking into this.

As a start, I just entered
swift/utils/build-script

I tried
swift/utils/build-script -R
as well, with the same result.

For the first case, I am going to attach the build log.

@swift-ci
Copy link
Collaborator Author

Comment by Massimiliano (JIRA)

I tried
swift/utils/build-script -R -t
and I got this error.

I tried
swift/utils/build-script
without params but memory consumption is too high and I had to kill the process

So I tried make compilation instead ninja this way:

swift/utils/build-script -m -R -t

..but no luck...still same error

/home/VALUECUBE/fazzini/Programs/apple/swift/stdlib/public/core/ArrayBody.swift:18:8: error: opening import file for module 'SwiftShims': No such file or directory
import SwiftShims
^
stdlib/public/core/CMakeFiles/add_custom_command_target-09e8b8e037bba98529ab34dac3edc7ef-Swift.o.dir/build.make:169: recipe for target 'stdlib/public/core/linux/x86_64/Swift.o' failed
gmake[2]: *** [stdlib/public/core/linux/x86_64/Swift.o] Error 1
CMakeFiles/Makefile2:2663: recipe for target 'stdlib/public/core/CMakeFiles/add_custom_command_target-09e8b8e037bba98529ab34dac3edc7ef-Swift.o.dir/all' failed
gmake[1]: *** [stdlib/public/core/CMakeFiles/add_custom_command_target-09e8b8e037bba98529ab34dac3edc7ef-Swift.o.dir/all] Error 2
Makefile:105: recipe for target 'all' failed
gmake: *** [all] Error 2

@hpux735
Copy link
Contributor

hpux735 commented Dec 23, 2015

I'm working with someone that is having trouble with the ARM port I'm working on. They filed a potentially duplicate bug (SR-333). We've done some trouble shooting at github as well, here: #439 (comment)

@swift-ci
Copy link
Collaborator Author

Comment by Massimiliano (JIRA)

Hi,

I tried to trace "swift" during compilation and i found that is looking for SwiftShims.swiftmodule and SwiftShims.swiftdoc in

build/Ninja-ReleaseAssert/swift-linux-x86_64/./lib/swift/linux/x86_64

but these file are not present in this position.

@swift-ci
Copy link
Collaborator Author

Comment by Darren Mo (JIRA)

I have this problem when compiling on Ubuntu 12.04. Anybody find a workaround yet? Or any more info about the issue?

@swift-ci
Copy link
Collaborator Author

Comment by Darren Mo (JIRA)

Okay guys and gals…

The culprit is an equality check between an std::error_code and an std::error_condition.

Here is the relevant code:

if (std::error_code err = findModule(Ctx, moduleID, moduleInputBuffer,
                                     moduleDocInputBuffer,
                                     isFramework)) {
  if (err != std::errc::no_such_file_or_directory) {
    Ctx.Diags.diagnose(moduleID.second, diag::sema_opening_import,
                       moduleID.first, err.message());
  }

  return nullptr;
}

As you can see, we are trying to load a module (this file deals with finding and loading swiftmodule files). Not every module is a swiftmodule (e.g. SwiftShims), so no_such_file_or_directory errors are expected and, rightly, ignored.

However, on some systems, even if err represents a no_such_file_or_directory error, the if condition passes, causing the program to stop and spit out an error. How can the inequality check pass when they are clearly equal?

Well it turns out that libstdc+\.so.6.0.21 introduced ABI-breaking changes that are incompatible with GCC versions below 5.x. So for example, if you have GCC 4.9 and libstdc+.so.6.0.21, you will fail. More details here and here.

Judging from the above links, it looks like this breaking behaviour isn’t going to change, so we just have to deal with it. Now… what do you guys think the best way to deal with this is? Should we just tell everyone to make sure they have compatible GCC and libstdc++ packages? Put a warning in the build script?

This also impacts people who use the prebuilt binaries. If they have a libstdc++ binary that is incompatible with the GCC used to build the compiler, they are screwed. What do we do?

@swift-ci
Copy link
Collaborator Author

Comment by Darren Mo (JIRA)

Passing back to @bitjammer.

@belkadan
Copy link
Contributor

cc @gribozavr.

(BTW, great detective work, Darren.)

@swift-ci
Copy link
Collaborator Author

Comment by Paulo Pinto (JIRA)

Just found this issue while trying to find a solution for not being able to use Swift on Ubuntu.

Is there a way for those unfortunate Ubuntu users like myself to get Swift compiler working?

Not sure if downloading the source code and hacking the _findModule() _comparison is the way to go.

@swift-ci
Copy link
Collaborator Author

Comment by Darren Mo (JIRA)

pjmlp (JIRA User), if you are on 14.04 or 15.10 and have all the necessary dependencies, then you can just download the source and compile with clang+gcc5. This way, the compiler version matches your libstdc++.so.

@swift-ci
Copy link
Collaborator Author

Comment by Paulo Pinto (JIRA)

Darren Mo, my point was more into the direction of a solution that would help all LTS users, not just me.

Currently I have my humble core duo going through an hourly long build of the whole Swift toolchain and will have to do it for every release I wish to update to, as well as any other LTS user with the same issue being discussed on this Jira issue.

@swift-ci
Copy link
Collaborator Author

Comment by Darren Mo (JIRA)

Oh I see, pjmlp (JIRA User). I wonder if we could include both gcc4-built binaries and gcc5-built binaries and have some sort of dynamic selection between the two based on the system’s libstdc++.so version.

@swift-ci
Copy link
Collaborator Author

Comment by Paulo Pinto (JIRA)

I can at least offer my system to test a possible binary solution, I already had to interrupt the build a few times as core duo with 4GB doesn't seem good enough to compile Swift in a timely manner (each attempt was killed after > 2h build time).

@swift-ci
Copy link
Collaborator Author

Comment by Darren Mo (JIRA)

Are you building in debug or release mode? Release mode (--release) is significantly faster.

@swift-ci
Copy link
Collaborator Author

Comment by Tsuzuki Tsuchiya (JIRA)

If I add the follonwing repository on Ubuntu 14.04, this error occurs....
https://launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/test

@Dante-Broggi
Copy link
Contributor

Is this resolved, or no longer valid? If either, this should be closed.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior.
Projects
None yet
Development

No branches or pull requests

5 participants