Skip to content
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

Add Android support #22

Open
Lucretia opened this issue Feb 16, 2018 · 1 comment
Open

Add Android support #22

Lucretia opened this issue Feb 16, 2018 · 1 comment

Comments

@Lucretia
Copy link
Collaborator

No description provided.

@Lucretia
Copy link
Collaborator Author

Lucretia commented Aug 17, 2020

Android no longer supports GCC. I've attempted to build GCC but it doesn't build complaining about missing asm/types.h and then even when I create a custom sysroot and link in the asm directory into the include directory, it fails again.

The script I used to build is this:

#!/bin/bash

TOP=$(pwd)

#API="28"
ARCH="x86_64"
TARGET="${ARCH}-linux-android"
INSTALL_DIR="${HOME}/opt/android-gnat"
SDK_DIR="${HOME}/opt/android-sdk"
NDK_DIR="${SDK_DIR}/ndk/21.1.6352462"
SYSROOT="${NDK_DIR}/sysroot"
#SYSROOT="${TOP}/sysroot/android-${ARCH}"
TARGET_INC_DIR="${SYSROOT}/usr/include/${TARGET}"

SHARED_OPTS="--enable-multilib --enable-threads=posix --disable-nls --enable-libgomp --disable-shared --disable-tls --disable-tls --disable-libitm --disable-libstdc__-v3 --disable-sjlj-exceptions --with-sysroot=${SYSROOT} --disable-libssp --with-arch=x86-64 --with-tune=intel --with-fpmath=sse --with-multilib-list=m32,m64 --enable-bionic-libs --disable-bootstrap --enable-plugins --disable-libcilkrts --disable-libsanitizer --enable-gold --enable-threads --enable-eh-frame-hdr-for-static --enable-libatomic-ifuncs=no --enable-initfini-array --enable-gnu-indirect-function"

function check_error_exit()
{
    if [ $? != 0 ]; then
        echo "  ERROR: Something went wrong!"
        exit 2;
    fi
}


mkdir -p {gcc,binutils}

cd binutils

${SHARED_OPTS} --with-sysroot=${NDK_DIR}/sysroot --includedir=${TARGET_INC_DIR} 2>&1|tee log.config.txt
${TOP}/../binutils-gdb/configure --target=${TARGET} --prefix=${INSTALL_DIR} --with-python=/usr/bin/python2 ${SHARED_OPTS} 2>&1|tee log.config.txt

make -j6 2>&1|tee log.make.txt

check_error_exit

make install

check_error_exit

cd ../gcc

${TOP}/../gcc/configure --target=${TARGET} --prefix=${INSTALL_DIR} --enable-languages=c,c++,ada ${SHARED_OPTS} --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' 2>&1|tee log.config.txt

make -j6 2>&1|tee log.make.txt

check_error_exit

make install

check_error_exit

We need an LLVM Android compiler to enable this.

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

No branches or pull requests

1 participant