Page 1 of 1

How to compile minetest with libraries packaged w/ excecutable

PostPosted: Tue Mar 26, 2013 12:20
by Traxie21
I'd like to compile Minetest on Linux, but I want to compile it with the required libraries included wuth the excecutable, similar to how Windows does ir.

Any tips/instructions?
NOTE: I will be compiling on a remote server.

PostPosted: Wed Mar 27, 2013 04:34
by prestidigitator
The easiest way would probably be to link the library, then analyze its dependencies, copy the libraries to the application directory somewhere, and modify the paths the executable uses to search for libraries (probably to include a relative path). Use "ldd" to determine what libraries an executable or library depends on, and where they were found at link time. To change where the system looks for the libraries, see http://en.wikipedia.org/wiki/Rpath. It would probably be helpful to create a launcher script to set variables like LD_LIBRARY_PATH and/or (if you change the executable's built-in search path) the current working directory before launching the actual application binary. You'll probably want to exclude libraries that will be found in default locations on just about every system (probably meaning anything under /lib instead of /usr/lib).

There are other ways, but they are often going to involve changing the build system. That's probably going to mean familiarizing yourself with cmake, make, g++, and/or Minetest's particular makefiles. So I suggest trying the above first.