phandasm / waveform

Audio spectral analysis plugin for OBS
https://obsproject.com/forum/resources/waveform.1423/
GNU General Public License v3.0
525 stars 37 forks source link

Cannot build on archlinux with gcc 11.2 #9

Closed kuon closed 2 years ago

kuon commented 2 years ago

I am trying to build this plugin on archlinux with gcc 11.2, but I have the following error.

The obs package I use is this one : https://aur.archlinux.org/packages/obs-studio-tytan652

Build logs:

[ 27%] Built target utils
[ 45%] Built target cpu_features
Consolidate compiler generated dependencies of target waveform
[ 54%] Building CXX object CMakeFiles/waveform.dir/src/module.cpp.o
In file included from /usr/include/obs/util/simde/x86/sse2.h:35,
                 from /usr/include/obs/util/sse-intrin.h:28,
                 from /usr/include/obs/graphics/vec4.h:23,
                 from /usr/include/obs/graphics/vec3.h:21,
                 from /usr/include/obs/obs.h:26,
                 from /usr/include/obs/obs-module.h:20,
                 from /home/kuon/Playground/waveform/src/source.hpp:20,
                 from /home/kuon/Playground/waveform/src/module.cpp:19:
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/smmintrin.h:125:1: error: ‘__m128 simde_x_mm_round_ps’ redeclared as different kind of entity
  125 | _mm_round_ps (__m128 __V, const int __M)
      | ^~~~~~~~~~~~
/usr/include/obs/util/simde/x86/sse.h:410:13: note: previous declaration ‘simde__m128 simde_x_mm_round_ps(simde__m128, int, int)’
  410 | simde__m128 simde_x_mm_round_ps(simde__m128 a, int rounding, int lax_rounding)
      |             ^~~~~~~~~~~~~~~~~~~
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/smmintrin.h:125:1: error: expected primary-expression before ‘__V’
  125 | _mm_round_ps (__m128 __V, const int __M)
      | ^~~~~~~~~~~~
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/smmintrin.h:125:1: error: expected ‘)’ before ‘__V’
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/smmintrin.h:125:1: note: to match this ‘(’
  125 | _mm_round_ps (__m128 __V, const int __M)
      | ^~~~~~~~~~~~
In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/immintrin.h:39,
                 from /home/kuon/Playground/waveform/src/aligned_mem.hpp:20,
                 from /home/kuon/Playground/waveform/src/source.hpp:25,
                 from /home/kuon/Playground/waveform/src/module.cpp:19:
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/smmintrin.h:128:2: error: expected ‘)’ before ‘extern’
  128 | }
      |  ^
      |  )
  129 | 
  130 | extern __inline __m128 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
      | ~~~~~~
