Open CGenie opened 1 year ago
Ah, ok, nvm, it seems it's possible with system_libs
https://github.com/ityonemo/zigler/blob/master/lib/zig/templates/build.zig.eex#L35
Hm, however I'm still getting this error:
10:58:43.779 [error] loading module libElixir.Utils.Proj {:load_failed, 'Failed to load NIF library .../_build/dev/lib/utils/ebin/libElixir.Utils.Proj: \'libproj.so.25: cannot open shared object file: No such file or directory\''}
My /nix/store/2sgdzvhnmai3xsgn1f3p7p03vp3852yj-proj-9.0.0/lib
directory looks like this:
total 2615
lrwxrwxrwx 1 xxx xxx 13 Jan 1 1970 libproj.so -> libproj.so.25
lrwxrwxrwx 1 xxx xxx 19 Jan 1 1970 libproj.so.25 -> libproj.so.25.9.0.0
-r-xr-xr-x 1 xxx xxx 4957392 Jan 1 1970 libproj.so.25.9.0.0
if you are still running into this, in the meantime, I would suggest using dlopen/dlsym directly, i have had a lot of success with this strategy.
Hello,
I'm currently using nixos for my project. The directory structure there is quite complex, eg. the proj lib is in
/nix/store/2sgdzvhnmai3xsgn1f3p7p03vp3852yj-proj-9.0.0/lib/libproj.so
and in fact it's a symlink tolibproj.so.25
which is a symlink tolibproj.so.25.9.0.0
.I noticed that zigler copies the files specified in the
libs
setting, so for symlinks it won't work. I also cannot specifylibproj.so.25.9.0.0
in libs as I'm getting a compile error with 'invalid library file'.To get out of this mess, I made a small test project that uses SDL2 with nix. I added
sdl2
with a simpleexe.linkSystemLibrary("sdl2")
(apparently this usespkg-config
as described here https://zig.news/xq/zig-build-explained-part-3-1ima in the "system libraries" section).So my question is: could zigler use
pkg-config
as well so that I can specifyproj
inlibs
and don't care about paths?