-
Notifications
You must be signed in to change notification settings - Fork 97
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
Another static linking issue #541
Comments
I finally got the library to get linked in statically, so that the compiled binary does contain the symbol |
Got it figured out. For posterity my
|
The following is a (simple) hack (see bottom of post), but it worked for me. I'm using jbuilder/dune in my case, but I don't think it matters. ( My setup/problem, for posterityMy use case is writing bindings for a library that is shipped as a single C file. The library doesn't have any additional dependencies. Simple enough one would think... I have these files:
cat jbuild:
c_flags matter for my target library, but not in general. I then use these bindings in another project as normal:
This compiles fine with The hackThen there is this helpful bit from @pqwy in #167:
All I want is to force All I did is put the following at the top of
I don't think it matter which symbol you reference, and you can still bind using Ctypes to the same symbol. The I'm sure there is a more sane way to do this, but I have to move on at this point. I hope this is helpful to someone. |
I'm on ubuntu, trying to link in a static library (a
.a
file.) It's a bit unclear what command is being executed since I'm using oasis, but the relevant part of my_oasis
file looks likeWhen I run my program I get
I also tried adding the flags
-Wl,-E
and-Wl,-no-as-needed
which I got from reading other issues, but they didn't help. Any help would be greatly appreciated!The text was updated successfully, but these errors were encountered: