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-8921] Building Apple Swift on ppc64le for ubuntu 16.04 #51427

Closed
swift-ci opened this issue Oct 5, 2018 · 8 comments
Closed

[SR-8921] Building Apple Swift on ppc64le for ubuntu 16.04 #51427

swift-ci opened this issue Oct 5, 2018 · 8 comments

Comments

@swift-ci
Copy link
Collaborator

@swift-ci swift-ci commented Oct 5, 2018

Previous ID SR-8921
Radar None
Original Reporter stamba (JIRA User)
Type Bug
Status Closed
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s
Labels Bug, Runtime
Assignee stamba (JIRA)
Priority Medium

md5: 19db618eaac80631729b1df346261283

Issue Description:

Hi,
We are trying to build Apple Swift on ppc64le Ubuntu16.04. We built it on ppc64le using a build script at the following link:-

https://github.com/ppc64le/build-scripts/blob/60b7885f4f0915a8671b3cfb86ddbb65f9b988a8/swift/swift41_ubuntu_16.04.sh

With this we were able to run the 'swiftc' and REPL environment for some basic "Hello World" type of code. However for complex codes, like import Foundation, it fails(probably due to Package manager issues). When we use "import Foundation" with swift, compile error occurs as below is seen:
(swift) import Foundation <REPL Input>:1:8: error: no such module 'Foundation' import Foundation ^

We are trying to build Swift 4.2(since Swift v4.1 has been released now and no further development is happening on this branch.) on Power8/LE (ppc64le) using the build-toolchain, in order to build the Swift package manager and other tools.

We are seeing a crash which is traceable till following function in HeapObject.cpp file:
static HeapObject *swift_retain(HeapObject *object) { SWIFT_RT_TRACK_INVOCATION(object, swift_retain); if (isValidPointerForNativeRetain(object)) object->refCounts.increment(1); return object; }

Beyond this debugging using simple print statements is tricky and the code flow is unclear. Breakpoints cannot be set since building code in debug mode is not possible as it runs out of resources and hangs.

Any help here would be greatly appreciated. Any more outputs, errors can be shared.
Looking forward to port Apple Swift on Ubuntu16.04.

Regards,

Sarvesh Tamba

@belkadan
Copy link
Contributor

@belkadan belkadan commented Oct 5, 2018

@swift-ci
Copy link
Collaborator Author

@swift-ci swift-ci commented Oct 8, 2018

Comment by Sarvesh Tamba (JIRA)

I tried to build Swift 4.2 in debug mode. I applied the patch mentioned in "#16425" for "stdlib/public/SwiftShims/System.h" as well. However, I am facing similar issues as reported above in "https://bugs.swift.org/browse/SR-7441" :-

