Last active
August 23, 2020 12:05
-
-
Save bencord0/f09905ecbb0a147d91d20d7e68debb73 to your computer and use it in GitHub Desktop.
crossdev musl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main() | |
{ | |
printf("Hello World!\n"); | |
return 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Set the compiler toolchain to musl-gcc | |
# In gentoo, create the toolchain with crossdev | |
# | |
# crossdev -t x86_64-pc-linux-musl -S | |
# | |
CC = x86_64-pc-linux-musl-gcc | |
# The toolchain sets the ELF Interpreter to /lib/ld-musl-x86_64.so.1 | |
# Either, set the interpreter in the binary to the musl dynamic loader, | |
# which is the same file as the libc, or symlink the expected loader. | |
# | |
# ln -s /usr/x86_64-pc-linux-musl/usr/lib/libc.so /lib/ld-musl-x86_64.so.1 | |
# | |
# Uncomment this line to compile the location of the linker into the binary | |
#LDFLAGS += -Wl,--dynamic-linker=/usr/x86_64-pc-linux-musl/usr/lib/libc.so | |
# For programs that link against other libraries too, add the musl variants | |
# to their RPATH, this way, you don't need LD_PRELOAD tricks. | |
LDFLAGS += -Wl,-rpath,/usr/x86_64-pc-linux-musl/usr/lib |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment