Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile a 32-bit version of OCaml on a 64-bit linux OS #5178

Closed
vicuna opened this issue Nov 15, 2010 · 4 comments
Closed

Compile a 32-bit version of OCaml on a 64-bit linux OS #5178

vicuna opened this issue Nov 15, 2010 · 4 comments
Labels
Milestone

Comments

@vicuna
Copy link

@vicuna vicuna commented Nov 15, 2010

Original bug ID: 5178
Reporter: nobelius
Status: closed (set by @xavierleroy on 2015-12-11T18:19:45Z)
Resolution: fixed
Priority: normal
Severity: minor
Version: 3.12.0
Target version: 4.00.2+dev
Fixed in version: 4.01.0+dev
Category: ~DO NOT USE (was: OCaml general)
Monitored by: brendan mehdi "Pascal Cuoq"

Bug description

I 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 lib.so -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

@vicuna
Copy link
Author

@vicuna vicuna commented Nov 22, 2010

Comment author: @xavierleroy

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.

@vicuna
Copy link
Author

@vicuna vicuna commented Feb 28, 2011

Comment author: monate

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

../ocamlcomp.sh -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.

@vicuna
Copy link
Author

@vicuna vicuna commented Jun 14, 2013

Comment author: hectorpal

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.

@vicuna
Copy link
Author

@vicuna vicuna commented Jun 15, 2013

Comment author: @xavierleroy

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

@vicuna vicuna closed this Dec 11, 2015
@vicuna vicuna added this to the 4.00.2 milestone Mar 14, 2019
@vicuna vicuna added the bug label Mar 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant