Skip to content

[CMake] Explicitly set Android lib prefix/suffix #5159

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

Conversation

modocache
Copy link
Contributor

When compiling the Swift standard library for Android on Linux, the target prefixes and suffixes for static and shared libraries happen to be the same for both platforms. When using a macOS host to compile, however, the suffixes are different, causing build errors.

Explicitly set the prefixes and suffixes to prevent errors when building on macOS.

This was pulled out of the larger pull request #4972, which addresses SR-1362.

When compiling the Swift standard library for Android on Linux, the
target prefixes and suffixes for static and shared libraries happen to
be the same for both platforms. When using a macOS host to compile,
however, the suffixes are different, causing build errors.

Explicitly set the prefixes and suffixes to prevent errors when
building on macOS.
@modocache
Copy link
Contributor Author

@swift-ci Please test

@jrose-apple
Copy link
Contributor

You're all starting to convince me that using CMake's support would be an improvement.

@jrose-apple jrose-apple removed their assignment Oct 6, 2016
@modocache
Copy link
Contributor Author

Haha, do you mean https://cmake.org/services/? 😂 Maybe if we pool our money together...

@jrose-apple
Copy link
Contributor

Ah, no, just meant using CMake for cross-compilation instead of doing it manually.

@modocache
Copy link
Contributor Author

Oh! Haha, I thought you were getting frustrated reviewing all these pull requests. Again, I really appreciate it!

@modocache
Copy link
Contributor Author

I'm going to go ahead and merge this -- seems like no real opposition, the tests pass, the code simply adds to an existing, reviewed pattern from #5068, and it's specifically for Android. Hope that's OK! :)

@modocache modocache merged commit db1a921 into swiftlang:master Oct 7, 2016
@modocache modocache deleted the cmake-set-target-prefix-android branch October 7, 2016 17:23
@llvm-beanz
Copy link
Contributor

@jrose-apple I spent a lot of time over the last year fighting with hand-rolled cross-compiling in compiler-rt. I strongly advise using CMake's built-in support for it. It is way simpler.

I've been moving LLVM.org to using CMake's built-in cross-compilation support for building all the runtime library projects via the LLVM "runtimes" directory. There are a few rough edges in CMake that make it challenging, but I think we can work with the CMake community to improve the experience.

@gottesmm
Copy link
Contributor

gottesmm commented Oct 9, 2016

@llvm-beanz I have come to the same conclusion. It would clean up the cmake build system so much conceptually by removing target/sdk specific code out of the compiler code paths.

I have on a separate branch written a prototype that allows us to perform the separate compilation using what we have today. It would then allow us to begin refactoring out the code paths:

https://github.com/gottesmm/swift/tree/external-swift-stdlib

@gottesmm
Copy link
Contributor

gottesmm commented Oct 9, 2016

NOTE It does require a small change in clang to work. But that would be trivial to fix (in fact I may just do it myself real quick).

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.

4 participants