-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Android: fix ABI triple detection, disable C++ modules flags, and bring back bootstrap script tweaks #2466
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
Android: fix ABI triple detection, disable C++ modules flags, and bring back bootstrap script tweaks #2466
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -232,7 +232,14 @@ def get_build_target(args): | |
if platform.system() == 'Darwin': | ||
return "x86_64-apple-macosx" | ||
elif platform.system() == 'Linux': | ||
if platform.machine() == 'x86_64': | ||
if 'ANDROID_DATA' in os.environ: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hey, wanna try using the new There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll try it out. |
||
if platform.machine().startswith('armv7'): | ||
return 'armv7a-unknown-linux-androideabi' | ||
elif platform.machine() == 'aarch64': | ||
return 'aarch64-unknown-linux-android' | ||
else: | ||
raise SystemExit("ERROR: unsupported Android platform:", platform.machine()) | ||
elif platform.machine() == 'x86_64': | ||
return "x86_64-unknown-linux-gnu" | ||
elif platform.machine() == "i686": | ||
return "i686-unknown-linux" | ||
|
@@ -548,10 +555,15 @@ def get_swiftpm_flags(args): | |
"-Xlinker", "@executable_path/../../../../../SharedFrameworks", | ||
]) | ||
|
||
# Add a rpath to find core swift libraries on linux. We don't need a rpath | ||
# for Darwin because the Swift libraries are present in the OS. | ||
# Add a rpath to find core swift libraries on linux and Android. We don't | ||
# need a rpath for Darwin because the Swift libraries are present in the OS. | ||
if platform.system() == 'Linux': | ||
build_flags.extend(["-Xlinker", "-rpath=$ORIGIN/../lib/swift/linux"]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can probably drive this based on There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cc @DougGregor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, ‘-print-target-info’ indicates whether one should use rpaths There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @aciidb0mb3r, do you mean extracting the relative path from the provided There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Exacting the "linux" or "android" bit from the triple should be good enough, I think? @DougGregor or @brentdax might have better ideas though. Anyway, I don't want to block your PR on this stuff so I am happy to take this patch and perhaps you can try There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sounds good, I'll try it in my next pull. |
||
if 'ANDROID_DATA' in os.environ: | ||
build_flags.extend(["-Xlinker", "-rpath=$ORIGIN/../lib/swift/android"]) | ||
# Don't use GNU strerror_r on Android. | ||
build_flags.extend(["-Xswiftc", "-Xcc", "-Xswiftc", "-U_GNU_SOURCE"]) | ||
else: | ||
build_flags.extend(["-Xlinker", "-rpath=$ORIGIN/../lib/swift/linux"]) | ||
|
||
return build_flags | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This raw value was added years back and never used until my recent native Android pulls, so should be fine to change.