RandyGaul / cute_framework

The *cutest* framework out there for creating 2D games in C++!
https://randygaul.github.io/cute_framework/#/
Other
538 stars 32 forks source link

Specifying CMAKE_BUILD_TYPE as `Release` breaks build #173

Closed alexlnkp closed 1 month ago

alexlnkp commented 3 months ago

Simple bug, no clue why it happens though.

To reproduce:

  1. Run cmake -B build -DCMAKE_BUILD_TYPE=Release
  2. Run cmake --build build or cmake --build build --config Release

Honestly, first time when I was trying to build this framework, I did these two steps over and over (that's just how I'm used to building projects in general), I even thought that the whole build system was just broken due to the error that was printed. Speaking of, here's the error:

# During build of `CMakeFiles/cute.dir/src/cute_audio.cpp.o`...
In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/14.1.1/include/immintrin.h:39,
                 from /home/alex/Desktop/cute_framework/build/_deps/sdl2-build/include/SDL_cpuinfo.h:111,
                 from /home/alex/Desktop/cute_framework/build/_deps/sdl2-build/include/SDL.h:38,
                 from /home/alex/Desktop/cute_framework/libraries/cute/cute_sound.h:568,
                 from /home/alex/Desktop/cute_framework/src/cute_audio.cpp:26:
/usr/lib/gcc/x86_64-pc-linux-gnu/14.1.1/include/smmintrin.h: In function ‘void cs_mix()’:
/usr/lib/gcc/x86_64-pc-linux-gnu/14.1.1/include/smmintrin.h:448:1: error: inlining failed in call to ‘always_inline’ ‘int _mm_extract_epi32(__m128i, int)’: target specific option mismatch
  448 | _mm_extract_epi32 (__m128i __X, const int __N)
      | ^~~~~~~~~~~~~~~~~
/home/alex/Desktop/cute_framework/libraries/cute/cute_sound.h:2312:85: note: called from here
 2312 |                                                         int i3 = cs_mm_extract_epi32(index_int, 0);
      |                                                                                     ^
/usr/lib/gcc/x86_64-pc-linux-gnu/14.1.1/include/smmintrin.h:448:1: error: inlining failed in call to ‘always_inline’ ‘int _mm_extract_epi32(__m128i, int)’: target specific option mismatch
  448 | _mm_extract_epi32 (__m128i __X, const int __N)
      | ^~~~~~~~~~~~~~~~~
/home/alex/Desktop/cute_framework/libraries/cute/cute_sound.h:2311:85: note: called from here
 2311 |                                                         int i2 = cs_mm_extract_epi32(index_int, 1);
      |                                                                                     ^
/usr/lib/gcc/x86_64-pc-linux-gnu/14.1.1/include/smmintrin.h:448:1: error: inlining failed in call to ‘always_inline’ ‘int _mm_extract_epi32(__m128i, int)’: target specific option mismatch
  448 | _mm_extract_epi32 (__m128i __X, const int __N)
      | ^~~~~~~~~~~~~~~~~
/home/alex/Desktop/cute_framework/libraries/cute/cute_sound.h:2310:85: note: called from here
 2310 |                                                         int i1 = cs_mm_extract_epi32(index_int, 2);
      |                                                                                     ^
/usr/lib/gcc/x86_64-pc-linux-gnu/14.1.1/include/smmintrin.h:448:1: error: inlining failed in call to ‘always_inline’ ‘int _mm_extract_epi32(__m128i, int)’: target specific option mismatch
  448 | _mm_extract_epi32 (__m128i __X, const int __N)
      | ^~~~~~~~~~~~~~~~~
/home/alex/Desktop/cute_framework/libraries/cute/cute_sound.h:2309:85: note: called from here
 2309 |                                                         int i0 = cs_mm_extract_epi32(index_int, 3);
      |                                                                                     ^
/usr/lib/gcc/x86_64-pc-linux-gnu/14.1.1/include/smmintrin.h:448:1: error: inlining failed in call to ‘always_inline’ ‘int _mm_extract_epi32(__m128i, int)’: target specific option mismatch
  448 | _mm_extract_epi32 (__m128i __X, const int __N)
      | ^~~~~~~~~~~~~~~~~
