Can't compile on Linux (something about ZMusic)

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

Postby LitterboxGremlin » Wed Oct 21, 2020 8:59 am

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.
LitterboxGremlin
 
Joined: 31 Mar 2016

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

Postby morb » Wed Nov 04, 2020 10:17 pm

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 .
User avatar
morb
 
Joined: 08 Mar 2020
Github ID: m0rb
Operating System: Other Linux 64-bit
OS Test Version: Yes (Using Development/Testing Version)
Graphics Processor: Intel (Modern GZDoom)

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

Postby LitterboxGremlin » Thu Apr 08, 2021 2:24 pm

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.
LitterboxGremlin
 
Joined: 31 Mar 2016

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

Postby Graf Zahl » Thu Apr 08, 2021 2:33 pm

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
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany

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

Postby axredneck » Thu Apr 08, 2021 3:39 pm

Meanwhile Arch Linux has ZMusic in AUR
User avatar
axredneck
excuse me for my bad English
 
Joined: 11 Dec 2017
Location: Russia
Github ID: axredneck
Operating System: Other Linux 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

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

Postby LitterboxGremlin » Thu Apr 08, 2021 4:10 pm

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.
LitterboxGremlin
 
Joined: 31 Mar 2016

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

Postby mjr4077au » Thu Apr 08, 2021 4:17 pm

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.
User avatar
mjr4077au
 
Joined: 16 Jun 2019
Location: Gosford NSW, Australia
Discord: mjr4077au#1027
Github ID: mjr4077au
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

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

Postby LitterboxGremlin » Thu Apr 08, 2021 4:34 pm

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.
LitterboxGremlin
 
Joined: 31 Mar 2016

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

Postby mjr4077au » Thu Apr 08, 2021 5:01 pm

Then just make a package with dpkg so it's tracked?
User avatar
mjr4077au
 
Joined: 16 Jun 2019
Location: Gosford NSW, Australia
Discord: mjr4077au#1027
Github ID: mjr4077au
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

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

Postby LitterboxGremlin » Thu Apr 08, 2021 5:08 pm

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?
LitterboxGremlin
 
Joined: 31 Mar 2016

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

Postby mjr4077au » Thu Apr 08, 2021 5:14 pm

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.
User avatar
mjr4077au
 
Joined: 16 Jun 2019
Location: Gosford NSW, Australia
Discord: mjr4077au#1027
Github ID: mjr4077au
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

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

Postby LitterboxGremlin » Thu Apr 08, 2021 5:58 pm

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.
LitterboxGremlin
 
Joined: 31 Mar 2016

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

Postby Chris » Fri Apr 09, 2021 12:01 pm

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).
User avatar
Chris
 
Joined: 17 Jul 2003

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

Postby Blzut3 » Sat Apr 10, 2021 11:41 am

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.
Blzut3
Pronounced: B-l-zut
 
 
 
Joined: 24 Nov 2004
Github ID: Blzut3
Operating System: Debian-like Linux (Debian, Ubuntu, Mint, etc) 64-bit
Graphics Processor: ATI/AMD with Vulkan Support

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

Postby LitterboxGremlin » Sat Apr 10, 2021 6:01 pm

Cool, guys. Both of those are better ways than what I did. I'll try that next time.
LitterboxGremlin
 
Joined: 31 Mar 2016

Previous

Return to General

Who is online

Users browsing this forum: No registered users and 0 guests