Giter VIP home page Giter VIP logo

ocamlcc's People

Contributors

bvaugon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ocamlcc's Issues

Issue at compilation

Dear ocamlcc developers,

I just installed ocamlcc with OPAM, and tried to compile a bytecode program. But I got the following error:

ld: unknown option: -E
collect2: ld returned 1 exit status
Error: command '/usr/bin/gcc -D_FILE_OFFSET_BITS=64 /var/folders/d3/bn5myb2950n5q31dc87xt9dm0000gn/T/tmp-ocamlcc-bdaef2.c -o fib.out -I /Users/john/.opam/system/include/ocamlcc -I /Users/john/.opam/system/include/ocamlcc/ocamlcc-byterun-4.00 -lm -ldl -lcurses -Wl,-E -O3 -Wall' failed.

I'm using MacOS X 10.8 with OCaml 4.00.1. Everything works fine if I manually compile the generated C file without the option -Wl,-E.

ocamlcc: link error with Unix module

If I use the Unix module then ocamlcc fails to link (even if I used -custom to generate the bytecode), and I have to manually add to -ccopts to make it link.

Testcase:

$ cat >x.ml <<EOF
let () =
  Printf.printf "Time: %f\n" (Unix.gettimeofday ())
EOF
$ ocamlfind ocamlc -package unix x.ml -linkpkg -o x.byte
$ ocamlcc -verbose x.byte
+ Running '"/home/edwin/.opam/4.00.1/bin/ocamlclean" "x.byte" -o "/tmp/tmp-ocamlcc-435ea7.byte"'... [0.10s]
+ Loading "/tmp/tmp-ocamlcc-435ea7.byte".....    [0.01s]
+ Decompiling functions....                      [0.01s]
+ Folding closures...                            [0.01s]
+ Remapping stack access...                      [0.00s]
+ Computing cell types.....                      [0.09s]
+ Cleaning functions.....                        [0.00s]
+ Generating C code...                           [0.01s]
+ Generating "/tmp/tmp-ocamlcc-f2c38d.c"...      [0.02s]
+ Removing "/tmp/tmp-ocamlcc-435ea7.byte"... done
+ Running '/home/edwin/bin/gcc -D_FILE_OFFSET_BITS=64 /tmp/tmp-ocamlcc-f2c38d.c -I /home/edwin/.opam/4.00.1/include/ocamlcc -I /home/edwin/.opam/4.00.1/include/ocamlcc/ocamlcc-byterun-4.00 -lm -ldl -lcurses -Wl,-E -O3 -Wall'.../tmp/cc5Zsv1r.o: In function `f4823':
tmp-ocamlcc-f2c38d.c:(.text+0xce2): undefined reference to `unix_gettimeofday'
/tmp/cc5Zsv1r.o: In function `ocamlcc_bytecode_main':
tmp-ocamlcc-f2c38d.c:(.text+0x32c9b): undefined reference to `unix_inet_addr_of_string'
tmp-ocamlcc-f2c38d.c:(.text+0x32ccc): undefined reference to `unix_inet_addr_of_string'
tmp-ocamlcc-f2c38d.c:(.text+0x32d91): undefined reference to `unix_inet_addr_of_string'
tmp-ocamlcc-f2c38d.c:(.text+0x32e79): undefined reference to `unix_inet_addr_of_string'
tmp-ocamlcc-f2c38d.c:(.text+0x32f87): undefined reference to `unix_gettimeofday'
collect2: error: ld returned 1 exit status
 [6.09s]
Error: command '/home/edwin/bin/gcc -D_FILE_OFFSET_BITS=64 /tmp/tmp-ocamlcc-f2c38d.c -I /home/edwin/.opam/4.00.1/include/ocamlcc -I /home/edwin/.opam/4.00.1/include/ocamlcc/ocamlcc-byterun-4.00 -lm -ldl -lcurses -Wl,-E -O3 -Wall' failed.
+ Removing "/tmp/tmp-ocamlcc-f2c38d.c"... done

