Trying to build stdlib of Swift for Android on macOS is failing. If I understand the whole thing correctly, when I configure the build script to build for Android, it will do the following:
Building cmark-macosx-x86_64
Building llvm-macosx-x86_64
Building swift-macosx-x86_64 (with targets swift-test-stdlib-macosx-x86_64 swift-test-stdlib-android-armv7 swift-benchmark-macosx-x86_64) \<– Failing here
Firstly, I don't understand why I have to build the macOS variant of the stdlib even if I ask specifically for the android one using the parameter `--stdlib-deployment-targets "android-armv7"`. Indeed, if I add this parameter, an error will be raised because CMake won't find swiftRuntime-macos target. Maybe this specific problem would need another ticket.
Secondly, the error that prevents me from building swift raises when the macOS variant is currently building. If I check the build commands, I think there is a problem because the Android sysroot and includes are appended to the macOS specifics commands, and not only on the Android ones.
If I refer to this PR (https://github.com/apple/swift/pull/4972), building static stdlib should be working. I've checked out the commit related to this PR and, even if I didn't succeed to build because of too recent dependencies, the build commands does not have this anomaly.
Here is the error raised when building with an up-to-date source:
/Users/jblatecky/dev/swift-source/swift/stdlib/public/stubs/LibcShims.cpp:103:1: error: static_assert failed "This platform's pthread_key_t differs. If you hit this assert, fix __swift_pthread_key_t's typedef in LibcShims.h by adding an #if guard and definition for your platform"
static_assert(std::is_same<__swift_pthread_key_t, pthread_key_t>::value,
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Attachment: Download
Environment
Swift master branch (LLVM 0af67ee12ff4f3fd8f9bdf4b879eebcce4825ec7, Clang 8ec8fa633cf4ada2e67fae7f888fe410bf7e0763, Swift 069ed3e9e48e55c58a648c5ef15f10c8314d371d)Additional Detail from JIRA
| | | |------------------|-----------------| |Votes | 0 | |Component/s | Standard Library | |Labels | Bug | |Assignee | None | |Priority | Medium | md5: 0f65b3b0a7dfad4ccbb396e729badabdrelates to:
Issue Description:
Trying to build stdlib of Swift for Android on macOS is failing. If I understand the whole thing correctly, when I configure the build script to build for Android, it will do the following:
Building cmark-macosx-x86_64
Building llvm-macosx-x86_64
Building swift-macosx-x86_64 (with targets swift-test-stdlib-macosx-x86_64 swift-test-stdlib-android-armv7 swift-benchmark-macosx-x86_64) \<– Failing here
Firstly, I don't understand why I have to build the macOS variant of the stdlib even if I ask specifically for the android one using the parameter `--stdlib-deployment-targets "android-armv7"`. Indeed, if I add this parameter, an error will be raised because CMake won't find swiftRuntime-macos target. Maybe this specific problem would need another ticket.
Secondly, the error that prevents me from building swift raises when the macOS variant is currently building. If I check the build commands, I think there is a problem because the Android sysroot and includes are appended to the macOS specifics commands, and not only on the Android ones.
If I refer to this PR (https://github.com/apple/swift/pull/4972), building static stdlib should be working. I've checked out the commit related to this PR and, even if I didn't succeed to build because of too recent dependencies, the build commands does not have this anomaly.
Here is the error raised when building with an up-to-date source:
The command that raises this error:
Finally, for comparison, here is the command that we could find at the time of the PR (not on the same file, but at the same build step):