That is a somewhat old node.js in the firefox-build-deps directory. Try dropping in a newer one (e.g. 14.17.0 LTS... I'd stick with the latest LTS for that) or just unpack a binary and set a variable for it. I don't know if it's that, just that node.js is involved in the operations that are failing for you.
NODEJS=/path/to/unpackedtarball/bin/node
I also do this:
--disable-tests
There was a time in the past when the PGO was scripted in the tests but that's no longer the case. The tests are not needed for PGO or normal builds.
I have to say that I don't use a SlackBuild for this though. I use this in my .mozconfig and start it with ./mach build
You could try such a build and see if it works for you. To install such a build (to --prefix) after successful completion, cd into obj-x86_64-pc-linux-gnu and simply "make install"
This will use clang by default. I wouldn't try a PGO+LTO build with gcc anymore, I'd bet a million bucks on it failing.
Code:
. $topsrcdir/browser/config/mozconfig
export CFLAGS="-mtune=nehalem"
export CXXFLAGS="-mtune=nehalem"
# needs to be exported on shell before running mach
export MACH_USE_SYSTEM_PYTHON=1
mk_add_options MOZ_MAKE_FLAGS=-j6
ac_add_options MOZ_PGO=1
ac_add_options --enable-lto
ac_add_options --prefix=/opt/firefox
ac_add_options --enable-official-branding
ac_add_options --enable-release
ac_add_options --disable-tests
ac_add_options --enable-optimize
ac_add_options --enable-rust-simd
ac_add_options --enable-alsa
ac_add_options --enable-pulseaudio
ac_add_options --disable-crashreporter
ac_add_options --disable-updater
ac_add_options --enable-linker=lld
ac_add_options AR=/usr/bin/llvm-ar
ac_add_options NM=/usr/bin/llvm-nm
ac_add_options RANLIB=/usr/bin/llvm-ranlib
ac_add_options NODEJS=/storage2/shit/build/node/bin/node
There's a note in there for myself to remember to "export MACH_USE_SYSTEM_PYTHON=1" before I start. It's chicken before egg to put it in the .mozconfig (because mach doesn't get to run).
It should not be necessary to --disable-elfhack with lld at this time, but it's such a gotcha that many distro packagers just use it all the time so their builds won't fail. The elf hack reduces relocations... significant for their fat assed libxul
P.S. Needs autoconf 2.13 and cbindgen as well as node. The SlackBuild provides those for the build in firefox-build-deps