I'm trying to compile an SDL gui application (using SDL, SDL_mixer, SDL_image, and SDL_ttf). While statically linking would be great, just so long as it's portable, even as a binary archive, that's all that I really need.
On Linux, I have tried to create a bash script that is run first with LD_LIBRARY_PATH=path/to/libs ./myProgram, but I end up with the same error, SDL2 not found. On Windows, the lazy method would just be to dump all the dlls with the exe file and it works. Ideally, I'm hoping that there is a way (on both Linux and Windows) to be able to specify a libs folder that has everything and that way it doesn't clutter up around the actual binary.
Is there a compiler flag that would do this on Linux and Windows or even a 3rd party tool that is recommended post compilation to make those changes?
Thanks for the help.
On Windows, the lazy method would just be to dump all the dlls with the exe file and it works.
This is not the "lazy" way, it's the recommended way.
it doesn't clutter up around the actual binary.
On Windows you typically run games by clicking on a shortcut, not by navigating to the directory in search of a .exe file...
On Linux, I have tried to create a bash script that is run first with LD_LIBRARY_PATH=path/to/libs ./myProgram, but I end up with the same error, SDL2 not found.
There is also RDPATH but I forgot how it works.
There is a special RPATH value $ORIGIN which will do what you need. Not sure how you can pass the linker flag from Nim directly, but basically you can read about that value here:
@Araq I guess I was expecting a more convoluted process and with it being as quick as it was, it just somehow didn't seem like that was the correct way of doing it.
@blashyrk92 I had tried rpath, but I had actually tried to do it during the compilation step. That was probably a big no no.
Using patchelf, everything went off without a hitch. Just made sure that I did the tar command correctly to make sure symlink was preserved (and their targets) and it was all good to go.
Thanks for the help both of y'all. I really do appreciate it.