C++ errors building rtaudio.cpp from v2.1.2 on NixOS

I am attempting to update the Nixkpgs packaging of the free version of VCV Rack from v2.0.6 to v2.1.2. (Portable binaries tend not to work on NixOS because the shared libraries are not in the expected place, so I mainly rely on this Nixpkgs build.)

I am working from the VCVRack/Rack GitHub repo at the v2.1.2 tag, which is set to commit ca85e0a607a3a54fed8d2c3f0821c04ae62b8db7

The problem I’m having is that when I attempt to run the build, g++ ultimately fails on errors when compiling rtaudio.cpp against RtAudio v5.2.0. Without digging too deep I’m not sure if it’s includes happening in the wrong order, some minor version mismatch, or maybe I’m just pulling in the wrong commit of some repo, but some RtAudio header definitions don’t seem to have happened the way VCV Rack is expecting them to have happened.

The whole build log is pretty long so I’ll share it separately if it’s wanted, but here’s the part at the end of the failed build, where the compiler errors actually occur.

g++ -std=c++11 -Wsuggest-override  -Iinclude -Idep/include -fPIC -fno-gnu-unique -MMD -MP -g -O3 -march=nehalem -funsafe-math-optimizations -fno-omit-frame-pointer -Wall -Wextra -Wno-unused-parameter -DARCH_LIN  -c -o build/src/app/Browser.cpp.o src/app/Browser.cpp
src/rtaudio.cpp: In constructor 'rack::RtAudioDevice::RtAudioDevice(RtAudio::Api, int)':
src/rtaudio.cpp:52:47: error: 'RtAudioErrorType' has not been declared
   52 |                 rtAudio = new RtAudio(api, [](RtAudioErrorType type, const std::string& errorText) {
      |                                               ^~~~~~~~~~~~~~~~
src/rtaudio.cpp:54:18: error: no matching function for call to 'RtAudio::RtAudio(RtAudio::Api&, rack::RtAudioDevice::RtAudioDevice(RtAudio::Api, int)::<lambda(int, const string&)>)'
   54 |                 });
      |                  ^
In file included from src/rtaudio.cpp:8:
/nix/store/b5a914fa5ym9m2dqxf70izwp0wn1hj39-rtaudio-5.2.0/include/rtaudio/RtAudio.h:426:3: note: candidate: 'RtAudio::RtAudio(RtAudio::Api)'
  426 |   RtAudio( RtAudio::Api api=UNSPECIFIED );
      |   ^~~~~~~
/nix/store/b5a914fa5ym9m2dqxf70izwp0wn1hj39-rtaudio-5.2.0/include/rtaudio/RtAudio.h:426:3: note:   candidate expects 1 argument, 2 provided
/nix/store/b5a914fa5ym9m2dqxf70izwp0wn1hj39-rtaudio-5.2.0/include/rtaudio/RtAudio.h:279:26: note: candidate: 'constexpr RtAudio::RtAudio(const RtAudio&)'
  279 | class RTAUDIO_DLL_PUBLIC RtAudio
      |                          ^~~~~~~
/nix/store/b5a914fa5ym9m2dqxf70izwp0wn1hj39-rtaudio-5.2.0/include/rtaudio/RtAudio.h:279:26: note:   candidate expects 1 argument, 2 provided
src/rtaudio.cpp: In member function 'void rack::RtAudioDevice::openStream()':
src/rtaudio.cpp:119:40: error: could not convert '((rack::RtAudioDevice*)this)->rack::RtAudioDevice::rtAudio->RtAudio::openStream(((((rack::RtAudioDevice*)this)->rack::RtAudioDevice::outputParameters.RtAudio::StreamParameters::nChannels > 0) ? (&((rack::RtAudioDevice*)this)->rack::RtAudioDevice::outputParameters) : 0), ((((rack::RtAudioDevice*)this)->rack::RtAudioDevice::inputParameters.RtAudio::StreamParameters::nChannels > 0) ? (&((rack::RtAudioDevice*)this)->rack::RtAudioDevice::inputParameters) : 0), ((RtAudioFormat)RTAUDIO_FLOAT32), ((unsigned int)closestSampleRate), ((unsigned int*)(&((rack::RtAudioDevice*)this)->rack::RtAudioDevice::blockSize)), rack::RtAudioDevice::rtAudioCallback, ((void*)((rack::RtAudioDevice*)this)), (&((rack::RtAudioDevice*)this)->rack::RtAudioDevice::options), 0)' from 'void' to 'bool'
  119 |                 if (rtAudio->openStream(
      |                     ~~~~~~~~~~~~~~~~~~~^
      |                                        |
      |                                        void
  120 |                         outputParameters.nChannels > 0 ? &outputParameters : NULL,
      |                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  121 |                         inputParameters.nChannels > 0 ? &inputParameters : NULL,
      |                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  122 |                         RTAUDIO_FLOAT32, closestSampleRate, (unsigned int*) &blockSize,
      |                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  123 |                         &rtAudioCallback, this, &options)) {
      |                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/rtaudio.cpp:129:49: error: could not convert '((rack::RtAudioDevice*)this)->rack::RtAudioDevice::rtAudio->RtAudio::startStream()' from 'void' to 'bool'
  129 |                         if (rtAudio->startStream()) {
      |                             ~~~~~~~~~~~~~~~~~~~~^~
      |                                                 |
      |                                                 void
src/rtaudio.cpp: In constructor 'rack::RtAudioDriver::RtAudioDriver(RtAudio::Api)':
src/rtaudio.cpp:234:47: error: 'RtAudioErrorType' has not been declared
  234 |                 rtAudio = new RtAudio(api, [](RtAudioErrorType type, const std::string& errorText) {
      |                                               ^~~~~~~~~~~~~~~~
src/rtaudio.cpp:236:18: error: no matching function for call to 'RtAudio::RtAudio(RtAudio::Api&, rack::RtAudioDriver::RtAudioDriver(RtAudio::Api)::<lambda(int, const string&)>)'
  236 |                 });
      |                  ^
In file included from src/rtaudio.cpp:8:
/nix/store/b5a914fa5ym9m2dqxf70izwp0wn1hj39-rtaudio-5.2.0/include/rtaudio/RtAudio.h:426:3: note: candidate: 'RtAudio::RtAudio(RtAudio::Api)'
  426 |   RtAudio( RtAudio::Api api=UNSPECIFIED );
      |   ^~~~~~~
/nix/store/b5a914fa5ym9m2dqxf70izwp0wn1hj39-rtaudio-5.2.0/include/rtaudio/RtAudio.h:426:3: note:   candidate expects 1 argument, 2 provided
/nix/store/b5a914fa5ym9m2dqxf70izwp0wn1hj39-rtaudio-5.2.0/include/rtaudio/RtAudio.h:279:26: note: candidate: 'constexpr RtAudio::RtAudio(const RtAudio&)'
  279 | class RTAUDIO_DLL_PUBLIC RtAudio
      |                          ^~~~~~~
/nix/store/b5a914fa5ym9m2dqxf70izwp0wn1hj39-rtaudio-5.2.0/include/rtaudio/RtAudio.h:279:26: note:   candidate expects 1 argument, 2 provided
make: *** [compile.mk:72: build/src/rtaudio.cpp.o] Error 1
make: *** Waiting for unfinished jobs....
error: builder for '/nix/store/j2xva5fp3x5d0jc26a70l8rqpxqja178-VCV-Rack-2.1.2.drv' failed with exit code 2;
       last 10 log lines:
       > /nix/store/b5a914fa5ym9m2dqxf70izwp0wn1hj39-rtaudio-5.2.0/include/rtaudio/RtAudio.h:426:3: note: candidate: 'RtAudio::RtAudio(RtAudio::Api)'
       >   426 |   RtAudio( RtAudio::Api api=UNSPECIFIED );
       >       |   ^~~~~~~
       > /nix/store/b5a914fa5ym9m2dqxf70izwp0wn1hj39-rtaudio-5.2.0/include/rtaudio/RtAudio.h:426:3: note:   candidate expects 1 argument, 2 provided
       > /nix/store/b5a914fa5ym9m2dqxf70iznot happening in the correct order, wp0wn1hj39-rtaudio-5.2.0/include/rtaudio/RtAudio.h:279:26: note: candidate: 'constexpr RtAudio::RtAudio(const RtAudio&)'
       >   279 | class RTAUDIO_DLL_PUBLIC RtAudio
       >       |                          ^~~~~~~
       > /nix/store/b5a914fa5ym9m2dqxf70izwp0wn1hj39-rtaudio-5.2.0/include/rtaudio/RtAudio.h:279:26: note:   candidate expects 1 argument, 2 provided
       > make: *** [compile.mk:72: build/src/rtaudio.cpp.o] Error 1
       > make: *** Waiting for unfinished jobs....
       For full logs, run 'nix log /nix/store/j2xva5fp3x5d0jc26a70l8rqpxqja178-VCV-Rack-2.1.2.drv'.

If anyone can put me on the right path I’ll much appreciate it. I don’t have my nixpkgs code changes online yet, but I’ve only changed the git refs and checksums for the Rack and Fundamental repos in the existing Nix definition you can find here: nixpkgs/default.nix at 6a50f500e3454f5676058eb31a302906898673de · NixOS/nixpkgs · GitHub

The Nix definition also includes a small patch for the Makefile but I haven’t yet found a need to change it for this v2.0.6-v2.1.2 update.

I checked Tags · VCVRack/rtaudio · GitHub and there is no version 5.2.0.

I recommend compiling against the fork of RTAudio provided by the github user VCVRack.

Thanks Ahornberg, I will try this later

Nixpkgs has been using the official releases of RtAudio but it sounds like VCV Rack’s fork may have diverged enough that we shouldn’t do that anymore in this case. I somehow hadn’t noticed in the submodules that Rack was using that repo, and Nixpkgs can’t use the submodules directly in the build because they’re not pegged to specific hashes

Updating to say that using the VCV fork of RtAudio was all I needed. Thanks again!

Here’s my pull request on Nixpkgs in case anyone wants to know what that looks like in Nix: vcv-rack: 2.0.6 -> 2.1.2 by ddelabru · Pull Request #188321 · NixOS/nixpkgs · GitHub

1 Like