— bootstrap: note: building runtime v4 target: PackageDescription4:
Compile Swift Module 'PackageDescription' (9 sources)
Link PackageDescription
— bootstrap: note: building self-hosted 'swift-build': env SWIFT_EXEC=/root/swift-source/Ninja-DebugAssert/swiftpm-linux-powerpc64le/powerpc64le-unknown-linux/debug/swiftc SWIFTPM_BUILD_DIR=/root/swift-source/Ninja-DebugAssert/swiftpm-linux-powerpc64le /root/swift-source/Ninja-DebugAssert/swiftpm-linux-powerpc64le/powerpc64le-unknown-linux/debug/swift-build-stage1 --disable-sandbox -Xlinker -rpath -Xlinker $ORIGIN/../lib/swift/linux -Xlinker -L -Xlinker /root/swift-source/Ninja-DebugAssert/foundation-linux-powerpc64le/Foundation -Xlinker -rpath -Xlinker /root/swift-source/Ninja-DebugAssert/foundation-linux-powerpc64le/Foundation -Xswiftc -I/root/swift-source/Ninja-DebugAssert/foundation-linux-powerpc64le/Foundation -Xswiftc -I/root/swift-source/Ninja-DebugAssert/foundation-linux-powerpc64le/Foundation/usr/lib/swift -Xlinker -L -Xlinker /root/swift-source/Ninja-DebugAssert/xctest-linux-powerpc64le -Xlinker -rpath -Xlinker /root/swift-source/Ninja-DebugAssert/xctest-linux-powerpc64le -Xswiftc -I/root/swift-source/Ninja-DebugAssert/xctest-linux-powerpc64le -Xlinker -L/root/swift-source/Ninja-DebugAssert/libdispatch-linux-powerpc64le/src/.libs -Xswiftc -I/root/swift-source/Ninja-DebugAssert/libdispatch-linux-powerpc64le/src -Xswiftc -I/root/swift-source/Ninja-DebugAssert/libdispatch-linux-powerpc64le/src/swift -Xswiftc -I/root/swift-source/swift-corelibs-libdispatch -Xcc -fblocks --build-tests
Fatal error: file /root/swift-source/swift/stdlib/public/core/Builtin.swift, line 466
Current stack trace:
0 libswiftCore.so 0x00003fffaaf67150 + 6517072
1 libswiftCore.so 0x00003fffaaf67040 swift_reportError + 56
2 libswiftCore.so 0x00003fffab073a90 swift_stdlib_reportFatalErrorInFile + 220
3 libswiftCore.so 0x00003fffaaab3160 + 1585504
4 libswiftCore.so 0x00003fffaaf4385c + 6371420
5 libswiftCore.so 0x00003fffaaab0e5c + 1576540
6 libswiftCore.so 0x00003fffaaf43904 + 6371588
7 libswiftCore.so 0x00003fffaaab0e80 StaticString.withUTF8Buffer(
:) + 800
8 libswiftCore.so 0x00003fffaaab2c90 + 1584272
9 libswiftCore.so 0x00003fffaaf436dc + 6371036
10 libswiftCore.so 0x00003fffaaab0e5c + 1576540
11 libswiftCore.so 0x00003fffaaf43784 + 6371204
12 libswiftCore.so 0x00003fffaaab0e80 StaticString.withUTF8Buffer(:) + 800
13 libswiftCore.so 0x00003fffaaab2aec + 1583852
14 libswiftCore.so 0x00003fffaae2ed0c + 5238028
15 libswiftCore.so 0x00003fffaaab0e5c + 1576540
16 libswiftCore.so 0x00003fffaae2edb4 + 5238196
17 libswiftCore.so 0x00003fffaaab0e80 StaticString.withUTF8Buffer
(:) + 800
18 libswiftCore.so 0x00003fffaaaafb30 fatalErrorMessage(:_:file:line🎏) + 404
19 libswiftCore.so 0x00003fffaaac2220 _bridgeObject(fromTagged:) + 308
20 libswiftCore.so 0x00003fffaad50900 _StringObject.init(taggedRawBits:) + 44
21 libswiftCore.so 0x00003fffaad40f50 StringObject.init(smallUTF8SecondWord:) + 356
22 libswiftCore.so 0x00003fffaaace8a0 StringGuts.init(:) + 56
23 libswiftCore.so 0x00003fffaabe3f90 static String.fromASCII(:) + 112
24 libswiftCore.so 0x00003fffaab38f30 + 2133808
25 libswiftCore.so 0x00003fffaab38a60 static String.fromWellFormedUTF8CodeUnitSequence(:repair:) + 60
26 libswiftCore.so 0x00003fffaab38a38 + 2132536
27 libswiftCore.so 0x00003fffaaf425e4 + 6366692
28 libswiftCore.so 0x00003fffaab38bcc + 2132940
29 libswiftCore.so 0x00003fffaaf426a0 + 6366880
30 libswiftCore.so 0x00003fffaab38c60 UnsafePointer.withMemoryRebound<A, B>(to:capacity:
:) + 152
31 libswiftCore.so 0x00003fffaab37aa8 + 2128552
32 libswiftCore.so 0x00003fffaab378e0 String.init(cString:) + 48
33 libswiftCore.so 0x00003fffaae292f0 + 5214960
34 libswiftCore.so 0x00003fffaae29360 + 5215072
35 libswiftCore.so 0x00003fffaaf3b370 + 6337392
36 libswiftCore.so 0x00003fffaaa6bdb0 Collection.map
(:) + 1640
37 libswiftCore.so 0x00003fffaae2916c + 5214572
38 libswiftCore.so 0x00003fffaafe33b0 + 7025584
39 libswiftCore.so 0x00003fffaafe32f0 + 7025392
40 libswiftCore.so 0x00003fffaafe328c + 7025292
41 libswiftCore.so 0x00003fffaafe2fa4 + 7024548
42 libstdc++.so.6 0x00003fffa98b2f00 __once_proxy + 52
43 libpthread.so.0 0x00003fffaa8f22f4 + 74484
44 libswiftCore.so 0x00003fffaafe3010 + 7024656
45 libswiftCore.so 0x00003fffaafe2e5c + 7024220
46 libswiftCore.so 0x00003fffaafe2d30 swift_once + 72
47 libswiftCore.so 0x00003fffaae29420 + 5215264
48 libswiftCore.so 0x00003fffaae29450 static CommandLine.arguments.getter + 32
49 swift-build-stage1 0x000000005ca102c0 + 328384
50 libc.so.6 0x00003fffa950309c + 143516
51 libc.so.6 0x00003fffa95031e0 __libc_start_main + 184
— bootstrap: error: build failed with exit status -5
utils/build-script: fatal error: command terminated with a non-zero exit status 1, aborting

@swift-ci
Copy link
Collaborator Author

@swift-ci swift-ci commented Oct 30, 2018

Comment by Sarvesh Tamba (JIRA)

Hi Team, any insights on the above errors?

@swift-ci
Copy link
Collaborator Author

@swift-ci swift-ci commented Nov 27, 2018

Comment by Sarvesh Tamba (JIRA)

On closer investigation, realised that the string implemetation has changed in Swift 4.2 from that in Swift 4.1 to a large extent.
The crash involves changes in String.swift besides the newly introduced StringGuts.swift and StringObject.swift files.

In the StringGuts.swift file there are comments such as "// FIXME: what about ppc64 and s390x?" indicating that the support for PowerPC(ppc64) might still be incomplete.

