Can't compile on Linux (something about ZMusic)

LitterboxGremlin
Posts: 11
Joined: Thu Mar 31, 2016 7:43 am

Re: Can't compile on Linux (something about ZMusic)

Post by LitterboxGremlin »

So if I understand you, it sounds like from now on if I want to compile Raze or GZDoom, I will have to have this separate ZMusic library somewhere on my system. Whatever path I set, it will be locked to that path and the executable will break if I move the library. It can't be portable and self-contained anymore. Is that correct? Is there some way to use -DZMUSIC_INCLUDE_DIR=… and -DZMUSIC_LIBRARIES=…. to set path to the library relative to the executable so I can put the executable alongside the library or something?

When I say relative to the executable, I mean that I want to put the Raze executable in a "Raze" folder along with the zmusic.so and be able to abitrarily place that Raze folder anywhere and move it around at will without breaking anything.
User avatar
morb
Posts: 35
Joined: Sun Mar 08, 2020 12:23 pm
Graphics Processor: Intel (Modern GZDoom)
Contact:

Re: Can't compile on Linux (something about ZMusic)

Post by morb »

You could copy libzmusiclite.so.1 into your raze directory and make a wrapper script like the following;

---
#!/bin/sh

LD_PRELOAD=./libzmusiclite.so.1 ./raze $@
---

Make sure that you `chmod +x` the script afterwards then you can move the directory arbitrarily across any point of your filesystem.

There's several other approaches you can take without recompiling/relinking, such as hardcoding raze's rpath for libzmusiclite with patchelf to .
LitterboxGremlin
Posts: 11
Joined: Thu Mar 31, 2016 7:43 am

Re: Can't compile on Linux (something about ZMusic)

Post by LitterboxGremlin »

That still doesn't allow Raze to compile on linux. Basically Raze (and GZDoom) cannot compile on linux without first compiling and installing the ZMusic library outside the user directory. This is not recommended, because it can break your linux installation. The way around this for GZDoom is to install the flatpak version that some kind soul has made, but the old method of compiling GZDoom which is still shown on the wiki page no longer works.

For Raze, there is no solution except I guess to play the windows version through wine. This is all basically due to the decision to separate ZMusic from these programs.

I don't mean to be rude. I know this is a volunteer project and it's early days, but maybe people don't realize this is what's going on for linux users. I'd like to help bugtest but I can't.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49223
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Can't compile on Linux (something about ZMusic)

Post by Graf Zahl »

You have to complain to the people who thought that this setup would be acceptable for Linux. I've been always on the record that I find this way of managing libraries rather stupid but have always fallen on deaf ears with it.

But what's so bad about ZMusic that it can break the Linux installation? It's a harmless library, stuff you have to install for virtually every piece of software.
User avatar
axredneck
Posts: 421
Joined: Mon Dec 11, 2017 2:09 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): Arch
Graphics Processor: nVidia with Vulkan support
Location: Russia
Contact:

Re: Can't compile on Linux (something about ZMusic)

Post by axredneck »

Meanwhile Arch Linux has ZMusic in AUR
LitterboxGremlin
Posts: 11
Joined: Thu Mar 31, 2016 7:43 am

Re: Can't compile on Linux (something about ZMusic)

Post by LitterboxGremlin »

Graf Zahl wrote:You have to complain to the people who thought that this setup would be acceptable for Linux. I've been always on the record that I find this way of managing libraries rather stupid but have always fallen on deaf ears with it.

But what's so bad about ZMusic that it can break the Linux installation? It's a harmless library, stuff you have to install for virtually every piece of software.

It's nothing about ZMusic per se. The problem is that on debian-based distributions, system files are installed by a package manager. If you install files outside that system, the package manager doesn't know about those files, and when you upgrade, bad things could happen. There are several ways I can think around this problem.
-First, someone (maybe end users even) could build Zmusic and make it into a deb package and install it that way. I don't know how to do that myself, though. You'd also have to have the exact version of zmusic needed every time you updated Raze/GZDoom. Maybe not always easy to know which one.
-Second, the makefile could be set up to build against a precompiled ZMusic. I think this is already what's done on Windows.
-Third, the makefile could be set up to build the zmusic library and link it to the executable the same way it already is with other libraries.

Probably there are a lot of other ways too that I don't know about because I'm not a programmer.
User avatar
mjr4077au
Posts: 830
Joined: Sun Jun 16, 2019 9:17 pm
Graphics Processor: nVidia with Vulkan support
Location: Gosford NSW, Australia
Contact:

Re: Can't compile on Linux (something about ZMusic)

Post by mjr4077au »

If you're going to be building lots of packages that are not in the package manager, I'd recommend moving to a distro that's better suited for this. I can't recommend Arch Linux or a derivative enough. Their AUR has build scripts to make packages out of ZMusic and Raze so the installs are tracked and managed appropriately.
LitterboxGremlin
Posts: 11
Joined: Thu Mar 31, 2016 7:43 am

Re: Can't compile on Linux (something about ZMusic)

Post by LitterboxGremlin »

