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

Compiler error on SSE intrinsics with GCC 32-bit #541

Closed
stgatilov opened this issue Mar 14, 2021 · 4 comments
Closed

Compiler error on SSE intrinsics with GCC 32-bit #541

stgatilov opened this issue Mar 14, 2021 · 4 comments

Comments

@stgatilov
Copy link

stgatilov commented Mar 14, 2021

Tried to build OpenAL 1.21.1 with gcc 5.4.0 for x86/32-bit, using Linux x86/64-bit.
To be honest, can't say for sure how exactly 32-bit option is set: I pass -s arch=x86 to conan build. If it is important, I can look it up.

I get compile errors due to SSE intrinsics. The errors look pretty weird to me:

In file included from /home/user/tdm/conan_cache/.conan/data/openal/1.21.1/thedarkmod/local/build/582f54fdf8e290e24a7424ad8faa5117ae0c0387/source_subfolder/alc/alcmain.h:22:0,
                 from /home/user/tdm/conan_cache/.conan/data/openal/1.21.1/thedarkmod/local/build/582f54fdf8e290e24a7424ad8faa5117ae0c0387/source_subfolder/alc/alu.cpp:47:
/home/user/tdm/conan_cache/.conan/data/openal/1.21.1/thedarkmod/local/build/582f54fdf8e290e24a7424ad8faa5117ae0c0387/source_subfolder/common/alnumeric.h: In function ‘int float2int(float)’:
/home/user/tdm/conan_cache/.conan/data/openal/1.21.1/thedarkmod/local/build/582f54fdf8e290e24a7424ad8faa5117ae0c0387/source_subfolder/common/alnumeric.h:146:26: warning: SSE vector return without SSE enabled changes the ABI [-Wpsabi]
     return _mm_cvtt_ss2si(_mm_set_ss(f));
                          ^
In file included from /usr/lib/gcc/x86_64-linux-gnu/5/include/x86intrin.h:31:0,
                 from /usr/include/x86_64-linux-gnu/c++/5/32/bits/opt_random.h:33,
                 from /usr/include/c++/5/random:50,
                 from /usr/include/c++/5/bits/stl_algo.h:66,
                 from /usr/include/c++/5/algorithm:62,
                 from /home/user/tdm/conan_cache/.conan/data/openal/1.21.1/thedarkmod/local/build/582f54fdf8e290e24a7424ad8faa5117ae0c0387/source_subfolder/alc/alu.cpp:25:
/usr/lib/gcc/x86_64-linux-gnu/5/include/xmmintrin.h: In function ‘int fastf2i(float)’:
/usr/lib/gcc/x86_64-linux-gnu/5/include/xmmintrin.h:512:1: error: inlining failed in call to always_inline ‘int _mm_cvt_ss2si(__m128)’: target specific option mismatch
 _mm_cvt_ss2si (__m128 __A)
 ^

As far as I understand, it means that SSE intrinsics are compiled without setting -msse compiler flag. For some reason, it is required by GCC. The problem seems to be similar to the old issue.

Here is CMakeCache.txt from the build.

Passing "ALSOFT_REQUIRE_SSE2" to CMake does not help. "ALSOFT_ENABLE_SSE2_CODEGEN" does not help either.

@stgatilov
Copy link
Author

stgatilov commented Mar 14, 2021

Bruteforce approach worked:

self._cmake.definitions["CMAKE_C_FLAGS"] = "-msse2 -mfpmath=sse"
self._cmake.definitions["CMAKE_CXX_FLAGS"] = "-msse2 -mfpmath=sse"

That's equivalent to -DCMAKE_C_FLAGS="-msse2 -mfpmath=sse" -DCMAKE_CXX_FLAGS="-msse2 -mfpmath=sse", I guess

@kcat
Copy link
Owner

kcat commented Mar 14, 2021

Are you able to show the command line it tried to use when it failed? The _mm_cvtt_ss2si and _mm_cvt_ss2si calls are done under the HAVE_SSE_INTRINSICS macro check, which gets set when

    foreach(flag_var ${SSE_FLAGS})
        set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${flag_var}")
    endforeach()

    check_c_source_compiles("#include <emmintrin.h>
        int main() {_mm_pause(); return 0;}" HAVE_SSE_INTRINSICS)

succeeds in CMake. The SSE_FLAGS were added to the project's compiler flags, and should include -msse2 -mfpmath=sse if it got to that point with 32-bit GCC.

@stgatilov
Copy link
Author

stgatilov commented Mar 15, 2021

I started putting message commands all over the CMake code, and found out that CMAKE_SIZEOF_VOID_P is 8 =)
I'm pretty sure it is the problem of conan recipe, and not of OpenAL itself.

Sorry for bothering.

@stgatilov
Copy link
Author

Here is the conan issue: conan-io/conan-center-index#4889

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

No branches or pull requests

2 participants