Can we confirm that the new string implementation in Swift 4.2 has complete support for PowerPC(ppc64)?

@swift-ci
Copy link
Collaborator Author

@swift-ci swift-ci commented Dec 5, 2018

Comment by Sarvesh Tamba (JIRA)

Built and verified Swift 5.0 master on PowerPC(powerpc64le). I was able to run all the samples given in swift.org/getting-started which confirms that 'swiftc'(Swift compiler), REPL environment and LLDB debugger are working correctly. Also package manager seems to work fine. Built a sample package using the ported Swift 5.0 binaries. More details in this bugs.swift.org/browse/SR-7441

1 similar comment
@swift-ci
Copy link
Collaborator Author

@swift-ci swift-ci commented Dec 5, 2018

Comment by Sarvesh Tamba (JIRA)

Built and verified Swift 5.0 master on PowerPC(powerpc64le). I was able to run all the samples given in swift.org/getting-started which confirms that 'swiftc'(Swift compiler), REPL environment and LLDB debugger are working correctly. Also package manager seems to work fine. Built a sample package using the ported Swift 5.0 binaries. More details in this bugs.swift.org/browse/SR-7441

@swift-ci
Copy link
Collaborator Author

@swift-ci swift-ci commented Jan 30, 2019

Comment by Sarvesh Tamba (JIRA)

Trying a clean build on the latest swift master branch. However I am facing the following issue:-

Linking /root/swift-source/build/buildbot_linux/swiftpm-linux-powerpc64le/.bootstrap/bin/swift-test
Linking /root/swift-source/build/buildbot_linux/swiftpm-linux-powerpc64le/.bootstrap/bin/swift-run
Linking /root/swift-source/build/buildbot_linux/swiftpm-linux-powerpc64le/.bootstrap/bin/swift-build
Linking /root/swift-source/build/buildbot_linux/swiftpm-linux-powerpc64le/.bootstrap/bin/swift-package
— bootstrap: note: building self-hosted 'swift-build': env SWIFT_EXEC=/root/swift-source/build/buildbot_linux/swiftpm-linux-powerpc64le/powerpc64le-unknown-linux/release/swiftc SWIFTPM_BUILD_DIR=/root/swift-source/build/buildbot_linux/swiftpm-linux-powerpc64le SWIFTPM_BOOTSTRAP=1 /root/swift-source/build/buildbot_linux/swiftpm-linux-powerpc64le/powerpc64le-unknown-linux/release/swift-build-stage1 --disable-sandbox -Xlinker -rpath -Xlinker $ORIGIN/../lib/swift/linux -Xswiftc -Xcc -Xswiftc -DSPM_BUILD_IDENT=e49bb01 -Xswiftc -I/root/swift-source/build/buildbot_linux/swiftpm-linux-powerpc64le/.bootstrap/lib/swift/linux/x86_64 -Xswiftc -Xcc -Xswiftc -F/root/swift-source/build/buildbot_linux/swiftpm-linux-powerpc64le/.bootstrap/lib/swift/linux/x86_64 -Xswiftc -I/root/swift-source/build/buildbot_linux/swiftpm-linux-powerpc64le/.bootstrap/lib/swift/linux/x86_64/dispatch -Xlinker -L/root/swift-source/build/buildbot_linux/swiftpm-linux-powerpc64le/.bootstrap/lib/swift/linux -Xlinker -rpath -Xlinker /root/swift-source/build/buildbot_linux/swiftpm-linux-powerpc64le/.bootstrap/lib/swift/linux -Xswiftc -I/root/swift-source/build/buildbot_linux/llbuild-linux-powerpc64le/products/llbuildSwift -Xswiftc -I/root/swift-source/llbuild/products/libllbuild/include -Xlinker -rpath -Xlinker $ORIGIN/../lib/swift/pm/llbuild -Xlinker -L/root/swift-source/build/buildbot_linux/llbuild-linux-powerpc64le/lib -Xlinker -rpath -Xlinker /root/swift-source/build/buildbot_linux/llbuild-linux-powerpc64le/lib -Xswiftc -enable-testing --configuration release --build-tests
/root/swift-source/build/buildbot_linux/swiftpm-linux-powerpc64le/powerpc64le-unknown-linux/release/swift-build-stage1: error while loading shared libraries: libicui18nswift.so.61: cannot open shared object file: No such file or directory
— bootstrap: error: build failed with exit status 127
Building the standard library for: swift-stdlib-linux-powerpc64le
Running Swift tests for: check-swift-all-linux-powerpc64le check-swift-all-optimize-linux-powerpc64le
./utils/build-script: fatal error: command terminated with a non-zero exit status 1, aborting
./utils/build-script: fatal error: command terminated with a non-zero exit status 1, aborting

This was working fine as recently as yesterday, only failing during testing step at the lldb-suite related test suite.

@belkadan Has anything changed in the code base recently which could be relating to this error?

@swift-ci
Copy link
Collaborator Author

@swift-ci swift-ci commented Jan 30, 2019

Comment by Sarvesh Tamba (JIRA)

Realized this SR is closed. Opened a new one - SR-9808.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants