Skip to content

SR-8876: Always build libicu on Linux #19860

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

Merged
merged 3 commits into from
Nov 2, 2018
Merged

Conversation

spevans
Copy link
Contributor

@spevans spevans commented Oct 12, 2018

  • Uses version 61.1 from ICU Github unicode-org/icu repository.

  • Updates mixin_linux_installation to add liblic option.

  • Use -j when building libicu.

  • Resolves SR-8876.

  • build-script-impl updates to make all tests work.

Also resolves:

SR-5618: libicu compilation should happen in parallel respecting -j.

Note, ICU 62.1 currently causes a regression with swift-corelibs-foundation on Linux which will be looked at separately once this PR is merged.

@spevans
Copy link
Contributor Author

spevans commented Oct 12, 2018

@swift-ci test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 739ce893a64eaa62939ad5fb380f411c21911667

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 739ce893a64eaa62939ad5fb380f411c21911667

@parkera
Copy link
Contributor

parkera commented Oct 12, 2018

This is great!

@spevans
Copy link
Contributor Author

spevans commented Oct 12, 2018

@swift-ci test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 739ce893a64eaa62939ad5fb380f411c21911667

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 739ce893a64eaa62939ad5fb380f411c21911667

@milseman
Copy link
Member

Will this change to update-checkout cause it to be cloned on Darwin as well, and if so can we make it only do so on Linux?

@spevans
Copy link
Contributor Author

spevans commented Oct 12, 2018

@milseman Currently it will clone on all platforms, I will fix update-checkout to allow specifying platforms in utils/update_checkout/update-checkout-config.json

@spevans
Copy link
Contributor Author

spevans commented Oct 13, 2018

@swift-ci test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - ebffe7b672c0896f63511a00a80ad25b62169db0

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - ebffe7b672c0896f63511a00a80ad25b62169db0

@spevans
Copy link
Contributor Author

spevans commented Oct 13, 2018

@swift-ci test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 9d2f108bcc6cc65ac073b503f1b590bd78c69411

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 9d2f108bcc6cc65ac073b503f1b590bd78c69411

@spevans
Copy link
Contributor Author

spevans commented Oct 14, 2018

@swift-ci test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - fe08b5c34d04b21f7a455760d5f258db5ba60c19

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - fe08b5c34d04b21f7a455760d5f258db5ba60c19

@spevans
Copy link
Contributor Author

spevans commented Oct 15, 2018

cc @millenomi I added the change to namespace the symbols with a _swift suffix and the library files have swift appended to them using the ICU configure option --with-library-suffix=swift.

@spevans spevans requested a review from shahmishal October 15, 2018 07:34
@millenomi
Copy link
Contributor

@shahmishal who could review this?

@tkremenek
Copy link
Member

As this is adding a new library dependency, this falls under:

https://swift.org/contributing/#adding-external-library-dependencies

I'll need to go review this for any legal concerns, but this is on me.

@spevans
Copy link
Contributor Author

spevans commented Oct 26, 2018

@tkremenek Have you had a chance to look at this? thanks

@spevans
Copy link
Contributor Author

spevans commented Oct 28, 2018

@swift-ci test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 26b1b59478d0a1c49c28e0777acff76a743723be

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 26b1b59478d0a1c49c28e0777acff76a743723be

@tkremenek
Copy link
Member

Sorry for the delay here; I should have an answer shortly.

@tkremenek
Copy link
Member

OK, I got legal confirmation that this is OK. There is no problem with statically linking in ICU into the Standard Library in this way; ICU's license clearly allows this.

However, we should also include the ICU license in the distribution of Swift when we do this, as the license apples to the ICU data files that will now need to be bundled with the Standard Library. Does this PR do that?

- Uses version 61.1 from ICU Github unicode-org/icu repository.

- Updates mixin_linux_installation to add libicu option.

- Use -j when building libicu.

- When buiding ICU, use --with-library-suffix=swift
  This suffixes the ICU symbols with _swift.

  The libaries are now named libicuucswift, libicui18nswift
  and libicudataswift.

