-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Android Intel 32/64 bit (i.e. Android Simulator) support. #25098
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 Intel 32/64 bit (i.e. Android Simulator) support. #25098
Conversation
vgorloff
commented
May 28, 2019
- Adds missed CMake configurations for Intel 32/64 bit (i.e. Android Simulator) support.
@swift-ci Please test |
set(SWIFT_SDK_ANDROID_ARCH_${arch}_NDK_TRIPLE "x86_64-linux-android") | ||
set(SWIFT_SDK_ANDROID_ARCH_${arch}_ALT_SPELLING "x86_64") | ||
set(SWIFT_SDK_ANDROID_ARCH_${arch}_PATH "${SWIFT_ANDROID_NDK_PATH}/platforms/android-${SWIFT_ANDROID_API_LEVEL}/arch-x86_64") | ||
set(SWIFT_SDK_ANDROID_ARCH_${arch}_TRIPLE "x86_64-unknown-linux-android") |
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.
I know that you are trying to match the surrounding code, but no point in the ${arch}
substitution here, just spell it out.
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.
Sorry, I didn't get .)
I am building swift with the following architectures:
-DSWIFT_SDK_ANDROID_ARCHITECTURES="armv7;aarch64;i686;x86_64"
Without changes above cmake will raise error:
CMake Error at cmake/modules/SwiftConfigureSDK.cmake:190 (message):
unknown arch for android SDK: i686
Or you mean that triples x86_64-unknown-linux-android
and i686-unknown-linux-android
is not something expected?
Thank you!
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.
I think he means that instead of SWIFT_SDK_ANDROID_ARCH_${arch}_TRIPLE
you can write SWIFT_SDK_ANDROID_ARCH_x86_64_TRIPLE
.
Personally, I prefer the ${arch}
in the middle because it is easier for copy/pasting in new architectures, and also because it avoids typos in the name of the variables.
set(SWIFT_SDK_ANDROID_ARCH_${arch}_NDK_PREBUILT_PATH | ||
"${SWIFT_ANDROID_NDK_PATH}/toolchains/x86_64-${SWIFT_ANDROID_NDK_GCC_VERSION}/prebuilt/${_swift_android_prebuilt_build}") | ||
else() | ||
set(SWIFT_SDK_ANDROID_ARCH_${arch}_NDK_PREBUILT_PATH |
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.
Can we not use ${SWIFT_SDK_ANDROID_ARCH_${arch}_ALT_SPELLING}-${SWIFT_ANDROID_NDK_GCC_VERSION}
instead?
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 is what I getting:
arm-4.9
NOT matching $NDK/toolchains valuearm-linux-androideabi-4.9
aarch64-4.9
NOT matching $NDK/toolchains valuearm-linux-androideabi-4.9
i686-4.9
NOT matching $NDK/toolchains valuex86-4.9
x86_64-4.9
is matching $NDK/toolchains valuex86_64-4.9
So, expression ${SWIFT_SDK_ANDROID_ARCH_${arch}_ALT_SPELLING}-${SWIFT_ANDROID_NDK_GCC_VERSION}
not resolving to proper real path in $NDK/toolchains
.
Details of cmake log:
>>>
message(${SWIFT_SDK_ANDROID_ARCH_${arch}_ALT_SPELLING}-${SWIFT_ANDROID_NDK_GCC_VERSION})
arm-4.9
<<<
>>>
message(${SWIFT_SDK_ANDROID_ARCH_${arch}_ALT_SPELLING}-${SWIFT_ANDROID_NDK_GCC_VERSION})
aarch64-4.9
<<<
>>>
message(${SWIFT_SDK_ANDROID_ARCH_${arch}_ALT_SPELLING}-${SWIFT_ANDROID_NDK_GCC_VERSION})
i686-4.9
<<<
>>>
message(${SWIFT_SDK_ANDROID_ARCH_${arch}_ALT_SPELLING}-${SWIFT_ANDROID_NDK_GCC_VERSION})
x86_64-4.9
<<<
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.
set(SWIFT_SDK_ANDROID_ARCH_${arch}_NDK_TRIPLE "x86_64-linux-android") | ||
set(SWIFT_SDK_ANDROID_ARCH_${arch}_ALT_SPELLING "x86_64") | ||
set(SWIFT_SDK_ANDROID_ARCH_${arch}_PATH "${SWIFT_ANDROID_NDK_PATH}/platforms/android-${SWIFT_ANDROID_API_LEVEL}/arch-x86_64") | ||
set(SWIFT_SDK_ANDROID_ARCH_${arch}_TRIPLE "x86_64-unknown-linux-android") |
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.
I think he means that instead of SWIFT_SDK_ANDROID_ARCH_${arch}_TRIPLE
you can write SWIFT_SDK_ANDROID_ARCH_x86_64_TRIPLE
.
Personally, I prefer the ${arch}
in the middle because it is easier for copy/pasting in new architectures, and also because it avoids typos in the name of the variables.
@swift-ci Please test |
@swift-ci please test |
Were you able to run the Swift validation testsuite in the Intel simulator, as currently done for ARM on an external device? I'm guessing you will run into issues, as Android's x86/x64 support is buggy, likely because no Android devices ship with Intel chips anymore. |
This PR is only first of approximately 10 PRs targeted Android support. In this Repo (https://github.com/vgorloff/swift-everywhere-samples) you can find few examples which shows that all 4 architectures (Android 32/64 bit ARM/Intel) are working fine. So, Intel Android 32/64 is not something deprecated, it is just about Simulators. Thanks! |
Great, would be good to get those in, as I'm guessing they affect ARM also?
Sure, would be good to have, just pointing out native testing on ARM is better.
Those simple "hello world" apps don't really show much, but it's good you got those basics working.
Maybe not deprecated, but IME somewhat buggy. Anyway, you didn't answer the question: this project supports running the testsuite remotely on Android through adb but only configures those tests for ARM, did you do the same and run the testsuite on Intel chips, ie the Android Simulator? Those results will give us an idea of how far along the port is, just as my reported results when running the compiler and testsuite natively on Android showed in #23208. |
@vgorloff no rush or anything, but if you are intending to open more PRs with changes related to this, please mention me so I can have a look at them. While work on x86 is not interesting for devices, maybe this can be used to run simulators in the CI machines which performs tests that cannot be check in ARM (it doesn't cover all the bases, but it covers more ground). |
I am have a chicken egg problem .) Officially Later there will be PRs addressed FileManager, Float80, Cmake configurations for Dispatch and Foundation, etc. |
Yes, I try from time to time to cross-compile Android on Mac, and the special usage of CMake and the mix that happens between the build host and the target host is a PitA. I don’t think there's a good way to fix all those cross-compiling problems right now. The best way we know for cross-compiling Android is still Linux or Windows. |
The thing, that I am created that alternative Swift build toolchain and now porting patches into official one for the exact purpose – In fact we can even now copy prebuilt Android libs into |
Nice, I see you ran into similar issues as I did. My advice would be to keep the two efforts separate: get the Android x64 tests built on Linux and run them in the Android simulator and separately get Android ARM cross-compilation working with the Python build-script on the Mac. Once both are working separately, it should be easy to combine them. |
Hi, Should we run Thank you! |