Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7956 Discussions

ocaml compilation fails with icc ( [pervasives.cmi] Segmentation fault (core dumped))

psing51
New Contributor I
1,078 Views

I am trying to compile ocaml with icc, i encounter segfault ! terminal log is:

icc -c -DCAML_NAME_SPACE -O -D_FILE_OFFSET_BITS=64 -D_REENTRANT  -fPIC main.pic.c
rm main.pic.c
icc -shared -o libcamlrun_shared.so interp.pic.o misc.pic.o stacks.pic.o fix_code.pic.o startup.pic.o freelist.pic.o major_gc.pic.o minor_gc.pic.o memory.pic.o alloc.pic.o roots.pic.o globroots.pic.o fail.pic.o signals.pic.o signals_byt.pic.o printexc.pic.o backtrace.pic.o compare.pic.o ints.pic.o floats.pic.o str.pic.o array.pic.o io.pic.o extern.pic.o intern.pic.o hash.pic.o sys.pic.o meta.pic.o parsing.pic.o gc_ctrl.pic.o terminfo.pic.o md5.pic.o obj.pic.o lexing.pic.o callback.pic.o debugger.pic.o weak.pic.o compact.pic.o finalise.pic.o custom.pic.o dynlink.pic.o unix.pic.o main.pic.o -lm  -lcurses -lpthread
make[2]: Leaving directory `/opt/user1-INTEL/finaluser1/ToolsInstaller/Electronics/SCILAB5/ocaml-4.01.0/byterun'
cp byterun/ocamlrun boot/ocamlrun
cd yacc; make all
make[2]: Entering directory `/opt/user1-INTEL/finaluser1/ToolsInstaller/Electronics/SCILAB5/ocaml-4.01.0/yacc'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/opt/user1-INTEL/finaluser1/ToolsInstaller/Electronics/SCILAB5/ocaml-4.01.0/yacc'
cp yacc/ocamlyacc boot/ocamlyacc
cd stdlib; make COMPILER=../boot/ocamlc all
make[2]: Entering directory `/opt/user1-INTEL/finaluser1/ToolsInstaller/Electronics/SCILAB5/ocaml-4.01.0/stdlib'
../boot/ocamlrun ../boot/ocamlc -strict-sequence -w +33..39 -g -warn-error A -nostdlib `./Compflags pervasives.cmi` -c pervasives.mli
make[2]: *** [pervasives.cmi] Segmentation fault (core dumped)
make[2]: Leaving directory `/opt/user1-INTEL/finaluser1/ToolsInstaller/Electronics/SCILAB5/ocaml-4.01.0/stdlib'
make[1]: *** [coldstart] Error 2

The ocaml gets successfully compiled with gcc !
What might be the reason for the segfault ?
should i decrease the optimization level?

0 Kudos
4 Replies
Anoop_M_Intel
Employee
1,078 Views

Hi Puneet,

Could you please provide us the preprocessed file using the compiler option -E with icc. This will help me reproduce this issue on my end.

Thanks and Regards
Anoop

0 Kudos
psing51
New Contributor I
1,078 Views

there might be too many files in ocaml source code !
which ones should i send ?
I guess on centos6.5/RHEL6.5 with intel 15.0.3 compiler suite , the compilation of ocaml 4.0 should reproduce the same error!

i tried to recompile with more VERBOSE options ,please take a look at the logs & Please let me know which ones should i send,
so that i will manually run the icc  on that file(s) with -E flag!

Eagerly awaiting your reply!

0 Kudos
Hoste__Kenneth
Beginner
1,078 Views

Any updates on this?

I'm running into the exact same problem...

It's basically the ocamlrun binary that is segfaulting, so this is not easy to isolate to a single source file.

0 Kudos
Hoste__Kenneth
Beginner
1,078 Views

Using GDB and a build of ocamlrun with -g enabled, I get this:

$ gdb ../boot/ocamlrun 
...
(gdb) run ../boot/ocamlc -strict-sequence -w +33..39 -g -warn-error A -bin-annot -nostdlib -safe-string `./Compflags camlinternalFormatBasics.cmi` -c camlinternalFormatBasics.mli
Starting program: /tmp/vsc40023/easybuild_build/OCaml/4.02.3/intel-2015b/ocaml-4.02.3/boot/ocamlrun ../boot/ocamlc -strict-sequence -w +33..39 -g -warn-error A -bin-annot -nostdlib -safe-string `./Compflags camlinternalFormatBasics.cmi` -c camlinternalFormatBasics.mli
[Thread debugging using libthread_db enabled]

Program received signal SIGSEGV, Segmentation fault.
0x0000000000432da9 in caml_interprete (prog=0x2aaaac329010, prog_size=0) at interp.c:717
717	      accu = Field(accu, *pc); pc++; Next;
Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.166.el6_7.1.x86_64 ncurses-libs-5.7-4.20090207.el6.x86_64 snoopy-1.7.10-1.el6.x86_64
(gdb) bt
#0  0x0000000000432da9 in caml_interprete (prog=0x2aaaac329010, prog_size=0) at interp.c:717
#1  0x0000000000435cf0 in caml_main (argv=0x2aaaabf39e08) at startup.c:441
#2  0x0000000000431bb8 in main (argc=-1410097656, argv=0x0) at main.c:54

 

0 Kudos
Reply