mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-02 08:11:12 +00:00
Change linking back
This commit is contained in:
parent
81069fe01e
commit
ad16aa61e9
3 changed files with 35 additions and 37 deletions
|
@ -37,9 +37,26 @@ fn link_linux(
|
||||||
.args(&[
|
.args(&[
|
||||||
"-arch",
|
"-arch",
|
||||||
arch_str(target),
|
arch_str(target),
|
||||||
|
"/usr/lib/x86_64-linux-gnu/crti.o",
|
||||||
|
"/usr/lib/x86_64-linux-gnu/crtn.o",
|
||||||
|
"/usr/lib/x86_64-linux-gnu/Scrt1.o",
|
||||||
|
"-dynamic-linker",
|
||||||
|
"/lib64/ld-linux-x86-64.so.2",
|
||||||
// Inputs
|
// Inputs
|
||||||
dest_filename.to_str().unwrap(), // app.o
|
|
||||||
host_input_path.to_str().unwrap(), // host.o
|
host_input_path.to_str().unwrap(), // host.o
|
||||||
|
dest_filename.to_str().unwrap(), // app.o
|
||||||
|
// Libraries - see https://github.com/rtfeldman/roc/pull/554#discussion_r496365925
|
||||||
|
// for discussion and further references
|
||||||
|
"-lc",
|
||||||
|
"-lm",
|
||||||
|
"-lpthread",
|
||||||
|
"-ldl",
|
||||||
|
"-lrt",
|
||||||
|
"-lutil",
|
||||||
|
"-lc_nonshared",
|
||||||
|
"-lc++",
|
||||||
|
"-lunwind",
|
||||||
|
// "-lgcc", // TODO will eventually need compiler_rt from gcc or something - see https://github.com/rtfeldman/roc/pull/554#discussion_r496370840
|
||||||
// Output
|
// Output
|
||||||
"-o",
|
"-o",
|
||||||
binary_path.to_str().unwrap(), // app
|
binary_path.to_str().unwrap(), // app
|
||||||
|
@ -59,9 +76,6 @@ fn link_macos(
|
||||||
.args(&[
|
.args(&[
|
||||||
"-arch",
|
"-arch",
|
||||||
target.architecture.to_string().as_str(),
|
target.architecture.to_string().as_str(),
|
||||||
// Output
|
|
||||||
"-o",
|
|
||||||
binary_path.to_str().unwrap(), // app
|
|
||||||
// Inputs
|
// Inputs
|
||||||
host_input_path.to_str().unwrap(), // host.o
|
host_input_path.to_str().unwrap(), // host.o
|
||||||
dest_filename.to_str().unwrap(), // roc_app.o
|
dest_filename.to_str().unwrap(), // roc_app.o
|
||||||
|
@ -72,9 +86,12 @@ fn link_macos(
|
||||||
"-lpthread",
|
"-lpthread",
|
||||||
// "-lrt", // TODO shouldn't we need this?
|
// "-lrt", // TODO shouldn't we need this?
|
||||||
// "-lc_nonshared", // TODO shouldn't we need this?
|
// "-lc_nonshared", // TODO shouldn't we need this?
|
||||||
|
// "-lgcc", // TODO will eventually need compiler_rt from gcc or something - see https://github.com/rtfeldman/roc/pull/554#discussion_r496370840
|
||||||
|
// "-lunwind", // TODO will eventually need this, see https://github.com/rtfeldman/roc/pull/554#discussion_r496370840
|
||||||
"-lc++", // TODO shouldn't we need this?
|
"-lc++", // TODO shouldn't we need this?
|
||||||
// "-lgcc", // TODO will eventually need compiler_rt from gcc or something - see https://github.com/rtfeldman/roc/pull/554#discussion_r496370840
|
// Output
|
||||||
// "-lunwind", // TODO will eventually need this, see https://github.com/rtfeldman/roc/pull/554#discussion_r496370840
|
"-o",
|
||||||
|
binary_path.to_str().unwrap(), // app
|
||||||
])
|
])
|
||||||
.spawn()
|
.spawn()
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,31 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
clang -c host.c -o c_host.o
|
|
||||||
rustc host.rs -o rust_host.o
|
|
||||||
|
|
||||||
# Linking - see https://github.com/rtfeldman/roc/pull/554#discussion_r496365925
|
|
||||||
# for discussion and further references
|
|
||||||
#
|
|
||||||
# TODO will eventually need compiler_rt from -lgcc or something - see https://github.com/rtfeldman/roc/pull/554#discussion_r496370840
|
|
||||||
ld -r -static \
|
|
||||||
-L /usr/lib/x86_64-linux-musl \
|
|
||||||
-L /usr/lib/llvm-10/lib \
|
|
||||||
-L /usr/lib/x86_64-linux-gnu \
|
|
||||||
-dynamic-linker /lib64/ld-linux-x86-64.so.2 \
|
|
||||||
/usr/lib/x86_64-linux-gnu/crti.o \
|
|
||||||
/usr/lib/x86_64-linux-gnu/crtn.o \
|
|
||||||
/usr/lib/x86_64-linux-gnu/Scrt1.o \
|
|
||||||
-lc \
|
|
||||||
-lm \
|
|
||||||
-lpthread \
|
|
||||||
-ldl \
|
|
||||||
-lrt \
|
|
||||||
-lutil \
|
|
||||||
-lc++abi \
|
|
||||||
-lunwind \
|
|
||||||
c_host.o \
|
|
||||||
rust_host.o \
|
|
||||||
-o host.o
|
|
||||||
|
|
||||||
rm -f c_host.o
|
|
||||||
rm -f rust_host.o
|
|
12
examples/quicksort/platform/build.sh
Executable file
12
examples/quicksort/platform/build.sh
Executable file
|
@ -0,0 +1,12 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# compile c_host.o and rust_host.o
|
||||||
|
clang -c host.c -o c_host.o
|
||||||
|
rustc host.rs -o rust_host.o
|
||||||
|
|
||||||
|
# link them together into host.o
|
||||||
|
ld -r c_host.o rust_host.o -o host.o
|
||||||
|
|
||||||
|
# clean up
|
||||||
|
rm -f c_host.o
|
||||||
|
rm -f rust_host.o
|
Loading…
Add table
Add a link
Reference in a new issue