Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails to build on x86 without SSE #374

Closed
jbeich opened this issue Oct 8, 2019 · 0 comments · Fixed by #681
Closed

Fails to build on x86 without SSE #374

jbeich opened this issue Oct 8, 2019 · 0 comments · Fixed by #681

Comments

@jbeich
Copy link
Contributor

jbeich commented Oct 8, 2019

i386 target on FreeBSD, NetBSD, OpenBSD (and maybe some Linux distributions) lacks SSE unless -msse is passed. For one, FreeBSD i386 targets -march=i486 by default but may switch to -march=i586 soon.

$ c++ -v
FreeBSD clang version 8.0.0 (tags/RELEASE_800/final 356365) (based on LLVM 8.0.0)
Target: i386-unknown-freebsd11.3
Thread model: posix
InstalledDir: /usr/bin

$ meson _build
$ ninja -C _build
[...]
FAILED: vmaf@sta/src_libvmaf_src_adm_tools.c.o
cc -Ivmaf@sta -I. -I.. -I.././src/ptools/opencontainers_1_8_4/include -I.././src/libvmaf/src/ -I.././src/libvmaf/src/common -I.././src/ptools/ -Xclang -fcolor-diagnostics -pipe -Wall -Winvalid-pch -g -fPIC -std=c99 -w -Wextra -pedantic -D_FILE_OFFSET_BITS=64 '-D MULTI_THREADING' -DOC_NEW_STYLE_INCLUDES -MD -MQ 'vmaf@sta/src_libvmaf_src_adm_tools.c.o' -MF 'vmaf@sta/src_libvmaf_src_adm_tools.c.o.d' -o 'vmaf@sta/src_libvmaf_src_adm_tools.c.o' -c ../src/libvmaf/src/adm_tools.c
../src/libvmaf/src/adm_tools.c:36:16: error: always_inline function '_mm_cvtss_f32' requires target feature 'sse', but would be inlined into function 'rcp_s' that is compiled without support for 'sse'
    float xi = _mm_cvtss_f32(_mm_rcp_ss(_mm_load_ss(&x)));
               ^
../src/libvmaf/src/adm_tools.c:36:30: error: always_inline function '_mm_rcp_ss' requires target feature 'sse', but would be inlined into function 'rcp_s' that is compiled without support for 'sse'
    float xi = _mm_cvtss_f32(_mm_rcp_ss(_mm_load_ss(&x)));
                             ^
../src/libvmaf/src/adm_tools.c:36:41: error: always_inline function '_mm_load_ss' requires target feature 'sse', but would be inlined into function 'rcp_s' that is compiled without support for 'sse'
    float xi = _mm_cvtss_f32(_mm_rcp_ss(_mm_load_ss(&x)));
                                        ^
3 errors generated.
kylophone pushed a commit that referenced this issue Oct 19, 2020
SSE is not guaranteed to be present on x86 hosts, so i386..i686
compilers default to -mno-sse. That however makes the build fail
because vmaf unconditionally uses emmintrin functions which are
not available under no-sse. ppc64le builds however are just fine, so...

Change the macro guarding emmintrin to not match on x86-like
architectures, but to match on the enablement of SSE2. The macro
"__SSE2__" is the gcc name and is true whenever -msse2 is enabled
(explicitly or implicitly); clang should behave the same. I have not
tested this under other compilers such as Microsoft, though.

Fixes: #374
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants