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

Please fix build system to allow building without SSE instructions #47

Open
xctan opened this issue Oct 13, 2021 · 3 comments
Open

Please fix build system to allow building without SSE instructions #47

xctan opened this issue Oct 13, 2021 · 3 comments

Comments

@xctan
Copy link

xctan commented Oct 13, 2021

I'm trying to build this package from source code for Arch Linux RISC-V port. But I encountered errors like unrecognized command-line option '-msse'. This problem isn't disappeared when I changed BUILD_SSE from ON to OFF. After searching the commit that introduced BUILD_SSE, I found that the commit 3410625 didn't completely resolve the problem. Even when -DBUILD_SSE=OFF is presented to cmake, it seems like src/avtk/CMakeLists.txt still inserts -msse -msse2 -mfpmath=sse into CMAKE_CXX_FLAGS.

Please provide additional checks for other architectures in src/avtk/CMakeLists.txt to fix this issue.

IF(NOT ${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm")
SET(CMAKE_C_FLAGS "-fPIC -msse -msse2 -mfpmath=sse -g") # -fsanitize=address
SET(CMAKE_CXX_FLAGS "-fPIC -msse -msse2 -mfpmath=sse -g") # -fsanitize=address
ELSE()
SET(CMAKE_C_FLAGS "-fPIC -mfpu=neon -g")
SET(CMAKE_CXX_FLAGS "-fPIC -mfpu=neon -g")
ENDIF(NOT ${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm")

@harryhaaren
Copy link
Member

Hi,

Thanks for reporting. I don't have a RISC-V board/port to test on unfortunately, so its a little awkward to know what flags should be passed to the RISC-V compiler for SIMD support.

If you have the time would you propose the C_FLAGS to use, or even better, file a PR which makes the code changes required?

Regards, -Harry

@xctan
Copy link
Author

xctan commented Oct 19, 2021

Standard Extension for Packed-SIMD Instructions is still open as for now. So, I think -DBUILD_SSE=OFF should be able to turn off all SIMD flags as we don't have available SIMD instructions currently for rv64gc arch.

@harryhaaren
Copy link
Member

Hi, as a new architecture, I would encourage the use of Meson build system instead of CMake. I'm actively moving all OpenAV projects to Meson for a while now - CMake is awkward and Meson is better in many ways.

Aside from that, current master branch seems to work as you describe, but use BUILD_SSE=0 not OFF.
The below commands do not show -msse compiler-flags here.

mkdir build
cd build
cmake .. -DBUILD_SSE=0
make VERBOSE=1

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

No branches or pull requests

2 participants