I got it working! I ended up building gcc 12.2.0 from source code, then using that to build Rack with my patches to fix audio problems in PulseAudio. Here is a brief outline:
First, read the official GCC documentation carefully. Don’t skim it because you’ll end up wasting your time with something that doesn’t work. I also found this wiki page very helpful for clarifying some things.
Here is what I did on my Debian Bullseye system. I already had lots of prerequisites installed, but I had to add a few things that were missing:
sudo apt-get install gperf dejagnu autogen guile-3.0 \
texlive sphinx libgmp-dev libgmp-dev libmpfr-dev libmpc-dev
Then I cloned the gcc git repo (download took about 4 minutes):
git clone git://gcc.gnu.org/git/gcc.git
cd gcc
git checkout releases/gcc-12.2.0
Here is a really important part: you have to create a build directory completely outside of the git repo. Use it to configure the build. I chose to use $HOME/gcc12 as my install target, so I didn’t risk messing up my system running any commands as root.
cd ..
mkdir buildgcc
cd buildgcc
../gcc/configure \
--prefix=$HOME/gcc12 \
--disable-multilib \
--enable-languages=c,c++
make -j 2 # took 82 minutes
make install
Now to temporarily replace gcc/g++ version 10 with version 12.2 on my system, I changed my path to find it first, and told bash to forget where it last saw them.
hash -r
export PATH=$HOME/gcc12/bin:$PATH
Then I built Rack with my PulseAudio patch applied, using my glitchfix.sh and glitchinst.sh scripts.
The result: I now have a working version of VCV Rack 2.2.1 that no longer clicks and pops the audio every few seconds!