Skip to content

Conversation

@compnerd
Copy link
Member

The sysroot headers for android require some definitions to be altered.
Ensure that we do not define _GNU_SOURCE for Android.

@compnerd
Copy link
Member Author

CC: @ephemer

The sysroot headers for android require some definitions to be altered.
Ensure that we do not define `_GNU_SOURCE` for Android.
@compnerd
Copy link
Member Author

@swift-ci please test

@compnerd
Copy link
Member Author

@MadCoder @das okay to merge?

@MadCoder MadCoder merged commit 44f3640 into swiftlang:master Oct 22, 2017
@compnerd compnerd deleted the android branch October 23, 2017 20:50
nettlep pushed a commit to nettlep/swift-corelibs-libdispatch that referenced this pull request Oct 25, 2017
build: improve cross-compilation for android

A few updates to enable building on Raspberry PI/Ubuntu 16.04

As requested by MadCoder, changed the unsigned long long to uint64_t
@johnno1962
Copy link
Contributor

Hi @compnerd, I’m looking at getting the build of an android toolkit to be possible on macOS alone and am looking to move to the new cmake way of doing things. Would it be possible for you to document the command you ran for a cmake Android build on Linux here so I can adapt it for macOS. Cheers!

@johnno1962
Copy link
Contributor

johnno1962 commented Jan 6, 2018

Is it something like:

cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=/Users/user/swifty-robot-environment/util/prepare_environment/swift-source/build/Ninja-ReleaseAssert/llvm-macosx-x86_64/bin/clang -DCMAKE_CXX_COMPILER=/Users/user/swifty-robot-environment/util/prepare_environment/swift-source/build/Ninja-ReleaseAssert/llvm-macosx-x86_64/bin/clang++ -DCMAKE_SYSTEM_NAME=Android -DCMAKE_SYSTEM_VERSION=21 -DCMAKE_ANDROID_NDK=/usr/local/android/ndk -DENABLE_SWIFT=YES -DCMAKE_SWIFT_COMPILER=/Users/user/swifty-robot-environment/util/prepare_environment/swift-install/usr/bin/swiftc -DENABLE_TESTING=OFF -DCMAKE_ANDROID_ARCH_ABI=armeabi-v7a ../swift-corelibs-libdispatch

@ephemer
Copy link
Contributor

ephemer commented Jan 18, 2018

@johnno1962 we spoke about this on Slack but here for anyone else wondering. This command works on both Mac and Linux:

cmake -G Ninja \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_SYSTEM_NAME=Android \
    -DCMAKE_SYSROOT=$HOME/dev/android-toolchain/sysroot \
    -DENABLE_SWIFT=YES \
    -DBUILD_SHARED_LIBS=YES \
    -DCMAKE_SWIFT_COMPILER=$SWIFT_INSTALLATION_PATH/usr/Darwin/swiftc \
    -DENABLE_TESTING=OFF \
    -DCMAKE_ANDROID_ARCH_ABI=armeabi-v7a \
    -DCMAKE_ANDROID_NDK_TOOLCHAIN_VERSION=clang \
    $SWIFT_INSTALLATION_PATH/swift-corelibs-libdispatch

I'm about to put another pull request through with the required changes to make that command work

@ephemer ephemer mentioned this pull request Jan 18, 2018
ktopley-apple pushed a commit that referenced this pull request Dec 6, 2018
build: improve cross-compilation for android

Signed-off-by: Daniel A. Steffen <dsteffen@apple.com>
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.

5 participants