mjr4077au wrote:If you're going to be building lots of packages that are not in the package manager, I'd recommend moving to a distro that's better suited for this. I can't recommend Arch Linux or a derivative enough. Their AUR has build scripts to make packages out of ZMusic and Raze so the installs are tracked and managed appropriately.
This is the only program, though. I have no intention of switching distributions.
User avatar
mjr4077au
Posts: 830
Joined: Sun Jun 16, 2019 9:17 pm
Graphics Processor: nVidia with Vulkan support
Location: Gosford NSW, Australia
Contact:

Re: Can't compile on Linux (something about ZMusic)

Post by mjr4077au »

Then just make a package with dpkg so it's tracked?
LitterboxGremlin
Posts: 11
Joined: Thu Mar 31, 2016 7:43 am

Re: Can't compile on Linux (something about ZMusic)

Post by LitterboxGremlin »

mjr4077au wrote:Then just make a package with dpkg so it's tracked?
Yeah, I'm trying to figure out how to do that. Any pointers? Firstly, where do the libraries need to be installed? Also, is there going to be a mismatch where I try to build Raze and GZDoom but they require different versions of the library?
User avatar
mjr4077au
Posts: 830
Joined: Sun Jun 16, 2019 9:17 pm
Graphics Processor: nVidia with Vulkan support
Location: Gosford NSW, Australia
Contact:

Re: Can't compile on Linux (something about ZMusic)

Post by mjr4077au »

It's been quite a few years, but have a read through these:

https://wiki.debian.org/BuildingTutorial
https://debian-handbook.info/browse/sta ... aging.html

GZDoom and Raze could be at different version requirements, yeah, but I don't think there's been an ABI change for awhile now.
LitterboxGremlin
Posts: 11
Joined: Thu Mar 31, 2016 7:43 am

Re: Can't compile on Linux (something about ZMusic)

Post by LitterboxGremlin »

I have been successful, so I will post what I did for future users of debian based systems that have my problem. Keep in mind, as ZMusic is updated, these instructions will change. This is for version 1.1.3. Also, this is not the best solution because both GZDoom and Raze may depend on different versions of ZMusic. Be aware of that. There are probably more gotchas.

1) Download and compile ZMusic. Set proper permissions. On the libraries chown root:root, etc. Make them match the other libraries on your system, basically.

2) Create the following file structure somewhere:
~/package/DEBIAN/
~/package/usr/local/lib/
~/package/usr/local/include/

3) Inside ~/package/DEBIAN/ create a file named "control" with the following contents:
Package: zmusic
Version: 1.1.3
Section: unknown
Priority: optional
Depends: libc6, zlib1g, libasound2, libstdc++6, libgcc1, libgcc-8-dev
Architecture: amd64
Essential: no
Installed-Size: 3521
Maintainer: litterboxgremlin
Description: ZMusic library for Raze and GZDoom

4) From where you compiled your ZMusic, place the file "zmusic.h" inside ~/package/usr/local/include

5) Inside ~/package/usr/local/lib/ place all the lib files: libzmusic, libzmusiclite (6 files)

6) Go back to ~/ and do this: "dpkg-deb --build ./package"

7) sudo apt install ~/package.deb

Now when you try to compile Raze it works.
User avatar
Chris
Posts: 2969
Joined: Thu Jul 17, 2003 12:07 am
Graphics Processor: ATI/AMD with Vulkan/Metal Support

Re: Can't compile on Linux (something about ZMusic)

Post by Chris »

LitterboxGremlin wrote:That still doesn't allow Raze to compile on linux. Basically Raze (and GZDoom) cannot compile on linux without first compiling and installing the ZMusic library outside the user directory.
Yes you can. Run cmake with the parameter -DCMAKE_INSTALL_PATH=$HOME/.local for ZMusic and Raze/GZDoom, install zmusic, then you can build and run raze/gzdoom from their build directories without installing them. It's all kept in the user directory without root permissions this way. Optionally, you can install raze/gzdoom, and create launcher scripts to run $HOME/.local/bin/gzdoom (or raze) with LD_LIBRARY_PATH set to $HOME/.local/lib (unless you static-linked zmusic, then you can just run the executable without setting LD_LIBRARY_PATH).
Blzut3
 
 
Posts: 3202
Joined: Wed Nov 24, 2004 12:59 pm
Graphics Processor: ATI/AMD with Vulkan/Metal Support
Contact:

Re: Can't compile on Linux (something about ZMusic)

Post by Blzut3 »

Since I rewrote the CMake project for ZMusic you can actually use "make package" to generate debs and install those. Still need to finish fully integrating with GZDoom and Raze (WIP of GZDoom is on my github fork for the curious), but should allow you to install to the system and have it tracked by apt without all those steps.
LitterboxGremlin
Posts: 11
Joined: Thu Mar 31, 2016 7:43 am

Re: Can't compile on Linux (something about ZMusic)

Post by LitterboxGremlin »

Cool, guys. Both of those are better ways than what I did. I'll try that next time.
Post Reply

Return to “General”