$ ocamlfind ocamlc x.ml -package unix -linkpkg -o x.byte -custom
$ ocamlcc -verbose x.byte
+ Running '"/home/edwin/.opam/4.00.1/bin/ocamlclean" "x.byte" -o "/tmp/tmp-ocamlcc-c868a0.byte"'... [0.11s]
+ Loading "/tmp/tmp-ocamlcc-c868a0.byte".....    [0.01s]
+ Decompiling functions....                      [0.01s]
+ Folding closures...                            [0.01s]
+ Remapping stack access...                      [0.00s]
+ Computing cell types.....                      [0.12s]
+ Cleaning functions.....                        [0.00s]
+ Generating C code...                           [0.01s]
+ Generating "/tmp/tmp-ocamlcc-30d075.c"...      [0.02s]
+ Removing "/tmp/tmp-ocamlcc-c868a0.byte"... done
+ Running '/home/edwin/bin/gcc -D_FILE_OFFSET_BITS=64 /tmp/tmp-ocamlcc-30d075.c -I /home/edwin/.opam/4.00.1/include/ocamlcc -I /home/edwin/.opam/4.00.1/include/ocamlcc/ocamlcc-byterun-4.00 -lm -ldl -lcurses -Wl,-E -O3 -Wall'.../tmp/ccFu7kNe.o: In function `f4823':
tmp-ocamlcc-30d075.c:(.text+0xce2): undefined reference to `unix_gettimeofday'
/tmp/ccFu7kNe.o: In function `ocamlcc_bytecode_main':
tmp-ocamlcc-30d075.c:(.text+0x32c9b): undefined reference to `unix_inet_addr_of_string'
tmp-ocamlcc-30d075.c:(.text+0x32ccc): undefined reference to `unix_inet_addr_of_string'
tmp-ocamlcc-30d075.c:(.text+0x32d91): undefined reference to `unix_inet_addr_of_string'
tmp-ocamlcc-30d075.c:(.text+0x32e79): undefined reference to `unix_inet_addr_of_string'
tmp-ocamlcc-30d075.c:(.text+0x32f87): undefined reference to `unix_gettimeofday'
collect2: error: ld returned 1 exit status
 [6.11s]
Error: command '/home/edwin/bin/gcc -D_FILE_OFFSET_BITS=64 /tmp/tmp-ocamlcc-30d075.c -I /home/edwin/.opam/4.00.1/include/ocamlcc -I /home/edwin/.opam/4.00.1/include/ocamlcc/ocamlcc-byterun-4.00 -lm -ldl -lcurses -Wl,-E -O3 -Wall' failed.
+ Removing "/tmp/tmp-ocamlcc-30d075.c"... done

$ ocamlcc -verbose x.byte -ccopts -L`ocamlfind query unix` -ccopts -lunix
+ Running '"/home/edwin/.opam/4.00.1/bin/ocamlclean" "x.byte" -o "/tmp/tmp-ocamlcc-d9b53c.byte"'... [0.08s]
+ Loading "/tmp/tmp-ocamlcc-d9b53c.byte".....    [0.01s]
+ Decompiling functions....                      [0.01s]
+ Folding closures...                            [0.01s]
+ Remapping stack access...                      [0.00s]
+ Computing cell types.....                      [0.09s]
+ Cleaning functions.....                        [0.00s]
+ Generating C code...                           [0.01s]
+ Generating "/tmp/tmp-ocamlcc-a7b66f.c"...      [0.02s]
+ Removing "/tmp/tmp-ocamlcc-d9b53c.byte"... done
+ Running '/home/edwin/bin/gcc -D_FILE_OFFSET_BITS=64 /tmp/tmp-ocamlcc-a7b66f.c -I /home/edwin/.opam/4.00.1/include/ocamlcc -I /home/edwin/.opam/4.00.1/include/ocamlcc/ocamlcc-byterun-4.00 -lm -ldl -lcurses -Wl,-E -O3 -Wall "-L/home/edwin/.opam/4.00.1/lib/ocaml" "-lunix"'... [6.11s]
+ Removing "/tmp/tmp-ocamlcc-a7b66f.c"... done

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.