树莓派Raspbian编译OpenViBE源码遇GCC‘-msse2’选项识别错误
Let’s cut straight to the chase: that error pops up because your Raspberry Pi uses an ARM-based processor, and -msse2 is a compiler flag exclusive to x86/x86_64 architectures—it enables Streaming SIMD Extensions 2 instructions, which ARM doesn’t support. OpenViBE’s default build config is probably hardcoding this flag for x86 systems, so we need to adjust it for ARM.
Here’s how to fix it step by step:
1. Locate and adjust the SSE2 compile flag
First, find where -msse2 is being set in the OpenViBE source code. Run this command from the root of your OpenViBE source directory:
grep -r "msse2" /home/pi/Desktop/openvibe-2.0.0-src/
This will show you all files referencing the flag—common spots include the top-level CMakeLists.txt, architecture-specific config files, or module-level build scripts.
Once you find the line(s) adding -msse2, you have two options:
- Option 1 (simple): Comment out or delete the line entirely. ARM doesn’t need this x86-specific optimization anyway.
- Option 2 (cleaner): Add a conditional check to only enable the flag on x86 systems. For example, if you see:
Replace it with:add_compile_options(-msse2)if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|i386") add_compile_options(-msse2) endif()
2. Clean and regenerate build files
Before rebuilding, wipe your existing build directory to ensure old configs don’t linger:
rm -rf /home/pi/Desktop/openvibe-2.0.0-src/build/sdk-Release
Then re-run CMake to generate a fresh ARM-tailored build setup:
cd /home/pi/Desktop/openvibe-2.0.0-src mkdir -p build/sdk-Release && cd build/sdk-Release cmake ../.. -DCMAKE_BUILD_TYPE=Release -DCMAKE_SYSTEM_PROCESSOR=arm
3. Enable ARM-specific optimizations (optional but recommended)
Since we’re removing x86 optimizations, you can enable ARM’s equivalent SIMD instruction set: NEON. Check if OpenViBE has a CMake flag for this (many projects do). If you find docs mentioning ENABLE_NEON or similar, add it to your CMake command:
cmake ../.. -DCMAKE_BUILD_TYPE=Release -DCMAKE_SYSTEM_PROCESSOR=arm -DENABLE_NEON=ON
4. Rebuild OpenViBE
Now kick off the build again:
ninja
If you hit similar errors for other x86 flags (like -msse3, -mavx), repeat step 1 to remove or conditionally disable them.
A quick heads-up: Some parts of OpenViBE might be heavily optimized for x86, so you could run into other ARM compatibility issues later. If that happens, check for an ARM-specific branch or community patch for OpenViBE 2.0.0, or try a newer version with better ARM support.
内容的提问来源于stack exchange,提问作者Socrates

