Skip to content

Commit 1956625

Browse files
committed
Compile for x86_32 via cross-compilation
multilib has issues, for example, in Ubunut Signed-off-by: Kakadu <[email protected]>
1 parent 4e9b1da commit 1956625

File tree

4 files changed

+13
-4
lines changed

4 files changed

+13
-4
lines changed

Lama.opam

+5-1
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,8 @@ build: [
2828
"@doc" {with-doc}
2929
]
3030
]
31-
depexts: [ [ "gcc-14-multilib" ] {os-distribution = "ubuntu"} ]
31+
depexts: [
32+
[ "gcc-i686-linux-gnu" "linux-libc-dev:i386" "libc6-dev-i386-cross"] {os-distribution = "ubuntu"}
33+
[ "libgcc-13-dev-i386-cross" ] {os-distribution = "ubuntu" & os-version >= "24.04" }
34+
[ "libgcc-14-dev-i386-cross" ] {os-distribution = "ubuntu" & os-version >= "24.04" }
35+
]

Lama.opam.template

+5-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
depexts: [ [ "gcc-14-multilib" ] {os-distribution = "ubuntu"} ]
1+
depexts: [
2+
[ "gcc-i686-linux-gnu" "linux-libc-dev:i386" "libc6-dev-i386-cross"] {os-distribution = "ubuntu"}
3+
[ "libgcc-13-dev-i386-cross" ] {os-distribution = "ubuntu" & os-version >= "24.04" }
4+
[ "libgcc-14-dev-i386-cross" ] {os-distribution = "ubuntu" & os-version >= "24.04" }
5+
]

runtime32/Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
RUNTIME=runtime.a
22

33
.DEFAULT := $(RUNTIME)
4+
CC := i686-linux-gnu-gcc
45

56
$(RUNTIME): gc_runtime.o runtime.o
67
ar rc $@ gc_runtime.o runtime.o

src/X86_32.ml

+2-2
Original file line numberDiff line numberDiff line change
@@ -833,8 +833,8 @@ let build cmd prog =
833833
let objs = find_objects (fst @@ fst prog) cmd#get_include_paths in
834834
let buf = Buffer.create 255 in
835835
List.iter (fun o -> Buffer.add_string buf o; Buffer.add_string buf " ") objs;
836-
let gcc_cmdline = Printf.sprintf "gcc %s -m32 %s %s.s %s %s/runtime.a" cmd#get_debug cmd#get_output_option cmd#basename (Buffer.contents buf) inc in
836+
let gcc_cmdline = Printf.sprintf "i686-linux-gnu-gcc %s %s %s.s %s %s/runtime.a" cmd#get_debug cmd#get_output_option cmd#basename (Buffer.contents buf) inc in
837837
Sys.command gcc_cmdline
838838
| `Compile ->
839-
Sys.command (Printf.sprintf "gcc %s -m32 -c %s.s" cmd#get_debug cmd#basename)
839+
Sys.command (Printf.sprintf "i686-linux-gnu-gcc %s -c %s.s" cmd#get_debug cmd#basename)
840840
| _ -> invalid_arg "must not happen"

0 commit comments

Comments
 (0)