exeldro / obs-source-clone

GNU General Public License v2.0
122 stars 6 forks source link

Fail to build over 32-bit systems #16

Open eribertomota opened 1 year ago

eribertomota commented 1 year ago

Hi @exeldro,

When trying to build from source the version 0.1.4 over Intel x86 (Debian i386), I got the following error:

/usr/lib/ccache/cc -DHAVE_OBSCONFIG_H -Dsource_clone_EXPORTS -isystem /usr/include/obs -g -O2 -ffile-prefix-map=/builds/debian/obs-source-clone/debian/output/source_dir=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Werror -Wextra -Wvla -Wformat -Wformat-security -Wswitch -Wunused-parameter -Wno-unused-function -Wno-missing-field-initializers -fno-strict-aliasing -Werror-implicit-function-declaration -Wno-missing-braces -DSIMDE_ENABLE_OPENMP -fopenmp-simd -MD -MT CMakeFiles/source-clone.dir/audio-wrapper.c.o -MF CMakeFiles/source-clone.dir/audio-wrapper.c.o.d -o CMakeFiles/source-clone.dir/audio-wrapper.c.o -c /builds/debian/obs-source-clone/debian/output/source_dir/audio-wrapper.c
/builds/debian/obs-source-clone/debian/output/source_dir/source-clone.c: In function 'simde_mm_setzero_ps':
/builds/debian/obs-source-clone/debian/output/source_dir/source-clone.c:648:1: error: SSE vector return without SSE enabled changes the ABI [-Werror=psabi]
  648 | }
      | ^
cc1: all warnings being treated as errors
make[3]: *** [CMakeFiles/source-clone.dir/build.make:79: CMakeFiles/source-clone.dir/source-clone.c.o] Error 1

You can see the full building process here[1]. Maybe this is the same issue discussed here[2].

[1] https://salsa.debian.org/debian/obs-source-clone/-/jobs/4307052 [2] https://github.com/kcat/openal-soft/issues/541

Thanks in advance.

exeldro commented 1 year ago

I have no idea what is causing that build error

eribertomota commented 1 year ago

After a little test in a jail, I found the problem. This is a new procedure started in GCC-12. The explanation is here[1].

[1] https://gcc.gnu.org/gcc-12/changes.html

See:

_An ABI incompatibility between C and C++ when passing or returning by value certain aggregates containing zero width bit-fields has been discovered on various targets. As mentioned in PR102024, since the PR42217 fix in GCC 4.5 the C++ front-end has been removing zero width bit-fields from the internal representation of the aggregates after the layout of those aggregates, but the C front-end kept them, so passing e.g. struct S { float a; int : 0; float b; } or struct T { float c; int : 0; } by value could differ between C and C++. Starting with GCC 12 the C++ front-end no longer removes those bit-fields from the internal representation and per clarified psABI some targets have been changed, so that they either ignore those bit-fields in the argument passing by value decisions in both C and C++, or they always take them into account. x86-64, ARM and AArch64 will always ignore them (so there is a C ABI incompatibility between GCC 11 and earlier with GCC 12 or later), PowerPC64 ELFv2 and S/390 always take them into account (so there is a C++ ABI incompatibility, GCC 4.4 and earlier compatible with GCC 12 or later, incompatible with GCC 4.5 through GCC 11). RISC-V has changed the handling of these already starting with GCC 10. As the ABI requires, MIPS takes them into account handling function return values so there is a C++ ABI incompatibility with GCC 4.5 through 11. For function arguments on MIPS, refer to the MIPS specific entry. GCC 12 on the above targets will report such incompatibilities as warnings or other diagnostics unless -Wno-psabi is used._

Using -Wno-psabi in CFLAGS solved the problem for me (on Debian, in debian/rules files, export DEB_CFLAGS_MAINT_APPEND = -Wno-psabi). However, IMHO, this issue should be fixed in the source code.

Thanks for your attention.

eribertomota commented 6 months ago

From this issue[1], WarmUpTill solved the problem using the following line for CMake:

add_compile_options(-Wno-error=psabi)

I found errors when building move-transition, 3d-effect and source-clone over x86.

[1] https://github.com/WarmUpTill/SceneSwitcher/issues/1091

exeldro commented 6 months ago

That solution looks good to me, I will look at it more later. If you want to speed up the process you can create pull requests with the changes.

eribertomota commented 6 months ago

Sorry, I tried something, but was not able to implement this change.