Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
ocamlc linking failed due to Invalid_argument of String.create when with -g #5920
Original bug ID: 5920
Hi, today I tried to install patdiff ( https://bitbucket.org/janestreet/patdiff ) using OPAM, and found it failed:
ocamlfind ocamlc -g -linkpkg -package threads -package sexplib.syntax -package pcre -package core_extended -thread lib/patdiff_lib.cma ansi_terminal/ansi_terminal.cma bin/text.cmo bin/make_config.cmo bin/readme.cmo ansi_terminal/ansi_terminal.cmo lib/patdiff_lib.cmo bin/compare.cmo bin/patdiff.cmo -o bin/patdiff.byte
The same command without -g switch succeeded to create the executable bytecode, so I think the debugging information might exceeded the Sys.max_string_length here. My environment is Linux 32bits with 1G memory.
I think I am looking the same issue as issue #1615.
Comment author: sebmondet
I got the same error while compiling https://github.com/smondet/flow on MacOSX 32bit (Darwin Kernel Version 9.8.0) with OCaml 4.00.1.
Removing '-g' also fixed the issue.
ocamlfind ocamlc -syntax camlp4o -package core,lwt,lwt.unix,lwt.ssl,lwt.preemptive,sexplib,sexplib.syntax -thread -bin-annot -annot -absname -warn-error P -I ../lib -g flow.cma -I . -custom -o io_test.run io_test.cmo -linkpkg
Comment author: @gasche
In 0005925 , Benoît Vaugon proposed two patches to fix a compiler failure on large computer-generated source files, the first of which implements "long string" support for large results of bytecode linking.
I'm not familiar with this part of the compiler so I'm not sure whether the String.create error you have comes from the exact same place (a stack trace would help), and reproducing is a bit painful.
Would any of you two care to apply Benoît's first patch ( http://caml.inria.fr/mantis/file_download.php?file_id=874&type=bug ) and report on whether it also fixes your issue?
(Do not get great expectations, though. As one of the last members of the hopefully soon extinguished 32bits tribe, you will get little maintainer love.)