Quantcast
Channel: OCaml - Topics tagged dune
Viewing all articles
Browse latest Browse all 521

Linking problem in compiling my binding of Allegro 5

$
0
0

Hello. I am working on a binding of Allegro 5, a C library similar to SDL, aimed at video games.

It compiles well with my default switch which uses OCaml 5.2, but I can’t have it to compile with OCaml 4 compilers. I discovered this problem because I want to publish my package in opam-repository. You can see here the compilation errors. There is also a failure for OCaml 5.3 on Fedora. I require ocaml>=4.12 because previous compilers apparently don’t have Val_none. The repository of my binding is here.

I am able to reproduce the problem locally with an opam switch with OCaml 4.14.2. The error message is:

File "lib/dune", lines 19-26, characters 0-277:
19 | (library
20 |  (name al5)
21 |  (public_name allegro5)
22 |  (foreign_stubs
23 |   (language c)
24 |   (names al5 display events graphics keyboard mouse system time timer font image primitives)
25 |   (flags -std=c11 -Wall -O2 -I -fPIC (:include c_flags.sexp)))
26 |  (c_library_flags (:include lib_flags.sexp)))
/usr/bin/ld: lib/display.o: warning: relocation against `Caml_state' in read-only section `.text'
/usr/bin/ld: lib/timer.o: relocation R_X86_64_PC32 against undefined symbol `Caml_state' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status

This is not particularly related to the display and timer modules, because if I remove them, I get the same error messages on the remaining modules.

What should I do?

4 posts - 4 participants

Read full topic


Viewing all articles
Browse latest Browse all 521

Trending Articles