C++ 未启用 SSE 指令集
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9144545/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
SSE instruction set not enabled
提问by ksolid
I am getting trouble with this error: "SSE instruction set not enabled". How I can figure this out?
我遇到此错误的问题:“SSE 指令集未启用”。我怎么能弄明白呢?
I have ACER i7, Ubuntu 11.10, please any one can help me?
我有 ACER i7,Ubuntu 11.10,请问有人可以帮助我吗?
Any help will be appreciated!
任何帮助将不胜感激!
Also running:
还运行:
sudo cat /proc/cpuinfo | grep flags
Gives:
给出:
flags : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clfl
ush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx rdtscp lm constant_tsc arch_perfm
on pebs bts xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl
vmx est tm2 ssse3 cx16 xtpr pdcm sse4_1 sse4_2 x2apic popcnt xsave avx lahf_lm
ida arat epb xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid
Actually i was trying to install gazebo-1.0.0-RC2-x86_64, and getting this error.
实际上我正在尝试安装gazebo-1.0.0-RC2-x86_64,并收到此错误。
/usr/lib/gcc/i686-linux-gnu/4.6.1/include/emmintrin.h:32:3: error: #error "SSE2
instruction set not enabled"
In file included from /home/bkhelifa/Downloads/software/gazebo-1.0.0-RC2-x86_64/
deps/opende/src/quickstep.cpp:39:0:
/usr/lib/gcc/i686-linux-gnu/4.6.1/include/xmmintrin.h:32:3: error: #error "SSE i
nstruction set not enabled"
/home/bkhelifa/Downloads/software/gazebo-1.0.0-RC2-x86_64/deps/opende/src/quicks
tep.cpp: In function ‘dReal dot6(dRealPtr, dRealPtr)':
/home/bkhelifa/Downloads/software/gazebo-1.0.0-RC2-x86_64/deps/opende/src/quicks
tep.cpp:537:3: error: ‘__m128d' was not declared in this scope
...
I already have this option in my cmakefile
我的 cmakefile 中已经有这个选项
if (SSE3_FOUND)
set (CMAKE_C_FLAGS_ALL "${CMAKE_C_FLAGS_ALL} -msse3")
endif()
if (SSSE3_FOUND)
set (CMAKE_C_FLAGS_ALL "${CMAKE_C_FLAGS_ALL} -mssse3")
endif()
if (SSE4_1_FOUND)
set (CMAKE_C_FLAGS_ALL "${CMAKE_C_FLAGS_ALL} -msse4.1")
endif()
if (SSE4_2_FOUND)
set (CMAKE_C_FLAGS_ALL "${CMAKE_C_FLAGS_ALL} -msse4.2")
endif()
回答by jbo5112
One of your header files checks to ensure that SSE is enabled. It appears that your if statements aren't working.
您的头文件之一会检查以确保启用了 SSE。看来您的 if 语句不起作用。
If you add -march=native
it should pick the best CPU arch and flags to compile for based on your processor, or you can explicitly use -march=corei7 -mavx -mpclmul
, which is useful for distcc
. Also, -mfpmath=sse/-mfpmath=387
will tell the compiler to generate SSE/x87 instructions for floating point math. Depending on your processor, either could be faster, but I think Intel processors are usually better at SSE.
如果你添加-march=native
它应该根据你的处理器选择最好的 CPU 架构和标志来编译,或者你可以明确地使用-march=corei7 -mavx -mpclmul
,这对distcc
. 此外,-mfpmath=sse/-mfpmath=387
将告诉编译器为浮点数学生成 SSE/x87 指令。根据您的处理器,两者都可能更快,但我认为英特尔处理器通常在 SSE 方面表现更好。
If you want to check what gcc is enabling using the native flag run gcc -march=native -Q --help=target -v
.
如果您想使用本机标志 run 检查 gcc 正在启用的内容gcc -march=native -Q --help=target -v
。
回答by TrueY
I got the same error and I think I've found the proper solution!
我遇到了同样的错误,我想我找到了正确的解决方案!
The problem is that you are included the emmintrin.h. I did the same. What is more if I defined SSE2, SSEand MMXbefore including this file I got the following message: warning: "SSE2" redefined [enabled by default]
问题是您包含在 emmintrin.h 中。我也这样做了。更重要的是,如果我在包含此文件之前定义了SSE2、SSE和MMX,我会收到以下消息:警告:“ SSE2”重新定义 [默认启用]
So I tried to investigate where SSE2is defined and/or used I found that this file is included by x86intrin.h. So include this file and according to the -msse* flags the proper *intrin.h files will be included automatically!
所以我试图调查SSE2在哪里定义和/或使用我发现这个文件包含在 x86intrin.h 中。所以包含这个文件,根据 -msse* 标志,正确的 *intrin.h 文件将被自动包含!
It works for me nicely (g++ 4.7.2-5).
它对我很有效(g++ 4.7.2-5)。
I hope I could help!
我希望我能帮上忙!
回答by Overloaded_Operator
I just built this on FreeBSD by adding this to the "Makefile" in /usr/ports/audio/soundtouch
:
我只是在 FreeBSD 上通过将它添加到“Makefile”中来构建它/usr/ports/audio/soundtouch
:
CC= gcc46
CXX= g++46
CPP= cpp46
CFLAGS+= -msse
I hope the rest of the "phonon-gstreamer" plugins compile with this.
我希望其余的“phonon-gstreamer”插件都能用这个编译。