/home/alex/Desktop/cute_framework/libraries/cute/cute_sound.h:2312:85: note: called from here
 2312 |                                                         int i3 = cs_mm_extract_epi32(index_int, 0);
      |                                                                                     ^
/usr/lib/gcc/x86_64-pc-linux-gnu/14.1.1/include/smmintrin.h:448:1: error: inlining failed in call to ‘always_inline’ ‘int _mm_extract_epi32(__m128i, int)’: target specific option mismatch
  448 | _mm_extract_epi32 (__m128i __X, const int __N)
      | ^~~~~~~~~~~~~~~~~
/home/alex/Desktop/cute_framework/libraries/cute/cute_sound.h:2311:85: note: called from here
 2311 |                                                         int i2 = cs_mm_extract_epi32(index_int, 1);
      |                                                                                     ^
/usr/lib/gcc/x86_64-pc-linux-gnu/14.1.1/include/smmintrin.h:448:1: error: inlining failed in call to ‘always_inline’ ‘int _mm_extract_epi32(__m128i, int)’: target specific option mismatch
  448 | _mm_extract_epi32 (__m128i __X, const int __N)
      | ^~~~~~~~~~~~~~~~~
/home/alex/Desktop/cute_framework/libraries/cute/cute_sound.h:2310:85: note: called from here
 2310 |                                                         int i1 = cs_mm_extract_epi32(index_int, 2);
      |                                                                                     ^
/usr/lib/gcc/x86_64-pc-linux-gnu/14.1.1/include/smmintrin.h:448:1: error: inlining failed in call to ‘always_inline’ ‘int _mm_extract_epi32(__m128i, int)’: target specific option mismatch
  448 | _mm_extract_epi32 (__m128i __X, const int __N)
      | ^~~~~~~~~~~~~~~~~
/home/alex/Desktop/cute_framework/libraries/cute/cute_sound.h:2309:85: note: called from here
 2309 |                                                         int i0 = cs_mm_extract_epi32(index_int, 3);
      |                                                                                     ^
/usr/lib/gcc/x86_64-pc-linux-gnu/14.1.1/include/smmintrin.h:448:1: error: inlining failed in call to ‘always_inline’ ‘int _mm_extract_epi32(__m128i, int)’: target specific option mismatch
  448 | _mm_extract_epi32 (__m128i __X, const int __N)
      | ^~~~~~~~~~~~~~~~~
/home/alex/Desktop/cute_framework/libraries/cute/cute_sound.h:2345:85: note: called from here
 2345 |                                                         int i3 = cs_mm_extract_epi32(index_int, 0);
      |                                                                                     ^
/usr/lib/gcc/x86_64-pc-linux-gnu/14.1.1/include/smmintrin.h:448:1: error: inlining failed in call to ‘always_inline’ ‘int _mm_extract_epi32(__m128i, int)’: target specific option mismatch
  448 | _mm_extract_epi32 (__m128i __X, const int __N)
      | ^~~~~~~~~~~~~~~~~
/home/alex/Desktop/cute_framework/libraries/cute/cute_sound.h:2344:85: note: called from here
 2344 |                                                         int i2 = cs_mm_extract_epi32(index_int, 1);
      |                                                                                     ^
/usr/lib/gcc/x86_64-pc-linux-gnu/14.1.1/include/smmintrin.h:448:1: error: inlining failed in call to ‘always_inline’ ‘int _mm_extract_epi32(__m128i, int)’: target specific option mismatch
  448 | _mm_extract_epi32 (__m128i __X, const int __N)
      | ^~~~~~~~~~~~~~~~~
/home/alex/Desktop/cute_framework/libraries/cute/cute_sound.h:2343:85: note: called from here
 2343 |                                                         int i1 = cs_mm_extract_epi32(index_int, 2);
      |                                                                                     ^
/usr/lib/gcc/x86_64-pc-linux-gnu/14.1.1/include/smmintrin.h:448:1: error: inlining failed in call to ‘always_inline’ ‘int _mm_extract_epi32(__m128i, int)’: target specific option mismatch
  448 | _mm_extract_epi32 (__m128i __X, const int __N)
      | ^~~~~~~~~~~~~~~~~
