mortie / swaylock-effects

Swaylock, with fancy effects
MIT License
708 stars 45 forks source link

failed to compile on debian buster T.T #44

Closed ahmadie closed 3 years ago

ahmadie commented 3 years ago

original swaylock compiles fine, but could not compile swaylock-effect, error is following:

ninja: Entering directory `build' [1/2] Compiling C object 'swaylock@exe/fade.c.o'. FAILED: swaylock@exe/fade.c.o cc -Iswaylock@exe -I. -I.. -Iinclude -I../include -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libmount -I/usr/include/blkid -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Werror -std=c11 -g -Wno-unused-parameter -Wno-unused-result -Wundef -Wvla -fopenmp '-DSYSCONFDIR="//usr/local/etc"' -mtune=native '-DSWAYLOCK_VERSION="v1.6-3-4-g3aa6b4b (" DATE ", branch '"'"'master'"'"')"' -pthread -MD -MQ 'swaylock@exe/fade.c.o' -MF 'swaylock@exe/fade.c.o.d' -o 'swaylock@exe/fade.c.o' -c ../fade.c ../fade.c: In function ‘set_alpha_sse’: ../fade.c:41:22: error: implicit declaration of function ‘_mm_loadu_si64’; did you mean ‘_mm_loadl_epi64’? [-Werror=implicit-function-declaration] m128i argb_vec = _mm_loadu_si64(orig_bytes + index); ^~~~~~ _mm_loadl_epi64 ../fade.c:41:22: error: incompatible types when initializing type ‘m128i’ {aka ‘__vector(2) long long int’} using type ‘int’ ../fade.c:49:3: error: implicit declaration of function ‘_mm_storeu_si64’; did you mean ‘_mm_store_epi64’? [-Werror=implicit-function-declaration] _mm_storeu_si64(dest_bytes + index, argb_vec); ^~~~~~~ _mm_store_epi64 cc1: all warnings being treated as errors ninja: build stopped: subcommand failed.

mortie commented 3 years ago

The issue is that, for whatever reason, GCC versions before GCC 9 is missing an SSE intrinsic. Because the compiler claims to support SSE2 (by defining the __SSE2__ macro), the SSE-based version of the fade animation is chosen; but because the compiler doesn't actually support all of SSE, it fails to compile.

As a temporary workaround, you can go to fade.c and replace this line: https://github.com/mortie/swaylock-effects/blob/3aa6b4b9b327caeedd3051c46c50408a5cd719cb/fade.c#L18 with something like #if 0. This will disable the SSE-based fade and use the fallback instead.

Keeping this issue open until I've implemented smarter feature detection to disable the SSE-based code on compilers which claim to support SSE but don't.

ahmadie commented 3 years ago

Thanks !!! LOVE

mortie commented 3 years ago

Alright, after https://github.com/mortie/swaylock-effects/commit/744a59ba4864113457c58b8da7b415068bf86c42, SSE can be disabled using the sse meson option (e.g meson configure -Dsse=false).

I should still add some more intelligent compiler version checking, but I'll consider this issue fixed now.

ahmadie commented 3 years ago

The line should be as follow, which is different in master fade.c

if defined(DUSE_SSE) && ...

mortie commented 3 years ago

No, defined(USE_SSE) is correct. When compiling with sse=true, the argument -DUSE_SSE is added to the compile arguments list, and -DUSE_SSE tells GCC to define a macro called USE_SSE.

ahmadie commented 3 years ago

I see, I had to change the line to my comment so it compiles though ! I maybe using old compiler or wrong build tools...