Doubt with GZDoom compiling process

Need help running G/Q/ZDoom/ECWolf/Zandronum/3DGE/EDuke32/Raze? Did your computer break? Ask here.

Moderator: GZDoom Developers

Forum rules
Contrary to popular belief, we are not all-knowing-all-seeing magical beings!

If you want help you're going to have to provide lots of info. Like what is your hardware, what is your operating system, what version of GZDoom/LZDoom/whatever you're using, what mods you're loading, how you're loading it, what you've already tried for fixing the problem, and anything else that is even remotely relevant to the problem.

We can't magically figure out what it is if you're going to be vague, and if we feel like you're just wasting our time with guessing games we will act like that's what you're really doing and won't help you.
Posts: 16
Joined: Wed Oct 02, 2019 9:39 am

Doubt with GZDoom compiling process

Post by sacarias »

Built GZDoom on Debian 11 on build directory $HOME/gzdoom_build, using cmake flags -DZMUSIC_LIBRARIES=$HOME/zmusic_build/source/ -DZMUSIC_INCLUDE_DIR=$HOME/zmusic_build/include

This works, albeit it's built exactly with runpath (or rpath, not sure...) /home/<user>/zmusic_build/source, as shown by command:

Code: Select all

readelf -d gzdoom_build/gzdoom | grep -i runpath
Which causes GZDoom to fail to run if zmusic_build directory is moved anywhere else, giving error

Code: Select all

error while loading shared libraries: cannot open shared object file: No such file or directory
I tried a possible solution: copy zmusic_build directory inside gzdoom_build, symlink directly inside gzdoom_build, and modify the gzdoom binary's rpath/runpath to $ORIGIN, by using "patchelf" command, which makes binary read all its needed libraries from binary's current location.
It seemingly worked. Now GZDoom can be run even if moving entire gzdoom_build directory anywhere.

Now what I wanted to try asking is, can't this be done somehow since building time? Don't know, with some cmake options or the like... to make binary read all needed libraries from its current location, without the patchelf step.

Thanks for your help.
Posts: 16
Joined: Wed Oct 02, 2019 9:39 am

Re: Doubt with GZDoom compiling process

Post by sacarias »

Ok, after a forum search I found this:
Now I need to search how to do "link executable with -Wl,-rpath='$ORIGIN'"...
And what's the -Wl option for?
User avatar
Posts: 255
Joined: Sat Dec 12, 2020 10:59 am
Preferred Pronouns: He/Him
Operating System Version (Optional): Void Linux
Graphics Processor: Intel (Modern GZDoom)
Location: Independence, KS, USA

Re: Doubt with GZDoom compiling process

Post by KynikossDragonn »

You can just add a CMAKE_INSTALL_RPATH with it set to $ORIGIN, then when you run the install target it will automatically set RPATH to $ORIGIN during the stripping process.

If you're confused this is where I looked it up: ... H-handling

Just make sure you set the install prefix to something other than /usr/local of course. I usually set it to a "buildinstall" directory inside of the "build" directory I'm running the entire build process on in the cloned repository.

You can then copy the resulting binary anywhere and it should find the ZMusic library in the same location as the binary is executed from, providing you place it there.

It might be easier to use the CMake GUI tool, you can manually insert your own options in it even if they're not present in the CMakeLists.

Return to “Technical Issues”