- Add the contents of uconfig.h.prepend into uconfig.h. This avoids
  passing the renaming CFLAGS to swift and swift-corelibs-foundation.

Also resolves:

SR-5618: libicu compilation should happen in parallel respecting -j.
- Update --reset-to-remote to support tags.

- Add optional platform entry to a repository. This allows specifying
  which platforms a repo should be checked out on.
- Copy ICU licence into final install.
@spevans
Copy link
Contributor Author

spevans commented Nov 2, 2018

Ive updated the PR to copy the ICU license into the distribution. It gets copied into usr/share/icuswift/61.1/LICENSE

@spevans
Copy link
Contributor Author

spevans commented Nov 2, 2018

Please test with the following PRs:
swiftlang/swift-corelibs-foundation#1744

@swift-ci please test

@swift-ci
Copy link
Contributor

swift-ci commented Nov 2, 2018

Build failed
Swift Test OS X Platform
Git Sha - 839afef7ac82ed752417616fbebc2aaaa71bb4e9

@swift-ci
Copy link
Contributor

swift-ci commented Nov 2, 2018

Build failed
Swift Test Linux Platform
Git Sha - 839afef7ac82ed752417616fbebc2aaaa71bb4e9

@tkremenek tkremenek merged commit 7af28e8 into swiftlang:master Nov 2, 2018
@milseman
Copy link
Member

milseman commented Nov 4, 2018

🍾 Congrats @spevans

@shahmishal
Copy link
Member

@spevans we are seeing this issue with recent development toolchain https://bugs.swift.org/browse/SR-9251. It might be related to this PR changes.

@millenomi
Copy link
Contributor

@shahmishal Do you know if we’re distributing these binaries? If not, can we add them to the toolchain?

@millenomi
Copy link
Contributor

Also, is there any documentation of the installation setup?

@shahmishal
Copy link
Member

@millenomi Yes we are distributing them on https://swift.org/download/#snapshots

@shahmishal
Copy link
Member

Let me know if you need help installing the toolchain, you can also find the info on https://swift.org/download/#using-downloads

@millenomi
Copy link
Contributor

@shahmishal I meant whether we were distributing specifically the libicu*swift binaries, which apparently we are:

millenomi $ find /Users/millenomi/Downloads/swift-DEVELOPMENT-SNAPSHOT-2018-11-15-a-ubuntu18.04 -name libicu\*
/Users/millenomi/Downloads/swift-DEVELOPMENT-SNAPSHOT-2018-11-15-a-ubuntu18.04/usr/lib/swift_static/linux/libicuucswift.a
/Users/millenomi/Downloads/swift-DEVELOPMENT-SNAPSHOT-2018-11-15-a-ubuntu18.04/usr/lib/swift_static/linux/libicui18nswift.a
/Users/millenomi/Downloads/swift-DEVELOPMENT-SNAPSHOT-2018-11-15-a-ubuntu18.04/usr/lib/swift_static/linux/libicudataswift.a
/Users/millenomi/Downloads/swift-DEVELOPMENT-SNAPSHOT-2018-11-15-a-ubuntu18.04/usr/lib/swift/linux/libicui18nswift.so
/Users/millenomi/Downloads/swift-DEVELOPMENT-SNAPSHOT-2018-11-15-a-ubuntu18.04/usr/lib/swift/linux/libicudataswift.so.61
/Users/millenomi/Downloads/swift-DEVELOPMENT-SNAPSHOT-2018-11-15-a-ubuntu18.04/usr/lib/swift/linux/libicuucswift.so.61.1
/Users/millenomi/Downloads/swift-DEVELOPMENT-SNAPSHOT-2018-11-15-a-ubuntu18.04/usr/lib/swift/linux/libicuucswift.so.61
/Users/millenomi/Downloads/swift-DEVELOPMENT-SNAPSHOT-2018-11-15-a-ubuntu18.04/usr/lib/swift/linux/libicudataswift.so
/Users/millenomi/Downloads/swift-DEVELOPMENT-SNAPSHOT-2018-11-15-a-ubuntu18.04/usr/lib/swift/linux/libicui18nswift.so.61.1
/Users/millenomi/Downloads/swift-DEVELOPMENT-SNAPSHOT-2018-11-15-a-ubuntu18.04/usr/lib/swift/linux/libicudataswift.so.61.1
/Users/millenomi/Downloads/swift-DEVELOPMENT-SNAPSHOT-2018-11-15-a-ubuntu18.04/usr/lib/swift/linux/libicuucswift.so
/Users/millenomi/Downloads/swift-DEVELOPMENT-SNAPSHOT-2018-11-15-a-ubuntu18.04/usr/lib/swift/linux/libicui18nswift.so.61

@spevans Can you investigate? Perhaps the final RPATHs are incorrect?

@spevans
Copy link
Contributor Author

spevans commented Nov 16, 2018

@millenomi This should have been fixed by swiftlang/swift-corelibs-foundation#1769 but it is not working correctly. Im taking a look

@spevans
Copy link
Contributor Author

spevans commented Nov 16, 2018

Looks like there are 2 libFoundation.so files in the tar:

$ find swift-DEVELOPMENT-SNAPSHOT-2018-11-15-a-ubuntu18.04/usr/lib -name libFoundation.so
swift-DEVELOPMENT-SNAPSHOT-2018-11-15-a-ubuntu18.04/usr/lib/swift/linux/x86_64/libFoundation.so
swift-DEVELOPMENT-SNAPSHOT-2018-11-15-a-ubuntu18.04/usr/lib/swift/linux/libFoundation.so

And the one in the x86_64 directory is being loaded:

$ ldd hello|grep libFoundation
	libFoundation.so => /home/spse/swift-DEVELOPMENT-SNAPSHOT-2018-11-15-a-ubuntu18.04/usr/lib/swift/linux/x86_64/libFoundation.so (0x00007f07ae29d000)

so this is setting the $ORIGIN to the x86_64 subdirectory and then failing to find libicu*

$ ./hello
./hello: error while loading shared libraries: libicuucswift.so.61: cannot open shared object file: No such file or directory

Deleting this extra libFoundation.so makes it fall back to the one in usr/lib/swift/linux and everything works:

$ rm /home/spse/swift-DEVELOPMENT-SNAPSHOT-2018-11-15-a-ubuntu18.04/usr/lib/swift/linux/x86_64/libFoundation.so
ubuntu1804:~ spse$ ldd hello|grep libFoundation
	libFoundation.so => /home/spse/swift-DEVELOPMENT-SNAPSHOT-2018-11-15-a-ubuntu18.04/usr/lib/swift/linux/libFoundation.so (0x00007f5986fcc000)
ubuntu1804:~ spse$ ldd hello|grep libicu.*61
	libicuucswift.so.61 => /home/spse/swift-DEVELOPMENT-SNAPSHOT-2018-11-15-a-ubuntu18.04/usr/lib/swift/linux/libicuucswift.so.61 (0x00007f393c962000)
	libicui18nswift.so.61 => /home/spse/swift-DEVELOPMENT-SNAPSHOT-2018-11-15-a-ubuntu18.04/usr/lib/swift/linux/libicui18nswift.so.61 (0x00007f393c46c000)
	libicudataswift.so.61 => /home/spse/swift-DEVELOPMENT-SNAPSHOT-2018-11-15-a-ubuntu18.04/usr/lib/swift/linux/libicudataswift.so.61 (0x00007f393a0f7000)
ubuntu1804:~ spse$ ./hello
Hello

I'll see if I can set see what is adding the libFoundation.so into the x86_64 directory and remove it as no other .so libraries are stored in there. However I still cant work out why the x86_64 directory is preferred over its parent looking at the RUNPATHs of all the other libraries.

@spevans
Copy link
Contributor Author

spevans commented Nov 16, 2018

Hopefully this second fix to solve the issue: swiftlang/swift-corelibs-foundation#1776

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants