mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-30 07:14:46 +00:00
link 32-bit x86 on linux
This commit is contained in:
parent
a7eeae05ca
commit
3fbdc743ec
1 changed files with 33 additions and 2 deletions
|
@ -66,6 +66,7 @@ pub fn build_zig_host_native(
|
|||
emit_bin: &str,
|
||||
zig_host_src: &str,
|
||||
zig_str_path: &str,
|
||||
target: &str,
|
||||
) -> Output {
|
||||
Command::new("zig")
|
||||
.env_clear()
|
||||
|
@ -84,6 +85,9 @@ pub fn build_zig_host_native(
|
|||
// include libc
|
||||
"--library",
|
||||
"c",
|
||||
// cross-compile?
|
||||
"-target",
|
||||
target,
|
||||
])
|
||||
.output()
|
||||
.unwrap()
|
||||
|
@ -96,6 +100,7 @@ pub fn build_zig_host_native(
|
|||
emit_bin: &str,
|
||||
zig_host_src: &str,
|
||||
zig_str_path: &str,
|
||||
_target: &str,
|
||||
) -> Output {
|
||||
use serde_json::Value;
|
||||
|
||||
|
@ -246,6 +251,7 @@ pub fn rebuild_host(target: &Triple, host_input_path: &Path) {
|
|||
&emit_bin,
|
||||
zig_host_src.to_str().unwrap(),
|
||||
zig_str_path.to_str().unwrap(),
|
||||
"native",
|
||||
)
|
||||
}
|
||||
Architecture::X86_32(_) => {
|
||||
|
@ -256,6 +262,7 @@ pub fn rebuild_host(target: &Triple, host_input_path: &Path) {
|
|||
&emit_bin,
|
||||
zig_host_src.to_str().unwrap(),
|
||||
zig_str_path.to_str().unwrap(),
|
||||
"i386-linux-gnu",
|
||||
)
|
||||
}
|
||||
_ => panic!("Unsupported architecture {:?}", target.architecture),
|
||||
|
@ -391,6 +398,32 @@ fn link_linux(
|
|||
) -> io::Result<(Child, PathBuf)> {
|
||||
let architecture = format!("{}-linux-gnu", target.architecture);
|
||||
|
||||
// Command::new("cp")
|
||||
// .args(&[input_paths[0], "/home/folkertdev/roc/wasm/host.o"])
|
||||
// .output()
|
||||
// .unwrap();
|
||||
//
|
||||
// Command::new("cp")
|
||||
// .args(&[input_paths[1], "/home/folkertdev/roc/wasm/app.o"])
|
||||
// .output()
|
||||
// .unwrap();
|
||||
|
||||
if let Architecture::X86_32(_) = target.architecture {
|
||||
return Ok((
|
||||
Command::new("zig")
|
||||
.args(&["build-exe"])
|
||||
.args(input_paths)
|
||||
.args(&[
|
||||
"-target",
|
||||
"i386-linux-musl",
|
||||
"-lc",
|
||||
&format!("-femit-bin={}", output_path.to_str().unwrap()),
|
||||
])
|
||||
.spawn()?,
|
||||
output_path,
|
||||
));
|
||||
}
|
||||
|
||||
let libcrt_path = library_path(["/usr", "lib", &architecture])
|
||||
.or_else(|| library_path(["/usr", "lib"]))
|
||||
.or_else(|| library_path([&nixos_path()]))
|
||||
|
@ -406,8 +439,6 @@ fn link_linux(
|
|||
let ld_linux = match target.architecture {
|
||||
Architecture::X86_64 => library_path(["/lib64", "ld-linux-x86-64.so.2"])
|
||||
.or_else(|| library_path([&nixos_path(), "ld-linux-x86-64.so.2"])),
|
||||
Architecture::X86_32(_) => library_path(["/lib32", "ld-linux.so.2"])
|
||||
.or_else(|| library_path([&nixos_path(), "ld-linux.so.2"])),
|
||||
Architecture::Aarch64(_) => library_path(["/lib", "ld-linux-aarch64.so.1"]),
|
||||
_ => panic!(
|
||||
"TODO gracefully handle unsupported linux architecture: {:?}",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue