Page 2 of 2

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

PostPosted: Wed Oct 21, 2020 8:59 am
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.

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

PostPosted: Wed Nov 04, 2020 10:17 pm
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 .

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

PostPosted: Thu Apr 08, 2021 2:24 pm
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.

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

PostPosted: Thu Apr 08, 2021 2:33 pm
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.

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

PostPosted: Thu Apr 08, 2021 3:39 pm
by axredneck
Meanwhile Arch Linux has ZMusic in AUR

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

PostPosted: Thu Apr 08, 2021 4:10 pm
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.

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

PostPosted: Thu Apr 08, 2021 4:17 pm
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.

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

PostPosted: Thu Apr 08, 2021 4:34 pm
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.

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

PostPosted: Thu Apr 08, 2021 5:01 pm
by mjr4077au
Then just make a package with dpkg so it's tracked?

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

PostPosted: Thu Apr 08, 2021 5:08 pm
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?

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

PostPosted: Thu Apr 08, 2021 5:14 pm
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.

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

PostPosted: Thu Apr 08, 2021 5:58 pm
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.

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

PostPosted: Fri Apr 09, 2021 12:01 pm
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).

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

PostPosted: Sat Apr 10, 2021 11:41 am
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.

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

PostPosted: Sat Apr 10, 2021 6:01 pm
by LitterboxGremlin
Cool, guys. Both of those are better ways than what I did. I'll try that next time.