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
Teach ocamlbuild to create shared libraries using -output-obj #6733
Comments
Comment author: @gasche If you have a working patch to provide, I'm interested. |
Comment author: @whitequark @gasche, I added a patch. It adds the .so targets, and also a runtime_variant parametric flag. The flag is needed on, I think, mainly x86, where all code in a shared library must be linked with -fPIC. On e.g. ARM, there is no such restriction. Until #6693 is fixed, the ocamlbuild testsuite will fail (on x86, at least). I did not add a runtime_variant(_shared) flag to the default tags for .so targets, because:
I think it is OK to leave the default tags as-is, or if there will be a _pic variant of the runtime--a .a archive built with -fPIC--we could add runtime_variant(_pic) so that everything builds by default on all platforms. Having to manually specify "-runtime_variant(_pic), runtime_variant(_some_other)" is a bit awkward, but should be rarely needed. |
Comment author: @gasche Using the proposed patch, the test fails on my machine with the following log: /home/gasche/.opam/4.03.0+local-git-trunk/bin/ocamldep.opt -modules hello.ml > hello.ml.depends
Indeed, #6693 builds no libasmrun_shared.a, only libasmrun_shared.so. |
Comment author: @whitequark It should work if you replace runtime_variant(_shared) with runtime_variant(_pic) (which really makes much more sense for users, as libasmrun_shared.so is not in the library search path.) |
Comment author: @gasche Merged in 4.02 and trunk, thanks! |
Original bug ID: 6733
Reporter: @whitequark
Assigned to: @gasche
Status: closed (set by @xavierleroy on 2017-02-16T14:15:07Z)
Resolution: fixed
Priority: normal
Severity: feature
Fixed in version: 4.02.2+dev / +rc1
Category: -for ocamlbuild use https://github.com/ocaml/ocamlbuild/issues
Tags: patch
Related to: #6693 #6797 #6845 #6918 #6927
Monitored by: @hcarty
Bug description
Currently I am using the following code (parts of which are pulled into myocamlbuild, not being accessible from ocamlbuild library):
Then, I just do
ocamlbuild foo.native.so
. It works flawlessly.Possibly it is also useful to provide
foo.byte.so
.File attachments
The text was updated successfully, but these errors were encountered: