Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0007679OCamlconfigure and build/installpublic2017-11-28 16:012017-11-30 11:25
Assigned Togasche 
StatusresolvedResolutionno change required 
PlatformLinuxOSUbuntuOS Version 17.04
Product Version4.06.0 
Target VersionFixed in Version 
Summary0007679: OCaml fails to build in 32 bits mode in a 64 bit system.
DescriptionDear Ocaml devs,

trying to compile 4.06.0 in 32bit mode [so it can be used by js_of_ocaml] I hit this compilation problem:

./configure -with-debug-runtime -cc "gcc -m32" -as "as --32" -aspp "gcc -m32 -c" -host "i386-linux" -partialld "ld -r -melf_i386"


boot/ocamlrun ./ocamlopt -g -nostdlib -I stdlib -I otherlibs/dynlink -o ocamlc.opt compilerlibs/ocamlcommon.cmxa compilerlibs/ocamlbytecomp.cmxa driver/main.cmx -cclib "-lm -ldl -lpthread "
stdlib/libasmrun.a(i386.o): In function `caml_system__code_begin':
(.text+0x0): multiple definition of `caml_system__code_begin'
stdlib/libasmrun.a(amd64.o):(.text+0x0): first defined here
/usr/bin/ld: i386:x86-64 architecture of input file `stdlib/libasmrun.a(amd64.o)' is incompatible with i386 output
collect2: error: ld returned 1 exit status
File "caml_startup", line 1:
Error: Error during linking
Makefile:883: recipe for target 'ocamlc.opt' failed

It could be well the case that I am doing something wrong, as I am using the configure line that worked for 4.05.0. 4.05.0 in 32 bits mode works ok in my system.
Steps To Reproduce- clone 4.06 branch
- ./configure -with-debug-runtime -cc "gcc -m32" -as "as --32" -aspp "gcc -m32 -c" -host "i386-linux" -partialld "ld -r -melf_i386"
- make world
- make world.opt => fail
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
dra (developer)
2017-11-28 16:11

For OCaml's Travis build, we just use `-host i686-pc-linux-gnu`, but that doesn't necessarily mean that there isn't a regression in the configure system
vlaviron (reporter)
2017-11-28 17:36

I have a git worktree configured with exactly the same options, that I use for testing, and could compile 4.06 without errors. However, looking at the Makefiles and the doc for the ar command, it looks like you may have launched the compilation while a libasmrun.a from a 64-bit compilation was still present, which would be consistent with the error you get (the command used to create libasmrun.a adds and replaces objects, but does not remove the ones not replaced).
If this is the case, `make clean && make world.opt` should fix your problem.
ejgallego (reporter)
2017-11-28 17:53

I'm gonna try again, thanks. But I originally found this error when creating an OPAM switch so the compilation state should have been clean.

@dra, in fact I had looked at what travis does and I tried with `-host i686-pc-linux-gnu`, but that didn't seem to do what I needed. Will report back too.
ejgallego (reporter)
2017-11-28 18:21

Waaah, so for some reason my OPAM used some stale compiler information :embarrased: in fact the original build seems to work now. Sorry for the noise, closing the issue.

WRT to `-host i686-pc-linux-gnu` I do indeed get this:

with ./configure -host i686-pc-linux-gnu :
gcc -c -DSYS_linux_elf -I../byterun -DMODEL_default -o i386.o i386.S || \
{ echo "If your assembler produced syntax errors, it is probably";\
          echo "unhappy with the preprocessor. Check your assembler, or";\
          echo "try producing i386.o by hand.";\
          exit 2; }
i386.S: Assembler messages:
i386.S:148: Error: invalid instruction suffix for `push'
If your assembler produced syntax errors, it is probably
unhappy with the preprocessor. Check your assembler, or
try producing i386.o by hand.
Makefile:153: recipe for target 'i386.o' failed
make[3]: *** [i386.o] Error 2
ejgallego (reporter)
2017-11-28 18:22

Ummm, I can't modify the issue status it seems. Please, resolve as INVALID.
xleroy (administrator)
2017-11-28 18:53

Indeed, leftover files from an earlier (64-bit) compile explains the error.

Still, we should erase ".a" files before reconstructing them with "ar rc". I'll look into this.

Concerning "./configure -host i686-pc-linux-gnu", I'm pretty sure this is not enough to build a 32-bit version on a 64-bit host. Maybe it should be enough, but in the meantime please stick to the incantation given in INSTALL.adoc.
dra (developer)
2017-11-28 18:58

Indeed - Travis replaces all the compiler packages with their 32-bit counterparts, which is why it works there.
xleroy (administrator)
2017-11-28 19:25

Pull request here: [^]
xleroy (administrator)
2017-11-30 11:25

Pull request merged, will be in 4.07

- Issue History
Date Modified Username Field Change
2017-11-28 16:01 ejgallego New Issue
2017-11-28 16:11 dra Note Added: 0018697
2017-11-28 17:36 vlaviron Note Added: 0018698
2017-11-28 17:53 ejgallego Note Added: 0018700
2017-11-28 18:21 ejgallego Note Added: 0018701
2017-11-28 18:22 ejgallego Note Added: 0018702
2017-11-28 18:23 gasche Status new => resolved
2017-11-28 18:23 gasche Resolution open => no change required
2017-11-28 18:23 gasche Assigned To => gasche
2017-11-28 18:53 xleroy Note Added: 0018704
2017-11-28 18:58 dra Note Added: 0018705
2017-11-28 19:25 xleroy Note Added: 0018707
2017-11-30 11:25 xleroy Note Added: 0018728

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker