English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
Warning: gcc -O2 bad for compiling Ocaml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2000-04-26 (13:37)
From: Basile STARYNKEVITCH <Basile.Starynkevitch@w...>
Subject: Warning: gcc -O2 bad for compiling Ocaml
Hello All,

I compiled ocaml-2.99+18 (2000-04-14, from CVS). But I wanted to get a
little faster runtime (compiled with gcc-2.95.2 on a Linux Suse6.2
-glibc2- AMDK6 PC, my home machine). So I edited manually
config/Makefile to add -O2 at end of BYTECCCOMPOPTS and

This seems to work ok for Ocaml proper (make bootstrap runs ok, as
do make opt, make ocamlopt.opt etc...). 

But I tried to compile Fabrice Le Fessant latest patched efun editor 

This does not work (in efuns/efuns, make opt fails), ending with:

ocamlopt.opt  -I ../ocamlsrc -I ../dynlink -I ../toolkit -I ../concur -I /h1/basile/ltmp/efuns/xlib -I /h1/basile/ltmp/efuns/common -c ebuffer.ml
The compiled interfaces keymap.cmi and ebuffer.cmi
make inconsistent assumptions over interface Efuns
make[1]: *** [ebuffer.cmx] Erreur 2

This is repeatable on other systems.

I thought there was a bug in Ocaml or Efuns. The bug was mine:


(the same bug appears with other optimizations such as -Os or

My public apologies to Fabrice (Le Fessant) and Xavier (Leroy) for
having lost their time.

I suggest adding in Ocaml INSTALL file the following line of advice:

  Warning: do not compile the Ocaml system with any other optimisation
  that gcc -O. On somes occasions, compiling Ocaml with gcc -O2 produces
  a buggy compiler or runtime.

################ résumé francais:

Il faut éviter de compiler l'environement OCaml avec gcc -O2 (ou toute
autre optimisation que -O). Dans certains cas, cela produit un
compilateur ou un système d'exécution incorrect.

Mes excuses publiques pour avoir fait perdre leur temps à Fabrice (Le
Fessant) and Xavier (Leroy) à ce propos.


Basile STARYNKEVITCH - 8 rue de la Faiencerie, 92340 BOURG LA REINE (France)
tel email = basile point starynkevitch at wanadoo point fr
antispam: <abuse@wanadoo.fr>