Page 1 of 1

How to build Raze on Linux? (Could NOT find ZMusic)

PostPosted: Fri Feb 14, 2020 4:25 am
by linuxunil
Hello everyone,

I'm trying to build Raze on Fedora 31, but when I run cmake .. I get the message
Code: Select allExpand view
Could NOT find ZMusic (missing: ZMUSIC_LIBRARIES ZMUSIC_INCLUDE_DIR)


Can someone tell me how to fix this step?

Thank you very much in advance.

Re: How to build Raze on Linux? (Could NOT find ZMusic)

PostPosted: Fri Feb 14, 2020 5:32 am
by _mental_
Build ZMusic.
Code: Select allExpand view
git clone https://github.com/coelckers/ZMusic.git
cd ZMusic
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=`pwd`/../build_install ..
make install

Build Raze with CMAKE_PREFIX_PATH set to full path to build_install directory.
Code: Select allExpand view
cd Raze
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=/full/path/to/ZMusic/build_install ..
make

Some commands could be simplified, but I have no idea what version of CMake you are using.

Re: How to build Raze on Linux? (Could NOT find ZMusic)

PostPosted: Fri Feb 14, 2020 5:40 am
by Graf Zahl
Is there any way to set the prefix path persistently? This is by far the greatest annoyance with CMake I have to deal with. If this could just be set up once, never to be bothered with again, it's solve an endless list of problems.

Re: How to build Raze on Linux? (Could NOT find ZMusic)

PostPosted: Fri Feb 14, 2020 6:30 am
by _mental_
Do you want to set it once for project, for build directory, or for CMake installation on the given PC? Is it about something like this?
In general, the idea is to set it explicitly for each build directory. Otherwise, use something predefined like /usr/local.

Re: How to build Raze on Linux? (Could NOT find ZMusic)

PostPosted: Fri Feb 14, 2020 6:47 am
by Graf Zahl
I want to let it point to some global directory where libraries are stored - the obvious use case being vcpkg.

Re: How to build Raze on Linux? (Could NOT find ZMusic)

PostPosted: Fri Feb 14, 2020 8:35 am
by linuxunil
_mental_ wrote:Build ZMusic.

Build Raze with CMAKE_PREFIX_PATH set to full path to build_install directory.



Now I could finally build it! but I don't have sound :oops: (only the music from the CD if I select that option). In "MIDI Device" I can only select Fluidsynth and it has 0 sound channels that I can't increase. When I start a game I have a lot of "Missing sound x used in ambient sound generator y"

Some commands could be simplified, but I have no idea what version of CMake you are using.


cmake --version says: "cmake version 3.16.3"

It would be very useful to have these steps written on the Github README.md by the way.

Also, why do I have so many problems with Raze when GZDoom building is so straight forward? is this something that will be ironed out in the future?

Re: How to build Raze on Linux? (Could NOT find ZMusic)

PostPosted: Fri Feb 14, 2020 10:19 am
by _mental_
linuxunil wrote:but I don't have sound :oops: (only the music from the CD if I select that option). In "MIDI Device" I can only select Fluidsynth and it has 0 sound channels that I can't increase. When I start a game I have a lot of "Missing sound x used in ambient sound generator y"

Raze supports a bunch of games. Which one did you try to start? It would be nice to have a complete log output.
I assume that you already have all dependencies for GZDoom installed, libsndfile and fluidsynth in particular. BTW the latter is the only MIDI device available because of licensing issues.

linuxunil wrote:Also, why do I have so many problems with Raze when GZDoom building is so straight forward? is this something that will be ironed out in the future?

What problems exactly? "So many" means tens of issues to me. I wouldn't say that building GZDoom is much more simple then Raze. The only difference is ZMusic.

Re: How to build Raze on Linux? (Could NOT find ZMusic)

PostPosted: Fri Feb 14, 2020 1:46 pm
by linuxunil
Oh sorry, I'm talking about Blood.

I've just found out what the problem is, sort of. Raze was loading my Blood Fresh Supply files automatically from the Steam folder, and it seems to be a problem loading the sounds there. After that I tried with my GOG copy of One Unit Whole Blood and the sound works just fine. If the sound works correctly on Windows with Fresh Supply files, it could maybe be a case sensitive problem somewhere?

What problems exactly? "So many" means tens of issues to me. I wouldn't say that building GZDoom is much more simple then Raze. The only difference is ZMusic.


When you put it in that way you are right. I guess the major problem was the lack of documentation. I spent more than an hour trying to integrate ZMusic without any luck yesterday and that's why I ended up registering on the forum. I also tried the released binaries without luck, because I am missing different libraries that are not on Fedora. Building it myself seems correct, so I don't know why that happens.

With GZDoom the only thing I do is 'git pull' and 'make -j5' to update the build. That's why Raze seems more problematic for me. For starters, I don't understand why ZMusic needs to be part of other project.

Now, to play and hunt for bugs. Thank you for your help!

Re: How to build Raze on Linux? (Could NOT find ZMusic)

PostPosted: Sat Feb 15, 2020 10:01 pm
by Blzut3
Graf Zahl wrote:Is there any way to set the prefix path persistently? This is by far the greatest annoyance with CMake I have to deal with. If this could just be set up once, never to be bothered with again, it's solve an endless list of problems.

Outside of setting up your own projects to use an environment variable of your choosing, I think the closest you can get is you can set an environment variable per package.
_mental_ wrote:Build Raze with CMAKE_PREFIX_PATH set to full path to build_install directory.

ZMusic should be exporting its targets so that you can just set ZMusic_DIR and Raze/GZDoom won't need to carry a find module.

The next mile after that would be to modernize all of the projects so that they're not setting global variables all over the place and then it would be easy to have ZMusic a submodule without sacrificing any ability to build it separately.

Re: How to build Raze on Linux? (Could NOT find ZMusic)

PostPosted: Sun Feb 16, 2020 1:14 am
by Graf Zahl
Blzut3 wrote:The next mile after that would be to modernize all of the projects


I'm 100% for that, unfortunately I wouldn't know how to do it. My knowledge of CMake is not good enough for that and many examples are for old versions.

Re: How to build Raze on Linux? (Could NOT find ZMusic)

PostPosted: Sun Feb 16, 2020 3:13 am
by linuxunil
Since yesterday GZDoom also needs for ZMusic to be built and referenced with CMAKE_PREFIX_PATH on Linux.

Re: How to build Raze on Linux? (Could NOT find ZMusic)

PostPosted: Sun Feb 16, 2020 4:39 pm
by Blzut3
Graf Zahl wrote:I'm 100% for that, unfortunately I wouldn't know how to do it. My knowledge of CMake is not good enough for that and many examples are for old versions.

I do plan on doing it, but I don't know how long down the road it will be. So in case it helps in the mean time: The place to start would be in src/CMakeLists.txt move the add_executable up to the top and list there all of the sources that are not variables. Then use target_sources for adding in the rest of the files.

Change add_definitions to target_compile_definitions (PUBLIC/PRIVATE doesn't matter much for an executable, but I will say that PUBLIC would make it easier to integrate a test suite in the future if that could ever be a thing). All of the warning enable/disable stuff should become target_compile_options. Any call to include_directories should be changed to target_include_directories. And finally since we have the add_executable call at the top of the file target_link_libraries can be used adhoc instead of having to use ZDOOM_LIBS.

If done right the number of variables being set should be reduced and when variables are set it should be within a block of code instead of set at the top, use at the bottom kind of thing.

There's of course a lot more to do, but getting that CMakeLists.txt to be less branchy and variable filled would be a great start.