Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005178OCaml~DO NOT USE (was: OCaml general)public2010-11-15 18:012015-12-11 19:19
Assigned To 
PrioritynormalSeverityminorReproducibilityhave not tried
PlatformOSOS Version
Product Version3.12.0 
Target Version4.00.2+devFixed in Version4.01.0+dev 
Summary0005178: Compile a 32-bit version of OCaml on a 64-bit linux OS
DescriptionI tried to compile a 32-bit version of OCaml because I suspect a performance loss with the 64-bit version.
I used the command line given as example in INSTALL file:
./configure -cc "gcc -m32" -as "as --32" -aspp "gcc -m32 -c"
and then "make world"
but I obtained the following error:

make[2]: Entering directory `/local/vmonfort/Downloads/ocaml-3.11.2/otherlibs/num'
gcc -m32 -fno-defer-pop -Wall -D_FILE_OFFSET_BITS=64 -D_REENTRANT -I../../byterun -O -fPIC -DBNG_ARCH_amd64 -DBNG_ASM_LEVEL=1 -c bng.c
In file included from bng.c:24:
bng_amd64.c: In function ‘bng_amd64_mult_add_digit’:
bng_amd64.c:113: error: can't find a register in class ‘GENERAL_REGS’ while reloading ‘asm’
bng_amd64.c:113: error: ‘asm’ operand has impossible constraints
make[2]: *** [bng.o] Error 1
make[2]: Leaving directory `/local/vmonfort/Downloads/ocaml-3.11.2/otherlibs/num'

the configure script (with above-mentioned option line) was indicating the following information:

Configuration for the bytecode compiler:
        C compiler used........... gcc -m32
        options for compiling..... -fno-defer-pop -Wall -D_FILE_OFFSET_BITS=64 -D_REENTRANT
        options for linking....... -Wl,-E -lm -ldl -lpthread
        shared libraries are supported
        options for compiling..... -fPIC -fno-defer-pop -Wall -D_FILE_OFFSET_BITS=64 -D_REENTRANT
        command for building...... gcc -m32 -shared -o -Wl,-rpath,/a/path objs
Configuration for the native-code compiler:
        hardware architecture..... amd64
        OS variant................ linux
        C compiler used........... gcc -m32
        options for compiling..... -Wall -D_FILE_OFFSET_BITS=64 -D_REENTRANT
        options for linking....... -lm
        assembler ................ as --32
        preprocessed assembler ... gcc -m32 -c
        native dynlink ........... true
        profiling with gprof ..... supported
Source-level replay debugger: supported
Additional libraries supported:
        unix str num dynlink bigarray systhreads threads graph
Configuration for the "num" library:
        target architecture ...... amd64 (asm level 1)
Configuration for the "graph" library:
        options for compiling ....
        options for linking ...... -lX11
The "labltk" library: not supported
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
xleroy (administrator)
2010-11-22 11:48

I ran into the same issue recently under Linux. Currently, some manual editing of the config/Makefile generated by configure is needed, which is not nice. At the very least, the wrong example should be removed from the INSTALL file. Even better would be to have a configure script that works in this case.
monate (reporter)
2011-02-28 16:05

Here is the command I had to use to cross compile a 32 bits ocaml from an Ubuntu 64.

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

Then I have to run make world.opt _twice_ as the first run ends up with
../ -pack -g camlp4/Camlp4Top/Top.cmo camlp4/Camlp4Top/Rprint.cmo -o camlp4/Camlp4Top.cmo
boot/ocamlrun boot/ocamldep -pp 'boot/ocamlrun camlp4/boot/camlp4boot.byte -D OPT' -modules camlp4/camlp4prof.mli > camlp4/camlp4prof.mli.depends
sh: line 1: 32000 Killed boot/ocamlrun camlp4/boot/camlp4boot.byte -D OPT camlp4/camlp4prof.mli > /tmp/camlppb16a63
Preprocessing error on file camlp4/camlp4prof.mli
Exit code 2 while executing this command:
  boot/ocamlrun boot/ocamldep -pp 'boot/ocamlrun camlp4/boot/camlp4boot.byte -D OPT' -modules camlp4/camlp4prof.mli > camlp4/camlp4prof.mli.depends
make[1]: *** [camlp4out] Error 2
make[1]: Leaving directory `/home/monate/OCAML/ocaml-3.12.0'
make: *** [world.opt] Error 2
The second run is successful.

Note that the detection of 32 library is not correct : if there is a valid libX11 64bits and no libX11 32bits, then configure pretends everything is ok, but the compilation fails later.
hectorpal (reporter)
2013-06-14 21:24

Hi. The problem still carry on on OCaml 4.00.1.

The offending recommendation is in INSTALL.
I used configure -cc "gcc -m32" -as "as --32" -aspp "gcc -m32 -c" -host i386-linux -partialld "ld -r -melf_i386" and it worked, by the way.
I bootstraped and reported no error.

So, at least change the INSTALL.
xleroy (administrator)
2013-06-15 10:19

INSTALL file updated as suggested in 4.01 release branch (commit r13781) and in SVN trunk (commit r13782).

- Issue History
Date Modified Username Field Change
2010-11-15 18:01 nobelius New Issue
2010-11-22 11:48 xleroy Note Added: 0005712
2010-11-22 11:48 xleroy Status new => acknowledged
2011-02-28 16:05 monate Note Added: 0005836
2012-07-10 17:31 doligez Target Version => 4.01.0+dev
2012-07-31 13:36 doligez Target Version 4.01.0+dev => 4.00.1+dev
2012-09-19 14:19 doligez Target Version 4.00.1+dev => 4.00.2+dev
2013-06-14 21:24 hectorpal Note Added: 0009502
2013-06-15 10:19 xleroy Note Added: 0009503
2013-06-15 10:19 xleroy Status acknowledged => resolved
2013-06-15 10:19 xleroy Resolution open => fixed
2013-06-15 10:19 xleroy Fixed in Version => 4.01.0+dev
2015-12-11 19:19 xleroy Status resolved => closed
2017-02-23 16:36 doligez Category OCaml general => -OCaml general
2017-03-03 17:55 doligez Category -OCaml general => -(deprecated) general
2017-03-03 18:01 doligez Category -(deprecated) general => ~deprecated (was: OCaml general)
2017-03-06 17:04 doligez Category ~deprecated (was: OCaml general) => ~DO NOT USE (was: OCaml general)

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker