badaix / snapcast

Synchronous multiroom audio player
GNU General Public License v3.0
6.22k stars 455 forks source link

Compilation fails #1132

Closed deisi closed 1 year ago

deisi commented 1 year ago

Describe the bug Make fails with fedora 38

Steps to Reproduce

  1. sudo dnf install @development-tools
  2. sudo dnf install alsa-lib-devel avahi-devel gcc-c++ libatomic libvorbis-devel opus-devel pulseaudio-libs-devel flac-devel soxr-devel libstdc++-static expat-devel boost-devel
  3. git checkout master (also checked v0.27.0)
  4. git pull
  5. make clean
  6. make

Environment details

Attach logfile if applicable

      |                                            ^~~~~~~~~
../common/message/pcm_chunk.hpp:86:67: error: ‘class SampleFormat’ has no member named ‘frameSize’
   86 |             memcpy((char*)outputBuffer, (char*)(payload) + format.frameSize() * idx_, format.frameSize() * result);
      |                                                                   ^~~~~~~~~
../common/message/pcm_chunk.hpp:86:94: error: ‘class SampleFormat’ has no member named ‘frameSize’
   86 |             memcpy((char*)outputBuffer, (char*)(payload) + format.frameSize() * idx_, format.frameSize() * result);
      |                                                                                              ^~~~~~~~~
../common/message/pcm_chunk.hpp: In member function ‘virtual chronos::time_point_clk msg::PcmChunk::start() const’:
../common/message/pcm_chunk.hpp:109:128: error: ‘const class SampleFormat’ has no member named ‘rate’; did you mean ‘msRate’?
  109 |                                        chronos::usec(static_cast<chronos::usec::rep>(1000000. * ((double)idx_ / (double)format.rate()))));
      |                                                                                                                                ^~~~
      |                                                                                                                                msRate
../common/message/pcm_chunk.hpp: In member function ‘uint32_t msg::PcmChunk::getFrameCount() const’:
../common/message/pcm_chunk.hpp:149:38: error: ‘const class SampleFormat’ has no member named ‘frameSize’
  149 |         return (payloadSize / format.frameSize());
      |                                      ^~~~~~~~~
../common/message/pcm_chunk.hpp: In member function ‘uint32_t msg::PcmChunk::getSampleCount() const’:
../common/message/pcm_chunk.hpp:154:38: error: ‘const class SampleFormat’ has no member named ‘sampleSize’
  154 |         return (payloadSize / format.sampleSize());
      |                                      ^~~~~~~~~~
player/player.cpp: In member function ‘void player::Player::adjustVolume(char*, size_t)’:
player/player.cpp:180:26: error: ‘const class SampleFormat’ has no member named ‘sampleSize’
  180 |         if (sampleFormat.sampleSize() == 1)
      |                          ^~~~~~~~~~
player/player.cpp:181:64: error: ‘const class SampleFormat’ has no member named ‘channels’
  181 |             adjustVolume<int8_t>(buffer, frames * sampleFormat.channels(), volume);
      |                                                                ^~~~~~~~
player/player.cpp:182:31: error: ‘const class SampleFormat’ has no member named ‘sampleSize’
  182 |         else if (sampleFormat.sampleSize() == 2)
      |                               ^~~~~~~~~~
player/player.cpp:183:65: error: ‘const class SampleFormat’ has no member named ‘channels’
  183 |             adjustVolume<int16_t>(buffer, frames * sampleFormat.channels(), volume);
      |                                                                 ^~~~~~~~
player/player.cpp:184:31: error: ‘const class SampleFormat’ has no member named ‘sampleSize’
  184 |         else if (sampleFormat.sampleSize() == 4)
      |                               ^~~~~~~~~~
player/player.cpp:185:65: error: ‘const class SampleFormat’ has no member named ‘channels’
  185 |             adjustVolume<int32_t>(buffer, frames * sampleFormat.channels(), volume);
      |                                                                 ^~~~~~~~
make[1]: *** [Makefile:123: player/player.o] Error 1
make[1]: *** [Makefile:123: client_connection.o] Error 1
make[1]: *** [Makefile:123: controller.o] Error 1
make[1]: Leaving directory '/var/home/malte/Projects/snapcast/client'
make: *** [Makefile:14: client] Error 2
make: *** Waiting for unfinished jobs....
make[1]: *** [Makefile:110: streamreader/meta_stream.o] Error 1
make[1]: Leaving directory '/var/home/malte/Projects/snapcast/server'
make: *** [Makefile:11: server] Error 2

full.log

dataprolet commented 1 year ago

Same on Arch Linux, here's a log. snapcast-log.txt

powellc commented 1 year ago

I am no C++ wizard, but this appears to be the 0.27 release that's broken. If you pull the source and use the develop branch, i can get past this, at least on Arch. Would love if a new release could get cut sooner rather than later so at least Arch can be fixed.

luar123 commented 1 year ago

Try to use cmake. See #1134

powellc commented 1 year ago

I sure did. cmake generates the traditional Makefile, and then we get the errors above. Just trying to install snapcast using pacman or yay is enough to generate the error as it stands. But I did successfully build it from the develop branch, so I suspect there's just something in the build chain on master that's out of date, but I only know enough C+++ to be dangerous 😆

deisi commented 1 year ago

Okay thanks for the cmake and the develop branch tip. This made it work for me again. In case someone wants a dockerfile, this is what I used to build:

FROM fedora-toolbox:38

# Needed to run snapcast within a toolbox
RUN sudo dnf install -y pulseaudio-utils pipewire-pulseaudio

# Needed to build sapcast
RUN sudo dnf install -y @development-tools
RUN sudo dnf install -y cmake alsa-lib-devel avahi-devel gcc-c++ libatomic libvorbis-devel opus-devel pulseaudio-libs-devel flac-devel soxr-devel libstdc++-static expat-devel boost-devel
RUN git clone https://github.com/badaix/snapcast.git && \
    cd snapcast && \
    mkdir build && \
    cd build && \
    cmake .. && \
    make -j 16 && \
    cd .. && \
    mv bin/snapclient /usr/bin/snapclient && \
    mv bin/snapserver /usr/bin/snapserver && \
    cd .. && \
    rm -rf snapcast