Skip to content

Conversation

@maelvls
Copy link
Collaborator

@maelvls maelvls commented Dec 30, 2018

progress: 2% (I just started 😊)

@maelvls maelvls changed the title Move from oasis to dune Dec 30, 2018
@c-cube
Copy link
Owner

c-cube commented Jan 7, 2021

may you take a look? :)
did that in a hurry

@c-cube c-cube mentioned this pull request Jan 7, 2021
@maelvls maelvls changed the title [WIP 2%] Move from oasis to dune Jan 7, 2021
@maelvls
Copy link
Collaborator Author

maelvls commented Jan 7, 2021

Great work! I am struggling to make it work on macOS through 😅

At first, I couldn't build at all:

% dune build  
        bash src/quantor/libpicosat.a,src/quantor/libquantor.a,src/quantor/picosat.h,src/quantor/quantor.h (exit 2)
(cd _build/default/src/quantor && /usr/local/bin/bash -e -u -o pipefail -c '
  /usr/local/bin/gmake -s -C ../../libs clean
  /usr/local/bin/gmake -s -C ../../libs picosat-960/libpicosat.a
  /usr/local/bin/gmake -s -C ../../libs quantor-3.2/libquantor.a
  cp ../../libs/quantor-3.2/libquantor.a .
  cp ../../libs/picosat-960/libpicosat.a .
  cp ../../libs/quantor-3.2/quantor.h .
  cp ../../libs/picosat-960/picosat.h .
  /usr/local/bin/gmake -s -C ../../libs clean
')
make[1]: *** No rule to make target `clean'.  Stop.
gmake: *** [Makefile:24: clean] Error 2
Done: 137/152 (jobs: 1)%  

I removed the first make clean and it started working.

Then I had to add this to src/quantor/dune:

(install
 (section lib)
 (files picosat.h quantor.h libpicosat.a libquantor.a))

But then I still can't use a lib that uses qbf.quantor 😬 With touist for example:

dune build @install
dune install
opam install touist

I get:

    ocamlopt src/main.exe (exit 2)
(cd _build/default && /usr/local/bin/ocamlopt.opt -w @1..3@5..28@30..39@43@46..47@49..57@61..62-40 -strict-sequence -strict-formats -short-paths -keep-locs -g -o src/main.exe /Users/mvalais/.opam/ocaml-system/lib/re/re.cmxa /Users/mvalais/.opam/ocaml-system/lib/re/str/re_str.cmxa /Users/mvalais/.opam/ocaml-system/lib/menhirLib/menhirLib.cmxa /Users/mvalais/.opam/ocaml-system/lib/minisat/minisat.cmxa -I /Users/mvalais/.opam/ocaml-system/lib/minisat src/lib/touist.cmxa /Users/mvalais/.opam/ocaml-system/lib/qbf/qbf.cmxa /Users/mvalais/.opam/ocaml-system/lib/qbf/quantor/qbf_quantor.cmxa -I /Users/mvalais/.opam/ocaml-system/lib/qbf/quantor src/lib/qbf/touist_qbf.cmxa src/lib/yices2/touist_yices2.cmxa /usr/local/lib/ocaml/unix.cmxa -I /usr/local/lib/ocaml /Users/mvalais/.opam/ocaml-system/lib/cmdliner/cmdliner.cmxa src/.main.eobjs/native/dune__exe.cmx src/.main.eobjs/native/dune__exe__Version.cmx src/.main.eobjs/native/dune__exe__Main.cmx)
ld: warning: directory not found for option '-Lsrc/quantor'
ld: library not found for -lquantor
clang: error: linker command failed with exit code 1 (use -v to see invocation)
File "caml_startup", line 1:
Error: Error during linking
File "_none_", line 1:
Error: Error on dynamically loaded library: /Users/mvalais/.opam/ocaml-system/lib/stublibs/dllqbf_quantor_stubs.so: dlopen(/Users/mvalais/.opam/ocaml-system/lib/stublibs/dllqbf_quantor_stubs.so, 10): Symbol not found: _picosat_add
  Referenced from: /Users/mvalais/.opam/ocaml-system/lib/stublibs/dllqbf_quantor_stubs.so
  Expected in: flat namespace
 in /Users/mvalais/.opam/ocaml-system/lib/stublibs/dllqbf_quantor_stubs.so
      ocamlc test/test.exe (exit 2)
(cd _build/default && /usr/local/bin/ocamlc.opt -w @1..3@5..28@30..39@43@46..47@49..57@61..62-40 -strict-sequence -strict-formats -short-paths -keep-locs -g -o test/test.exe -custom /Users/mvalais/.opam/ocaml-system/lib/re/re.cma /Users/mvalais/.opam/ocaml-system/lib/re/str/re_str.cma /Users/mvalais/.opam/ocaml-system/lib/menhirLib/menhirLib.cma /Users/mvalais/.opam/ocaml-system/lib/minisat/minisat.cma -I /Users/mvalais/.opam/ocaml-system/lib/minisat src/lib/touist.cma /Users/mvalais/.opam/ocaml-system/lib/qbf/qbf.cma /Users/mvalais/.opam/ocaml-system/lib/qbf/quantor/qbf_quantor.cma -I /Users/mvalais/.opam/ocaml-system/lib/qbf/quantor src/lib/qbf/touist_qbf.cma src/lib/yices2/touist_yices2.cma /usr/local/lib/ocaml/unix.cma -I /usr/local/lib/ocaml /Users/mvalais/.opam/ocaml-system/lib/stdlib-shims/stdlib_shims.cma /Users/mvalais/.opam/ocaml-system/lib/ounit2/advanced/oUnitAdvanced.cma /Users/mvalais/.opam/ocaml-system/lib/ounit2/oUnit.cma test/.test.eobjs/byte/dune__exe__Test.cmo)
ld: warning: directory not found for option '-Lsrc/quantor'
ld: library not found for -lquantor
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Not sure where to go from there :(

@c-cube
Copy link
Owner

c-cube commented Jan 7, 2021

I think it['s probably that the .so file isn't installed. We might want a (install …) section for it.

edit: or maybe the C stub stuff needs to statically link picosat in the .so

@maelvls
Copy link
Collaborator Author

maelvls commented Jan 8, 2021

Aaah the issue was just that libpicosat.a and libquantor.a libs had to be installed to $(opam var qbf:lib)/quantor instead of just $(opam var qbf:lib) 👍 Now it perfectly works!

Btw, do you mind if I move ./libs to ./src/quantor/vendor? I'll propose that in another PR


Ready to merge!

@maelvls maelvls requested a review from c-cube January 8, 2021 11:31
@c-cube c-cube merged commit 3788340 into master Jan 8, 2021
@c-cube c-cube deleted the move-to-dune branch January 8, 2021 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants