-
Notifications
You must be signed in to change notification settings - Fork 410
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1.0+beta18 breaks my ugly (hum) project #573
Comments
Basically we need #23 to do this properly. I've been meaning to take a stab at finishing it, I'll try to do that soon |
The reason it broke with beta18 is that we moved the .cmi files to separate per-library directories. We do that as OCaml relies on include directories and it's the only way to hide files it shouldn't see. For the workaround, I think there might be a |
Understood and solved by adding grande.cm{i,x} dependencies in the missing places. Thanks |
FTR, #23 has just been merged. You can now define an |
This merge solved point 3, because it introduced $(ext_dll) etc. But I do not know how to specify my C stub and .h file? The library options (c_names and install_c_headers) do not work with executable stanza. I'm not sure I can build a ML + C shared object with executable in shared_object mode? |
In this case, you need to split your executable into a library and an executable. Attach the c_names to the library and put |
Sorry: I did not succeed :-( |
I just tried with the development version of jbuilder and it seems to work:
|
I just adapted the test repository https://github.com/ttamttam/ocaml-dune-shared-object-test#makefile-targets:
(see https://github.com/ttamttam/ocaml-dune-shared-object-test/blob/master/README.org#automatic) I thank you for your patience. |
So there are two problems:
|
Let me thank you again! I should have spotted the first point. The second one seems less obvious to me. The modifications for a working solution:
Despite the |
No problem. I guess we should allow to have C stubs for executables, that would make such cases a bit simpler |
I don't know if a lot of people turn their OCaml code as shared object? Difficult to say if it's worth it? This morning, I did go on with my tests, and found a small problem on cygwin with $ uname -a
CYGWIN_NT-10.0 DESKTOP-9DIKPMF 2.9.0(0.318/5/3) 2017-09-12 10:18 x86_64 Cygwin
$ opam switch show
4.06.0+flambda+mingw64c The DLL does not compile with "-runtime-variant _pic". I ran the command manually without it to generate it (and tested manually that it works fine): $ jbuilder build automatic/dll/direct.dll
ocamlopt automatic/dll/direct.dll (exit 2)
(cd _build/default && C:\OCaml64\home\MatthieuDubuget\.opam\4.06.0+flambda+mingw64c\bin\ocamlopt.opt.exe -w -40 -g -o automatic/dll/direct.dll -cclib -lws2_32 -cclib -lversion -output-complete-obj -runtime-variant _pic -I automatic/libstubed -I lib lib/mylib.cmxa automatic/libstubed/mylibstubed.cmxa automatic/dll/.direct.eobjs/direct.cmx)
File "caml_startup", line 1:
Error: Cannot find file libasmrun_pic.a
$ cd _build/default/
$ ocamlopt.opt.exe -w -40 -g -o automatic/dll/direct.dll -cclib -lws2_32 -cclib -lversion -output-complete-obj -I automatic/libstubed -I lib lib/mylib.cmxa automatic/libstubed/mylibstubed.cmxa automatic/dll/.direct.eobjs/direct.cmx
|
This is mingw, not cygwin. I'm not sure why |
No PIC on Windows... |
@ttamttam since you've said that this issue is resolved [1], I'm closing this ticket. [1] #635 (comment) |
I have a small project in which I ab-used (mis-used?)
dune
in order to build a shared object instead of a library. Since revision1.0+beta18
,dune
fails to compile my project.I'm not sure if my ugly hack is necessary? Is there a better way, or the possibility to improve dune to manage shared-object target?
Is it a problem with
1.0+beta18,
or is it due to a non-conventional use ofdune
?The real
jbuild
file (see below) is generated (The first line is(* -*- tuareg -*- *)
), because it must be slightly adapted, depending on the target architecture (For Windows: so -> dll, "-runtime-variant _pic" -> ""): is there a better solution to solve this kind of portability issue?Structure of my project:
The non-conventional jbuild file:
With 1.0+beta17:
With 1.0+beta18:
Thanks for this nice program, and for your time!
The text was updated successfully, but these errors were encountered: