swiftlang / swift

The Swift Programming Language
https://swift.org
Apache License 2.0
67.61k stars 10.37k forks source link

[SR-1359] Android: ICU should be statically linked (and patch to make static linking possible) #43968

Open swift-ci opened 8 years ago

swift-ci commented 8 years ago
Previous ID SR-1359
Radar None
Original Reporter ewmailing (JIRA User)
Type Improvement
Additional Detail from JIRA | | | |------------------|-----------------| |Votes | 1 | |Component/s | Compiler | |Labels | Improvement, Android, ICU | |Assignee | jblatecky (JIRA) | |Priority | Medium | md5: 57cffc55e2d8137ac432f00b13ecc676

Issue Description:

This merges with my prior FindICU.cmake general patch which allow for ICU to be
static libraries. (See https://bugs.swift.org/browse/SR-1358)

This change is needed for Android because dynamically linking libicu is
not reliable on Android. There are multiple problems:

So static linking ICU solves all these problems.

But additionally, the issue of linking the C++ standard library becomes
an issue. Again, there are similar issues with dynamically linking
because Android doesn't provide a pre-installed system-wide one we can
rely on. Additionally:

So static linking solves these problems too.

Two new switches are needed to build for Android:
--android-icu-data-include /path/to/include
--android-icu-data /path/to/libicudata

My patch is here:
https://github.com/ewmailing/swift/commit/8af36d6c724abc52ba35fcd096acb571c5af0875

swift-ci commented 7 years ago

Comment by Amr Aboelela (JIRA)

I tried to link it statically to libswiftCore.so but it didn't work well.

finagolfin commented 2 years ago

The libicu dependency of the standard library was removed last month:

https://github.com/apple/swift/pull/40340