On Sun, Apr 27, 2025 at 10:21:33PM +0200, Kirill A. Korinsky wrote: > I see.
> Here a diff which backport audio/openal to C++ which is supported by gcc8. > It is quite trivial, but I only compiled it. Tried it. It dies with another classic "I'm using ports-gcc for C++" error: [19/104] : && /usr/ports/pobj/openal-1.24.2/bin/c++ -O2 -pipe fmt-11.1.1/CMakeFiles/alsoft.fmt.dir/src/format.cc.o fmt-11.1.1/CMakeFiles/alsoft.fmt.dir/src/os.cc.o CMakeFiles/makemhr.dir/utils/makemhr/loaddef.cpp.o CMakeFiles/makemhr.dir/utils/makemhr/loadsofa.cpp.o CMakeFiles/makemhr.dir/utils/makemhr/makemhr.cpp.o -o makemhr -pthread libalsoft.sofa-support.a -pthread libalsoft.common.a /usr/local/lib/libmysofa.so.0.1 /usr/lib/libz.so.7.1 /usr/lib/libm.so.10.1 -Wl,-rpath-link,/usr/X11R6/lib && : FAILED: makemhr : && /usr/ports/pobj/openal-1.24.2/bin/c++ -O2 -pipe fmt-11.1.1/CMakeFiles/alsoft.fmt.dir/src/format.cc.o fmt-11.1.1/CMakeFiles/alsoft.fmt.dir/src/os.cc.o CMakeFiles/makemhr.dir/utils/makemhr/loaddef.cpp.o CMakeFiles/makemhr.dir/utils/makemhr/loadsofa.cpp.o CMakeFiles/makemhr.dir/utils/makemhr/makemhr.cpp.o -o makemhr -pthread libalsoft.sofa-support.a -pthread libalsoft.common.a /usr/local/lib/libmysofa.so.0.1 /usr/lib/libz.so.7.1 /usr/lib/libm.so.10.1 -Wl,-rpath-link,/usr/X11R6/lib && : /usr/local/lib/libmysofa.so.0.1: warning: strcpy() is almost always misused, please use strlcpy() /usr/local/lib/libmysofa.so.0.1: warning: sprintf() is often misused, please use snprintf() /usr/local/lib/libmysofa.so.0.1: warning: strcat() is almost always misused, please use strlcat() CMakeFiles/makemhr.dir/utils/makemhr/loaddef.cpp.o: In function `(anonymous namespace)::ProcessSources((anonymous namespace)::TokenReaderT*, HrirDataT*, unsigned int)': loaddef.cpp:(.text+0x4424): undefined reference to `std::filesystem::__cxx11::path::_M_split_cmpts()' loaddef.cpp:(.text+0x51dc): undefined reference to `std::filesystem::__cxx11::path::_M_split_cmpts()' CMakeFiles/makemhr.dir/utils/makemhr/makemhr.cpp.o: In function `std::filesystem::__cxx11::path::path<std::basic_string_view<char, std::char_traits<char> >, std::filesystem::__cxx11::path>(std::basic_string_view<char, std::char_traits<char> > const&, std::filesystem::__cxx11::path::format)': makemhr.cpp:(.text._ZNSt10filesystem7__cxx114pathC2ISt17basic_string_viewIcSt11char_traitsIcEES1_EERKT_NS1_6formatE[_ZNSt10filesystem7__cxx114pathC5ISt17basic_string_viewIcSt11char_traitsIcEES1_EERKT_NS1_6formatE]+0x44): undefined reference to `std::filesystem::__cxx11::path::_M_split_cmpts()' collect2: error: ld returned 1 exit status ninja: build stopped: subcommand failed. --Kurt > Index: Makefile > =================================================================== > RCS file: /home/cvs/ports/audio/openal/Makefile,v > diff -u -p -r1.68 Makefile > --- Makefile 1 Feb 2025 09:56:08 -0000 1.68 > +++ Makefile 27 Apr 2025 20:18:53 -0000 > @@ -4,7 +4,7 @@ V = 1.24.2 > DISTNAME = openal-soft-$V > PKGNAME = openal-$V > EPOCH = 0 > -REVISION = 0 > +REVISION = 1 > CATEGORIES = audio > > SHARED_LIBS = openal 6.0 > Index: patches/patch-al_auxeffectslot_cpp > =================================================================== > RCS file: patches/patch-al_auxeffectslot_cpp > diff -N patches/patch-al_auxeffectslot_cpp > --- /dev/null 1 Jan 1970 00:00:00 -0000 > +++ patches/patch-al_auxeffectslot_cpp 27 Apr 2025 18:22:56 -0000 > @@ -0,0 +1,18 @@ > +gcc8: error: expression '<throw-expression>' is not a constant expression > + > +Index: al/auxeffectslot.cpp > +--- al/auxeffectslot.cpp.orig > ++++ al/auxeffectslot.cpp > +@@ -242,9 +242,10 @@ constexpr auto EffectSlotTypeFromEnum(ALenum type) noe > + case AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT: return > EffectSlotType::Dedicated; > + case AL_EFFECT_DEDICATED_DIALOGUE: return EffectSlotType::Dedicated; > + case AL_EFFECT_CONVOLUTION_SOFT: return EffectSlotType::Convolution; > ++ default: > ++ ERR("Unhandled effect enum: {:#04x}", as_unsigned(type)); > ++ return EffectSlotType::None; > + } > +- ERR("Unhandled effect enum: {:#04x}", as_unsigned(type)); > +- return EffectSlotType::None; > + } > + > + [[nodiscard]] > Index: patches/patch-al_buffer_cpp > =================================================================== > RCS file: patches/patch-al_buffer_cpp > diff -N patches/patch-al_buffer_cpp > --- /dev/null 1 Jan 1970 00:00:00 -0000 > +++ patches/patch-al_buffer_cpp 27 Apr 2025 20:10:42 -0000 > @@ -0,0 +1,33 @@ > +gcc8: error: expression '<throw-expression>' is not a constant expression > + > +Index: al/buffer.cpp > +--- al/buffer.cpp.orig > ++++ al/buffer.cpp > +@@ -87,9 +87,10 @@ constexpr auto EnumFromAmbiLayout(AmbiLayout layout) - > + { > + case AmbiLayout::FuMa: return AL_FUMA_SOFT; > + case AmbiLayout::ACN: return AL_ACN_SOFT; > ++ default: > ++ throw std::runtime_error{fmt::format("Invalid AmbiLayout: {}", > ++ int{al::to_underlying(layout)})}; > + } > +- throw std::runtime_error{fmt::format("Invalid AmbiLayout: {}", > +- int{al::to_underlying(layout)})}; > + } > + > + constexpr auto AmbiScalingFromEnum(ALenum scale) noexcept -> > std::optional<AmbiScaling> > +@@ -109,10 +110,11 @@ constexpr auto EnumFromAmbiScaling(AmbiScaling scale) > + case AmbiScaling::FuMa: return AL_FUMA_SOFT; > + case AmbiScaling::SN3D: return AL_SN3D_SOFT; > + case AmbiScaling::N3D: return AL_N3D_SOFT; > +- case AmbiScaling::UHJ: break; > ++ case AmbiScaling::UHJ: > ++ default: > ++ throw std::runtime_error{fmt::format("Invalid AmbiScaling: {}", > ++ int{al::to_underlying(scale)})}; > + } > +- throw std::runtime_error{fmt::format("Invalid AmbiScaling: {}", > +- int{al::to_underlying(scale)})}; > + } > + > + #if ALSOFT_EAX > Index: patches/patch-al_debug_cpp > =================================================================== > RCS file: patches/patch-al_debug_cpp > diff -N patches/patch-al_debug_cpp > --- /dev/null 1 Jan 1970 00:00:00 -0000 > +++ patches/patch-al_debug_cpp 27 Apr 2025 20:10:49 -0000 > @@ -0,0 +1,44 @@ > +gcc8: error: expression '<throw-expression>' is not a constant expression > + > +Index: al/debug.cpp > +--- al/debug.cpp.orig > ++++ al/debug.cpp > +@@ -109,9 +109,10 @@ constexpr auto GetDebugSourceEnum(DebugSource source) > + case DebugSource::ThirdParty: return AL_DEBUG_SOURCE_THIRD_PARTY_EXT; > + case DebugSource::Application: return AL_DEBUG_SOURCE_APPLICATION_EXT; > + case DebugSource::Other: return AL_DEBUG_SOURCE_OTHER_EXT; > ++ default: > ++ throw std::runtime_error{fmt::format("Unexpected debug source > value: {}", > ++ int{al::to_underlying(source)})}; > + } > +- throw std::runtime_error{fmt::format("Unexpected debug source value: > {}", > +- int{al::to_underlying(source)})}; > + } > + > + constexpr auto GetDebugTypeEnum(DebugType type) -> ALenum > +@@ -127,9 +128,10 @@ constexpr auto GetDebugTypeEnum(DebugType type) -> ALe > + case DebugType::PushGroup: return AL_DEBUG_TYPE_PUSH_GROUP_EXT; > + case DebugType::PopGroup: return AL_DEBUG_TYPE_POP_GROUP_EXT; > + case DebugType::Other: return AL_DEBUG_TYPE_OTHER_EXT; > ++ default: > ++ throw std::runtime_error{fmt::format("Unexpected debug type value: > {}", > ++ int{al::to_underlying(type)})}; > + } > +- throw std::runtime_error{fmt::format("Unexpected debug type value: {}", > +- int{al::to_underlying(type)})}; > + } > + > + constexpr auto GetDebugSeverityEnum(DebugSeverity severity) -> ALenum > +@@ -140,9 +142,10 @@ constexpr auto GetDebugSeverityEnum(DebugSeverity seve > + case DebugSeverity::Medium: return AL_DEBUG_SEVERITY_MEDIUM_EXT; > + case DebugSeverity::Low: return AL_DEBUG_SEVERITY_LOW_EXT; > + case DebugSeverity::Notification: return > AL_DEBUG_SEVERITY_NOTIFICATION_EXT; > ++ default: > ++ throw std::runtime_error{fmt::format("Unexpected debug severity > value: {}", > ++ int{al::to_underlying(severity)})}; > + } > +- throw std::runtime_error{fmt::format("Unexpected debug severity value: > {}", > +- int{al::to_underlying(severity)})}; > + } > + > + > Index: patches/patch-al_effects_chorus_cpp > =================================================================== > RCS file: patches/patch-al_effects_chorus_cpp > diff -N patches/patch-al_effects_chorus_cpp > --- /dev/null 1 Jan 1970 00:00:00 -0000 > +++ patches/patch-al_effects_chorus_cpp 27 Apr 2025 20:10:54 -0000 > @@ -0,0 +1,18 @@ > +gcc8: error: expression '<throw-expression>' is not a constant expression > + > +Index: al/effects/chorus.cpp > +--- al/effects/chorus.cpp.orig > ++++ al/effects/chorus.cpp > +@@ -42,9 +42,10 @@ constexpr ALenum EnumFromWaveform(ChorusWaveform type) > + { > + case ChorusWaveform::Sinusoid: return AL_CHORUS_WAVEFORM_SINUSOID; > + case ChorusWaveform::Triangle: return AL_CHORUS_WAVEFORM_TRIANGLE; > ++ default: > ++ throw std::runtime_error{fmt::format("Invalid chorus waveform: {}", > ++ int{al::to_underlying(type)})}; > + } > +- throw std::runtime_error{fmt::format("Invalid chorus waveform: {}", > +- int{al::to_underlying(type)})}; > + } > + > + constexpr EffectProps genDefaultChorusProps() noexcept > Index: patches/patch-al_effects_fshifter_cpp > =================================================================== > RCS file: patches/patch-al_effects_fshifter_cpp > diff -N patches/patch-al_effects_fshifter_cpp > --- /dev/null 1 Jan 1970 00:00:00 -0000 > +++ patches/patch-al_effects_fshifter_cpp 27 Apr 2025 20:10:58 -0000 > @@ -0,0 +1,16 @@ > +gcc8: error: expression '<throw-expression>' is not a constant expression > + > +Index: al/effects/fshifter.cpp > +--- al/effects/fshifter.cpp.orig > ++++ al/effects/fshifter.cpp > +@@ -39,8 +39,9 @@ constexpr ALenum EnumFromDirection(FShifterDirection d > + case FShifterDirection::Down: return > AL_FREQUENCY_SHIFTER_DIRECTION_DOWN; > + case FShifterDirection::Up: return AL_FREQUENCY_SHIFTER_DIRECTION_UP; > + case FShifterDirection::Off: return AL_FREQUENCY_SHIFTER_DIRECTION_OFF; > ++ default: > ++ throw std::runtime_error{fmt::format("Invalid direction: {}", > int{al::to_underlying(dir)})}; > + } > +- throw std::runtime_error{fmt::format("Invalid direction: {}", > int{al::to_underlying(dir)})}; > + } > + > + constexpr EffectProps genDefaultProps() noexcept > Index: patches/patch-al_effects_modulator_cpp > =================================================================== > RCS file: patches/patch-al_effects_modulator_cpp > diff -N patches/patch-al_effects_modulator_cpp > --- /dev/null 1 Jan 1970 00:00:00 -0000 > +++ patches/patch-al_effects_modulator_cpp 27 Apr 2025 20:11:01 -0000 > @@ -0,0 +1,18 @@ > +gcc8: error: expression '<throw-expression>' is not a constant expression > + > +Index: al/effects/modulator.cpp > +--- al/effects/modulator.cpp.orig > ++++ al/effects/modulator.cpp > +@@ -39,9 +39,10 @@ constexpr ALenum EnumFromWaveform(ModulatorWaveform ty > + case ModulatorWaveform::Sinusoid: return AL_RING_MODULATOR_SINUSOID; > + case ModulatorWaveform::Sawtooth: return AL_RING_MODULATOR_SAWTOOTH; > + case ModulatorWaveform::Square: return AL_RING_MODULATOR_SQUARE; > ++ default: > ++ throw std::runtime_error{fmt::format("Invalid modulator waveform: > {}", > ++ int{al::to_underlying(type)})}; > + } > +- throw std::runtime_error{fmt::format("Invalid modulator waveform: {}", > +- int{al::to_underlying(type)})}; > + } > + > + constexpr EffectProps genDefaultProps() noexcept > Index: patches/patch-al_effects_vmorpher_cpp > =================================================================== > RCS file: patches/patch-al_effects_vmorpher_cpp > diff -N patches/patch-al_effects_vmorpher_cpp > --- /dev/null 1 Jan 1970 00:00:00 -0000 > +++ patches/patch-al_effects_vmorpher_cpp 27 Apr 2025 20:11:05 -0000 > @@ -0,0 +1,29 @@ > +gcc8: error: expression '<throw-expression>' is not a constant expression > + > +Index: al/effects/vmorpher.cpp > +--- al/effects/vmorpher.cpp.orig > ++++ al/effects/vmorpher.cpp > +@@ -96,8 +96,9 @@ constexpr ALenum EnumFromPhenome(VMorpherPhenome pheno > + HANDLE_PHENOME(T); > + HANDLE_PHENOME(V); > + HANDLE_PHENOME(Z); > ++ default: > ++ throw std::runtime_error{fmt::format("Invalid phenome: {}", > int{al::to_underlying(phenome)})}; > + } > +- throw std::runtime_error{fmt::format("Invalid phenome: {}", > int{al::to_underlying(phenome)})}; > + #undef HANDLE_PHENOME > + } > + > +@@ -118,9 +119,10 @@ constexpr ALenum EnumFromWaveform(VMorpherWaveform typ > + case VMorpherWaveform::Sinusoid: return > AL_VOCAL_MORPHER_WAVEFORM_SINUSOID; > + case VMorpherWaveform::Triangle: return > AL_VOCAL_MORPHER_WAVEFORM_TRIANGLE; > + case VMorpherWaveform::Sawtooth: return > AL_VOCAL_MORPHER_WAVEFORM_SAWTOOTH; > ++ default: > ++ throw std::runtime_error{fmt::format("Invalid vocal morpher > waveform: {}", > ++ int{al::to_underlying(type)})}; > + } > +- throw std::runtime_error{fmt::format("Invalid vocal morpher waveform: > {}", > +- int{al::to_underlying(type)})}; > + } > + > + constexpr EffectProps genDefaultProps() noexcept > Index: patches/patch-al_state_cpp > =================================================================== > RCS file: patches/patch-al_state_cpp > diff -N patches/patch-al_state_cpp > --- /dev/null 1 Jan 1970 00:00:00 -0000 > +++ patches/patch-al_state_cpp 27 Apr 2025 20:11:12 -0000 > @@ -0,0 +1,16 @@ > +gcc8: error: expression '<throw-expression>' is not a constant expression > + > +Index: al/state.cpp > +--- al/state.cpp.orig > ++++ al/state.cpp > +@@ -140,8 +140,9 @@ constexpr auto ALenumFromDistanceModel(DistanceModel m > + case DistanceModel::LinearClamped: return AL_LINEAR_DISTANCE_CLAMPED; > + case DistanceModel::Exponent: return AL_EXPONENT_DISTANCE; > + case DistanceModel::ExponentClamped: return > AL_EXPONENT_DISTANCE_CLAMPED; > ++ default: > ++ throw std::runtime_error{"Unexpected distance model > "+std::to_string(static_cast<int>(model))}; > + } > +- throw std::runtime_error{"Unexpected distance model > "+std::to_string(static_cast<int>(model))}; > + } > + > + enum PropertyValue : ALenum { > Index: patches/patch-alc_alu_cpp > =================================================================== > RCS file: patches/patch-alc_alu_cpp > diff -N patches/patch-alc_alu_cpp > --- /dev/null 1 Jan 1970 00:00:00 -0000 > +++ patches/patch-alc_alu_cpp 27 Apr 2025 20:09:40 -0000 > @@ -0,0 +1,16 @@ > +gcc8 is too old for std::for_each_n > + > +Index: alc/alu.cpp > +--- alc/alu.cpp.orig > ++++ alc/alu.cpp > +@@ -2155,7 +2155,9 @@ void Write(const al::span<const FloatBufferLine> InBuf > + out[c] = SampleConv<T>(s); > + out += ptrdiff_t(FrameStep); > + }; > +- std::for_each_n(inbuf.cbegin(), SamplesToDo, conv_sample); > ++ auto first = inbuf.cbegin(); > ++ auto last = first + SamplesToDo; > ++ std::for_each(first, last, conv_sample); > + ++c; > + } > + if(const size_t extra{FrameStep - c}) > Index: patches/patch-alc_effects_reverb_cpp > =================================================================== > RCS file: patches/patch-alc_effects_reverb_cpp > diff -N patches/patch-alc_effects_reverb_cpp > --- /dev/null 1 Jan 1970 00:00:00 -0000 > +++ patches/patch-alc_effects_reverb_cpp 27 Apr 2025 20:15:17 -0000 > @@ -0,0 +1,16 @@ > +gcc8 is too old for std::reduce > + > +Index: alc/effects/reverb.cpp > +--- alc/effects/reverb.cpp.orig > ++++ alc/effects/reverb.cpp > +@@ -931,8 +931,8 @@ void EarlyReflections::updateLines(const float density > + /* Calculate the gain (coefficient) for the secondary reflections based > on > + * the average delay and decay time. > + */ > +- const auto length = std::reduce(EARLY_LINE_LENGTHS.begin(), > EARLY_LINE_LENGTHS.end(), 0.0f) > +- / float{EARLY_LINE_LENGTHS.size()} * density_mult; > ++ const auto length = std::accumulate(EARLY_LINE_LENGTHS.begin(), > EARLY_LINE_LENGTHS.end(), 0.0f) > ++ / static_cast<float>(EARLY_LINE_LENGTHS.size()) * density_mult; > + Coeff = CalcDecayCoeff(length, decayTime); > + > + } > Index: patches/patch-fmt-11_1_1_CMakeLists_txt > =================================================================== > RCS file: patches/patch-fmt-11_1_1_CMakeLists_txt > diff -N patches/patch-fmt-11_1_1_CMakeLists_txt > --- /dev/null 1 Jan 1970 00:00:00 -0000 > +++ patches/patch-fmt-11_1_1_CMakeLists_txt 27 Apr 2025 20:12:07 -0000 > @@ -0,0 +1,14 @@ > +gcc8: undefined reference to > `std::filesystem::__cxx11::path::_M_split_cmpts()' > + > +Index: fmt-11.1.1/CMakeLists.txt > +--- fmt-11.1.1/CMakeLists.txt.orig > ++++ fmt-11.1.1/CMakeLists.txt > +@@ -61,6 +61,8 @@ set(FMT_SOURCES src/format.cc src/os.cc) > + add_library(alsoft.fmt OBJECT ${FMT_SOURCES} ${FMT_HEADERS} README.md > ChangeLog.md) > + add_library(alsoft::fmt ALIAS alsoft.fmt) > + > ++target_link_libraries(alsoft.fmt PRIVATE > $<$<AND:$<CXX_COMPILER_ID:GNU>,$<VERSION_LESS:$<CXX_COMPILER_VERSION>,9.0>>:stdc++fs>) > ++ > + if (cxx_std_11 IN_LIST CMAKE_CXX_COMPILE_FEATURES) > + target_compile_features(alsoft.fmt PUBLIC cxx_std_11) > + else () > > > > -- > wbr, Kirill >