In file included from /usr/include/obs/util/simde/x86/sse2.h:35,
                 from /usr/include/obs/util/sse-intrin.h:28,
                 from /usr/include/obs/graphics/vec4.h:23,
                 from /usr/include/obs/graphics/vec3.h:21,
                 from /usr/include/obs/obs.h:26,
                 from /usr/include/obs/obs-module.h:20,
                 from /home/kuon/Playground/waveform/src/source.hpp:20,
                 from /home/kuon/Playground/waveform/src/module.cpp:19:
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/smmintrin.h:125:1: note: to match this ‘(’
  125 | _mm_round_ps (__m128 __V, const int __M)
      | ^~~~~~~~~~~~
In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/immintrin.h:43,
                 from /home/kuon/Playground/waveform/src/aligned_mem.hpp:20,
                 from /home/kuon/Playground/waveform/src/source.hpp:25,
                 from /home/kuon/Playground/waveform/src/module.cpp:19:
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/avxintrin.h: In function ‘__m256d _mm256_add_pd(__m256d, __m256d)’:
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/avxintrin.h:143:22: error: ‘__v4df’ was not declared in this scope; did you mean ‘__v4sf’?
  143 |   return (__m256d) ((__v4df)__A + (__v4df)__B);
      |                      ^~~~~~
      |                      __v4sf
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/avxintrin.h:143:29: error: expected ‘)’ before ‘__A’
  143 |   return (__m256d) ((__v4df)__A + (__v4df)__B);
      |                    ~        ^~~
      |                             )
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/avxintrin.h: In function ‘__m256d _mm256_addsub_pd(__m256d, __m256d)’:
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/avxintrin.h:155:49: error: ‘__v4df’ was not declared in this scope; did you mean ‘__v4sf’?
  155 |   return (__m256d) __builtin_ia32_addsubpd256 ((__v4df)__A, (__v4df)__B);
      |                                                 ^~~~~~
      |                                                 __v4sf
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/avxintrin.h:155:69: error: expected ‘)’ before ‘__B’
  155 |   return (__m256d) __builtin_ia32_addsubpd256 ((__v4df)__A, (__v4df)__B);
      |                                               ~                     ^~~
      |                                                                     )
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/avxintrin.h:155:20: error: ‘__builtin_ia32_addsubpd256’ was not declared in this scope; did you mean ‘__builtin_ia32_addsubpd’?
  155 |   return (__m256d) __builtin_ia32_addsubpd256 ((__v4df)__A, (__v4df)__B);
      |                    ^~~~~~~~~~~~~~~~~~~~~~~~~~
      |                    __builtin_ia32_addsubpd
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/avxintrin.h: In function ‘__m256 _mm256_addsub_ps(__m256, __m256)’:
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/avxintrin.h:161:19: error: ‘__builtin_ia32_addsubps256’ was not declared in this scope; did you mean ‘__builtin_ia32_addsubps’?
  161 |   return (__m256) __builtin_ia32_addsubps256 ((__v8sf)__A, (__v8sf)__B);
      |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~
      |                   __builtin_ia32_addsubps
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/avxintrin.h: In function ‘__m256d _mm256_and_pd(__m256d, __m256d)’:
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/avxintrin.h:168:46: error: ‘__v4df’ was not declared in this scope; did you mean ‘__v4sf’?
  168 |   return (__m256d) __builtin_ia32_andpd256 ((__v4df)__A, (__v4df)__B);
      |                                              ^~~~~~
      |                                              __v4sf
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/avxintrin.h:168:66: error: expected ‘)’ before ‘__B’
  168 |   return (__m256d) __builtin_ia32_andpd256 ((__v4df)__A, (__v4df)__B);
      |                                            ~                     ^~~
      |                                                                  )
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/avxintrin.h:168:20: error: ‘__builtin_ia32_andpd256’ was not declared in this scope; did you mean ‘__builtin_ia32_andpd’?
  168 |   return (__m256d) __builtin_ia32_andpd256 ((__v4df)__A, (__v4df)__B);
      |                    ^~~~~~~~~~~~~~~~~~~~~~~
      |                    __builtin_ia32_andpd
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/avxintrin.h: In function ‘__m256 _mm256_and_ps(__m256, __m256)’:
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/avxintrin.h:174:19: error: ‘__builtin_ia32_andps256’ was not declared in this scope; did you mean ‘__builtin_ia32_andps’?
  174 |   return (__m256) __builtin_ia32_andps256 ((__v8sf)__A, (__v8sf)__B);
      |                   ^~~~~~~~~~~~~~~~~~~~~~~
      |                   __builtin_ia32_andps
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/avxintrin.h: In function ‘__m256d _mm256_andnot_pd(__m256d, __m256d)’:
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/avxintrin.h:180:47: error: ‘__v4df’ was not declared in this scope; did you mean ‘__v4sf’?
  180 |   return (__m256d) __builtin_ia32_andnpd256 ((__v4df)__A, (__v4df)__B);
      |                                               ^~~~~~
      |                                               __v4sf
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/avxintrin.h:180:67: error: expected ‘)’ before ‘__B’
  180 |   return (__m256d) __builtin_ia32_andnpd256 ((__v4df)__A, (__v4df)__B);
      |                                             ~                     ^~~
      |                                                                   )
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/avxintrin.h:180:20: error: ‘__builtin_ia32_andnpd256’ was not declared in this scope; did you mean ‘__builtin_ia32_andnpd’?
  180 |   return (__m256d) __builtin_ia32_andnpd256 ((__v4df)__A, (__v4df)__B);
      |                    ^~~~~~~~~~~~~~~~~~~~~~~~
      |                    __builtin_ia32_andnpd
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/avxintrin.h: In function ‘__m256 _mm256_andnot_ps(__m256, __m256)’:
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/avxintrin.h:186:19: error: ‘__builtin_ia32_andnps256’ was not declared in this scope; did you mean ‘__builtin_ia32_andnps’?
  186 |   return (__m256) __builtin_ia32_andnps256 ((__v8sf)__A, (__v8sf)__B);
      |                   ^~~~~~~~~~~~~~~~~~~~~~~~
      |                   __builtin_ia32_andnps
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/avxintrin.h: In function ‘__m256d _mm256_blend_pd(__m256d, __m256d, int)’:
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/avxintrin.h:196:48: error: ‘__v4df’ was not declared in this scope; did you mean ‘__v4sf’?
  196 |   return (__m256d) __builtin_ia32_blendpd256 ((__v4df)__X,
      |                                                ^~~~~~
      |                                                __v4sf
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/avxintrin.h:197:55: error: expected ‘)’ before ‘__Y’
  197 |                                               (__v4df)__Y,
      |                                                       ^~~
      |                                                       )
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/avxintrin.h:196:46: note: to match this ‘(’
  196 |   return (__m256d) __builtin_ia32_blendpd256 ((__v4df)__X,
      |                                              ^
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/avxintrin.h:196:20: error: ‘__builtin_ia32_blendpd256’ was not declared in this scope; did you mean ‘__builtin_ia32_blendpd’?
  196 |   return (__m256d) __builtin_ia32_blendpd256 ((__v4df)__X,
      |                    ^~~~~~~~~~~~~~~~~~~~~~~~~
      |                    __builtin_ia32_blendpd
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/avxintrin.h: In function ‘__m256 _mm256_blend_ps(__m256, __m256, int)’:
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/avxintrin.h:204:19: error: ‘__builtin_ia32_blendps256’ was not declared in this scope; did you mean ‘__builtin_ia32_blendps’?
  204 |   return (__m256) __builtin_ia32_blendps256 ((__v8sf)__X,
      |                   ^~~~~~~~~~~~~~~~~~~~~~~~~
      |                   __builtin_ia32_blendps
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/avxintrin.h: In function ‘__m256d _mm256_blendv_pd(__m256d, __m256d, __m256d)’:
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/avxintrin.h:221:49: error: ‘__v4df’ was not declared in this scope; did you mean ‘__v4sf’?
  221 |   return (__m256d) __builtin_ia32_blendvpd256 ((__v4df)__X,
      |                                                 ^~~~~~
      |                                                 __v4sf
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/avxintrin.h:222:56: error: expected ‘)’ before ‘__Y’
  222 |                                                (__v4df)__Y,
      |                                                        ^~~
      |                                                        )
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/avxintrin.h:221:47: note: to match this ‘(’
  221 |   return (__m256d) __builtin_ia32_blendvpd256 ((__v4df)__X,
      |                                               ^
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/avxintrin.h:223:56: error: expected ‘)’ before ‘__M’
  223 |                                                (__v4df)__M);
      |                                                        ^~~
      |                                                        )
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/avxintrin.h:221:47: note: to match this ‘(’
  221 |   return (__m256d) __builtin_ia32_blendvpd256 ((__v4df)__X,
      |                                               ^
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/avxintrin.h:221:20: error: ‘__builtin_ia32_blendvpd256’ was not declared in this scope; did you mean ‘__builtin_ia32_blendvpd’?
  221 |   return (__m256d) __builtin_ia32_blendvpd256 ((__v4df)__X,
      |                    ^~~~~~~~~~~~~~~~~~~~~~~~~~
      |                    __builtin_ia32_blendvpd
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/avxintrin.h: In function ‘__m256 _mm256_blendv_ps(__m256, __m256, __m256)’:
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/avxintrin.h:229:19: error: ‘__builtin_ia32_blendvps256’ was not declared in this scope; did you mean ‘__builtin_ia32_blendvps’?
  229 |   return (__m256) __builtin_ia32_blendvps256 ((__v8sf)__X,
      |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~
      |                   __builtin_ia32_blendvps
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/avxintrin.h: In function ‘__m256d _mm256_div_pd(__m256d, __m256d)’:
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/avxintrin.h:237:22: error: ‘__v4df’ was not declared in this scope; did you mean ‘__v4sf’?
  237 |   return (__m256d) ((__v4df)__A / (__v4df)__B);
      |                      ^~~~~~
      |                      __v4sf
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/avxintrin.h:237:29: error: expected ‘)’ before ‘__A’
  237 |   return (__m256d) ((__v4df)__A / (__v4df)__B);
      |                    ~        ^~~
      |                             )
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/avxintrin.h: In function ‘__m256 _mm256_dp_ps(__m256, __m256, int)’:
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/avxintrin.h:253:19: error: ‘__builtin_ia32_dpps256’ was not declared in this scope; did you mean ‘__builtin_ia32_dpps’?
  253 |   return (__m256) __builtin_ia32_dpps256 ((__v8sf)__X,
      |                   ^~~~~~~~~~~~~~~~~~~~~~
      |                   __builtin_ia32_dpps
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/avxintrin.h: In function ‘__m256d _mm256_hadd_pd(__m256d, __m256d)’:
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/avxintrin.h:266:47: error: ‘__v4df’ was not declared in this scope; did you mean ‘__v4sf’?
  266 |   return (__m256d) __builtin_ia32_haddpd256 ((__v4df)__X, (__v4df)__Y);
      |                                               ^~~~~~
      |                                               __v4sf
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/avxintrin.h:266:67: error: expected ‘)’ before ‘__Y’
  266 |   return (__m256d) __builtin_ia32_haddpd256 ((__v4df)__X, (__v4df)__Y);
      |                                             ~                     ^~~
      |                                                                   )
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include/avxintrin.h:266:20: error: ‘__builtin_ia32_haddpd256’ was not declared in this scope; did you mean ‘__builtin_ia32_haddpd’?

### truncated 
make[2]: *** [CMakeFiles/waveform.dir/build.make:76: CMakeFiles/waveform.dir/src/module.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:105: CMakeFiles/waveform.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
phandasm commented 2 years ago

Yeah I noticed this happens with newer GCC versions (?) Seems to be an issue with the intrinsic headers but I have no idea why, I'll have to do some investigating. Clang should work in the meantime, if that's an option.

kuon commented 2 years ago

Clang produces another error:

[ 54%] Building CXX object CMakeFiles/waveform.dir/src/module.cpp.o
In file included from /home/kuon/Repos/aur/obs-waveform/src/waveform-1.2.3/src/module.cpp:19:
In file included from /home/kuon/Repos/aur/obs-waveform/src/waveform-1.2.3/src/source.hpp:26:
/home/kuon/Repos/aur/obs-waveform/src/waveform-1.2.3/src/filter.hpp:42:1: error: '__target__' attribute takes one argument
DECORATE_AVX
^
/home/kuon/Repos/aur/obs-waveform/src/waveform-1.2.3/build/include/waveform_config.hpp:7:38: note: expanded from macro 'DECORATE_AVX'
#define DECORATE_AVX __attribute__ ((__target__ ("avx", "fma")))
                                     ^
In file included from /home/kuon/Repos/aur/obs-waveform/src/waveform-1.2.3/src/module.cpp:19:
In file included from /home/kuon/Repos/aur/obs-waveform/src/waveform-1.2.3/src/source.hpp:26:
/home/kuon/Repos/aur/obs-waveform/src/waveform-1.2.3/src/filter.hpp:52:1: error: '__target__' attribute takes one argument
DECORATE_AVX
^
/home/kuon/Repos/aur/obs-waveform/src/waveform-1.2.3/build/include/waveform_config.hpp:7:38: note: expanded from macro 'DECORATE_AVX'
#define DECORATE_AVX __attribute__ ((__target__ ("avx", "fma")))
                                     ^
In file included from /home/kuon/Repos/aur/obs-waveform/src/waveform-1.2.3/src/module.cpp:19:
In file included from /home/kuon/Repos/aur/obs-waveform/src/waveform-1.2.3/src/source.hpp:26:
/home/kuon/Repos/aur/obs-waveform/src/waveform-1.2.3/src/filter.hpp:59:1: error: '__target__' attribute takes one argument
DECORATE_AVX
^
/home/kuon/Repos/aur/obs-waveform/src/waveform-1.2.3/build/include/waveform_config.hpp:7:38: note: expanded from macro 'DECORATE_AVX'
#define DECORATE_AVX __attribute__ ((__target__ ("avx", "fma")))
                                     ^
In file included from /home/kuon/Repos/aur/obs-waveform/src/waveform-1.2.3/src/module.cpp:19:
In file included from /home/kuon/Repos/aur/obs-waveform/src/waveform-1.2.3/src/source.hpp:26:
/home/kuon/Repos/aur/obs-waveform/src/waveform-1.2.3/src/filter.hpp:65:1: error: '__target__' attribute takes one argument
DECORATE_AVX
^
/home/kuon/Repos/aur/obs-waveform/src/waveform-1.2.3/build/include/waveform_config.hpp:7:38: note: expanded from macro 'DECORATE_AVX'
#define DECORATE_AVX __attribute__ ((__target__ ("avx", "fma")))
                                     ^
In file included from /home/kuon/Repos/aur/obs-waveform/src/waveform-1.2.3/src/module.cpp:19:
In file included from /home/kuon/Repos/aur/obs-waveform/src/waveform-1.2.3/src/source.hpp:26:
/home/kuon/Repos/aur/obs-waveform/src/waveform-1.2.3/src/filter.hpp:133:1: error: '__target__' attribute takes one argument
DECORATE_AVX
^
/home/kuon/Repos/aur/obs-waveform/src/waveform-1.2.3/build/include/waveform_config.hpp:7:38: note: expanded from macro 'DECORATE_AVX'
#define DECORATE_AVX __attribute__ ((__target__ ("avx", "fma")))
                                     ^
In file included from /home/kuon/Repos/aur/obs-waveform/src/waveform-1.2.3/src/module.cpp:19:
In file included from /home/kuon/Repos/aur/obs-waveform/src/waveform-1.2.3/src/source.hpp:26:
/home/kuon/Repos/aur/obs-waveform/src/waveform-1.2.3/src/filter.hpp:177:1: error: '__target__' attribute takes one argument
DECORATE_AVX
^
/home/kuon/Repos/aur/obs-waveform/src/waveform-1.2.3/build/include/waveform_config.hpp:7:38: note: expanded from macro 'DECORATE_AVX'
#define DECORATE_AVX __attribute__ ((__target__ ("avx", "fma")))
                                     ^
In file included from /home/kuon/Repos/aur/obs-waveform/src/waveform-1.2.3/src/module.cpp:19:
/home/kuon/Repos/aur/obs-waveform/src/waveform-1.2.3/src/source.hpp:146:24: warning: suggest braces around initialization of subobject [-Wmissing-braces]
    vec4 m_color_base{ 1.0, 1.0, 1.0, 1.0 };
                       ^~~~~~~~~~~~~~~~~~
                       {                 }
/home/kuon/Repos/aur/obs-waveform/src/waveform-1.2.3/src/source.hpp:147:25: warning: suggest braces around initialization of subobject [-Wmissing-braces]
    vec4 m_color_crest{ 1.0, 1.0, 1.0, 1.0 };
                        ^~~~~~~~~~~~~~~~~~
                        {                 }
2 warnings and 6 errors generated.
kuon commented 2 years ago

Actually it was easy to fix, I made a PR.

kuon commented 2 years ago

I had an older version checked out and mixed things up, clang build is working on master.

phandasm commented 2 years ago

Turns out newer GCC versions don't seem to like using 256-bit intrinsics without enabling -mavx for the entire TU, regardless of function-level target attributes. The last non-AVX CPU is ancient enough now that I'm just going to target AVX as the baseline.

Current master branch should build with GCC 11.2 now.