/home/alex/Desktop/cute_framework/libraries/cute/cute_sound.h:2342:85: note: called from here
 2342 |                                                         int i0 = cs_mm_extract_epi32(index_int, 3);
      |                                                                                     ^
/usr/lib/gcc/x86_64-pc-linux-gnu/14.1.1/include/smmintrin.h:448:1: error: inlining failed in call to ‘always_inline’ ‘int _mm_extract_epi32(__m128i, int)’: target specific option mismatch
  448 | _mm_extract_epi32 (__m128i __X, const int __N)
      | ^~~~~~~~~~~~~~~~~
/home/alex/Desktop/cute_framework/libraries/cute/cute_sound.h:2345:85: note: called from here
 2345 |                                                         int i3 = cs_mm_extract_epi32(index_int, 0);
      |                                                                                     ^
/usr/lib/gcc/x86_64-pc-linux-gnu/14.1.1/include/smmintrin.h:448:1: error: inlining failed in call to ‘always_inline’ ‘int _mm_extract_epi32(__m128i, int)’: target specific option mismatch
  448 | _mm_extract_epi32 (__m128i __X, const int __N)
      | ^~~~~~~~~~~~~~~~~
/home/alex/Desktop/cute_framework/libraries/cute/cute_sound.h:2344:85: note: called from here
 2344 |                                                         int i2 = cs_mm_extract_epi32(index_int, 1);
      |                                                                                     ^
/usr/lib/gcc/x86_64-pc-linux-gnu/14.1.1/include/smmintrin.h:448:1: error: inlining failed in call to ‘always_inline’ ‘int _mm_extract_epi32(__m128i, int)’: target specific option mismatch
  448 | _mm_extract_epi32 (__m128i __X, const int __N)
      | ^~~~~~~~~~~~~~~~~
/home/alex/Desktop/cute_framework/libraries/cute/cute_sound.h:2343:85: note: called from here
 2343 |                                                         int i1 = cs_mm_extract_epi32(index_int, 2);
      |                                                                                     ^
/usr/lib/gcc/x86_64-pc-linux-gnu/14.1.1/include/smmintrin.h:448:1: error: inlining failed in call to ‘always_inline’ ‘int _mm_extract_epi32(__m128i, int)’: target specific option mismatch
  448 | _mm_extract_epi32 (__m128i __X, const int __N)
      | ^~~~~~~~~~~~~~~~~
/home/alex/Desktop/cute_framework/libraries/cute/cute_sound.h:2342:85: note: called from here
 2342 |                                                         int i0 = cs_mm_extract_epi32(index_int, 3);
      |                                                                                     ^
/usr/lib/gcc/x86_64-pc-linux-gnu/14.1.1/include/smmintrin.h:448:1: error: inlining failed in call to ‘always_inline’ ‘int _mm_extract_epi32(__m128i, int)’: target specific option mismatch
  448 | _mm_extract_epi32 (__m128i __X, const int __N)
      | ^~~~~~~~~~~~~~~~~
/home/alex/Desktop/cute_framework/libraries/cute/cute_sound.h:2312:85: note: called from here
 2312 |                                                         int i3 = cs_mm_extract_epi32(index_int, 0);
      |                                                                                     ^
/usr/lib/gcc/x86_64-pc-linux-gnu/14.1.1/include/smmintrin.h:448:1: error: inlining failed in call to ‘always_inline’ ‘int _mm_extract_epi32(__m128i, int)’: target specific option mismatch
  448 | _mm_extract_epi32 (__m128i __X, const int __N)
      | ^~~~~~~~~~~~~~~~~
/home/alex/Desktop/cute_framework/libraries/cute/cute_sound.h:2311:85: note: called from here
 2311 |                                                         int i2 = cs_mm_extract_epi32(index_int, 1);
      |                                                                                     ^
/usr/lib/gcc/x86_64-pc-linux-gnu/14.1.1/include/smmintrin.h:448:1: error: inlining failed in call to ‘always_inline’ ‘int _mm_extract_epi32(__m128i, int)’: target specific option mismatch
  448 | _mm_extract_epi32 (__m128i __X, const int __N)
      | ^~~~~~~~~~~~~~~~~
