Open barracuda156 opened 2 months ago
Thanks. This is an awkward one. So this is actually coming from dr_flac, which I amalgamate into miniaudio using a tool. It's used in a tight loop deep in the decoding logic and is important that it's used if available. dr_flac will do a runtime support check to ensure the instruction is not executed if unavailable, so I don't think it's causing any harm in practice at runtime, but I'm not sure how to disable this error. I want it to still be compiled into the executable even if the compiler is targeting i386. Do you have any suggestions?
Is compilation actually succeeding, or is this presenting as an error instead of a warning? If it's a warning, since I'm doing a runtime check, I suppose silencing the warning work?
@mackron It causes the build to fail, but admittedly this is a minority case, and it should not be disabled for everyone because it fails here. This seems to be a somewhat common problem, because many multimedia-related projects either simply assume that all x86 SIMD are available on all x86 cpus or rely on a compiler version check, which is of no help in fact, since a compiler may support a given flag, while assembler may not, and that will break everything.
I do not really have a neat solution here. In principle, it should be checked that an instruction from a specific SIMD type can be actually compiled (instead of using a macro to check GCC/Clang version or check support for passing -mavx
etc. flags – that is useless) – that gonna ensure that both compiler and assembler can handle those. But this may be bothersome to implement, and very few users will perhaps benefit from that.
As a simple and safe solution maybe just add a configure option to turn off AXV stuff (or even SIMD altogether)? So that default behavior does not change, but if someone gets a problem, there will be a neat way to have this compiled correctly.
Given that miniaudio
can be borrowed by other projects, so there will be no native configure, a macro will do: say, if someone needs to avoid AVX, just pass a cppflag -DNO_AVX
, or smth to that effect.
@mackron In addition to https://github.com/mackron/miniaudio/issues/841 on older
i386
this may fail:Looks like there is no check there, it is assumed it is supported with all systems using gcc or clang, which is not the case: at least assembler has to support this insn, and it may not.
Build run on 10.6 i386 with gcc13, physical cpu CoreDuo.