I've build a small elixir application that uses NIF functions to execute some c++ code. The nifs are loaded via:
def load_nifs do
and this works fine. Now I want to integrate this app into another project. The problem now is that load_nif throws: Failed to load NIF library: '<relative_path_to_lib>/<lib_name>.so: cannot open shared object file: No such file or directory'' although nothing has changed. I checked the deps folder and the shared library files are exactly where they are supposed to be, so the dependency seems to be loaded correctly. I also tried putting the .so files into the same folder as the module that calls load_nif (and omit <relative_path_to_lib>/) as well as providing an absolute path, all to no avail.
Any help is appreciated, Cheers.
The issue does not seem to be that files are located at the wrong place, as it finds the files during the first test run after compilation. However, the error occurs when I repeat the run. It seems that the error message is wrong, since no files are deleted during the test.
If I repeat the function within one test multiple times there's no problem, so the issue is not created because the NIF function is executed multiple times, but because the test that contains the function is repeated multiple times.
I still have no idea what causes this behavior but after putting the .so files into a priv directory and accessing them via
the tests pass.