Skip to content

Instantly share code, notes, and snippets.

@chertov
Created April 30, 2020 21:02
Show Gist options
  • Save chertov/87c7c736add7683d56008bfebe27201d to your computer and use it in GitHub Desktop.
Save chertov/87c7c736add7683d56008bfebe27201d to your computer and use it in GitHub Desktop.
LLVM cross-compile
FROM debian:buster
RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get -y install \
build-essential cmake gawk libncurses-dev libc6-dev intltool python \
git subversion time unzip zlib1g-dev libssl-dev wget curl cpio bc \
gettext gettext-base liblocale-gettext-perl upx \
flex texinfo help2man libtool-bin byacc bison pkg-config libyaml-dev \
rsync software-properties-common lsb-release
RUN bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"
ENV PATH /usr/lib/llvm-10/bin/:${PATH}
WORKDIR /src/
# COPY ./musl-1.2.0.tar.gz ./
# RUN tar -xvf ./musl-1.2.0.tar.gz
# RUN make TARGET=armv5-linux-musleabi install
RUN echo "#include <stdio.h>\n\
int main(int argc, char **argv) {\n\
// printf(\"hello world\");\n\
}\n\
" >> main.c
RUN clang main.c
RUN ./a.out
RUN clang --target=armv5-unknown-linux-musleabi main.c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment