Linker errors when building audio application on Arch Linux

Hi,

I’m getting a various different linker errors when trying to build a new audio application on linux.

when trying to build with g++ 8 i get the following

/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../lib/libwebkit2gtk-4.0.so: undefined reference to `std::_Sp_make_shared_tag::_S_eq(std::type_info const&)@GLIBCXX_3.4.26'
collect2: error: ld returned 1 exit status

when trying to build with gcc 8 i get the following:

/usr/bin/ld: build/intermediate/Debug/include_juce_core_f26d17db.o: undefined reference to symbol '_ZNSt15basic_streambufIcSt11char_traitsIcEE8overflowEi@@GLIBCXX_3.4'
/usr/bin/ld: /usr/lib/libstdc++.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status

if i then pass LDFLAGS=-lm to make I get the following:

/usr/bin/ld: build/intermediate/Debug/include_juce_core_f26d17db.o: undefined reference to symbol '_ZNSt15basic_streambufIcSt11char_traitsIcEE8overflowEi@@GLIBCXX_3.4'
/usr/bin/ld: /usr/lib/libstdc++.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status

which I have no idea about.

I’m pretty sure I want to be using g++, not gcc, so I think the first error is the one that needs debugging, but I’m really not sure where to go with this.

Note that since my system using gcc/g++ 9 by default, I have to pass CXX=g++-8 to make, otherwise the build itself fails due to another (unrelated) issue.
Is it possible that the webkit2gtk issue is arising from the fact that it would would have been built with gcc 9? I would assume that the binaries are still compatible so that doesn’t seem like it would cause problems.

Thanks to anyone who can help