/home/alex/Desktop/cute_framework/libraries/cute/cute_sound.h:2310:85: note: called from here
 2310 |                                                         int i1 = cs_mm_extract_epi32(index_int, 2);
      |                                                                                     ^
/usr/lib/gcc/x86_64-pc-linux-gnu/14.1.1/include/smmintrin.h:448:1: error: inlining failed in call to ‘always_inline’ ‘int _mm_extract_epi32(__m128i, int)’: target specific option mismatch
  448 | _mm_extract_epi32 (__m128i __X, const int __N)
      | ^~~~~~~~~~~~~~~~~
/home/alex/Desktop/cute_framework/libraries/cute/cute_sound.h:2309:85: note: called from here
 2309 |                                                         int i0 = cs_mm_extract_epi32(index_int, 3);
      |                                                                                     ^
/usr/lib/gcc/x86_64-pc-linux-gnu/14.1.1/include/smmintrin.h:448:1: error: inlining failed in call to ‘always_inline’ ‘int _mm_extract_epi32(__m128i, int)’: target specific option mismatch
  448 | _mm_extract_epi32 (__m128i __X, const int __N)
      | ^~~~~~~~~~~~~~~~~
/home/alex/Desktop/cute_framework/libraries/cute/cute_sound.h:2345:85: note: called from here
 2345 |                                                         int i3 = cs_mm_extract_epi32(index_int, 0);
      |                                                                                     ^
/usr/lib/gcc/x86_64-pc-linux-gnu/14.1.1/include/smmintrin.h:448:1: error: inlining failed in call to ‘always_inline’ ‘int _mm_extract_epi32(__m128i, int)’: target specific option mismatch
  448 | _mm_extract_epi32 (__m128i __X, const int __N)
      | ^~~~~~~~~~~~~~~~~
/home/alex/Desktop/cute_framework/libraries/cute/cute_sound.h:2344:85: note: called from here
 2344 |                                                         int i2 = cs_mm_extract_epi32(index_int, 1);
      |                                                                                     ^
/usr/lib/gcc/x86_64-pc-linux-gnu/14.1.1/include/smmintrin.h:448:1: error: inlining failed in call to ‘always_inline’ ‘int _mm_extract_epi32(__m128i, int)’: target specific option mismatch
  448 | _mm_extract_epi32 (__m128i __X, const int __N)
      | ^~~~~~~~~~~~~~~~~
/home/alex/Desktop/cute_framework/libraries/cute/cute_sound.h:2343:85: note: called from here
 2343 |                                                         int i1 = cs_mm_extract_epi32(index_int, 2);
      |                                                                                     ^
/usr/lib/gcc/x86_64-pc-linux-gnu/14.1.1/include/smmintrin.h:448:1: error: inlining failed in call to ‘always_inline’ ‘int _mm_extract_epi32(__m128i, int)’: target specific option mismatch
  448 | _mm_extract_epi32 (__m128i __X, const int __N)
      | ^~~~~~~~~~~~~~~~~
/home/alex/Desktop/cute_framework/libraries/cute/cute_sound.h:2342:85: note: called from here
 2342 |                                                         int i0 = cs_mm_extract_epi32(index_int, 3);
      |                                                                                     ^
make[2]: *** [CMakeFiles/cute.dir/build.make:104: CMakeFiles/cute.dir/src/cute_audio.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:684: CMakeFiles/cute.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

Running cmake -B build && cmake --build build builds without any issues though. I'd assume wrong stuff was defined in the cute_audio source?

bullno1 commented 2 months ago

Could be related: https://github.com/RandyGaul/cute_framework/pull/187

I get the same problem when doing RelWithDebInfo

alexlnkp commented 2 months ago

Could be related: #187

I get the same problem when doing RelWithDebInfo

On stackoverflow people say to add -msse4.1 to CFLAGS and CXXFLAGS. Can't confirm if that works or not, but I'll test that

bullno1 commented 2 months ago

That's what I did but it's on the gpu branch. Could be back-ported.

But gpu branch will get merged soon anw.

RandyGaul commented 1 month ago

I haven't ran into this yet with SDL3, going to close for now. Please reopen if anyone has a problem here!