sse2 指令集未启用
CC=g++
CFLAGS=-O3 -c -Wall
DFLAGS=-g -Wall
LDFLAGS= -lz -lm -lpthread
KSWSOURCE=ksw.c
ALGNSOURCES=main.cpp aligner.cpp graph.cpp readfl.cpp hash.cpp form.cpp btree.cpp conLSH.cpp
INDSOURCES=whash.cpp genhash.cpp formh.cpp conLSH.cpp
INDOBJECTS=$(INDSOURCES:.cpp=.o) $(KSWSOURCE:.c=.o)
ALGNOBJECTS=$(ALGNSOURCES:.cpp=.o) $(KSWSOURCE:.c=.o)
INDEXER=conLSH-indexer
ALIGNER=conLSH-aligner
all: $(INDSOURCES) $(ALGNSOURCES) $(KSWSOURCE) $(ALIGNER) $(INDEXER)
$(ALIGNER): $(ALGNOBJECTS)
$(CC) $(ALGNOBJECTS) -o $@ $(LDFLAGS)
$(INDEXER): $(INDOBJECTS)
$(CC) $(INDOBJECTS) readfl.o -o $@ $(LDFLAGS)
debug:
$(CC) $(DFLAGS) $(ALGNSOURCES) $(KSWSOURCE) $(LDFLAGS)
.cpp.o:
$(CC) $(CFLAGS) $< -o $@
.c.o:
$(CC) $(CFLAGS) $< -o $@
clean:
rm -rf *.o $(ALIGNER) $(INDEXER) a.out
我有上面的makefile,但出现错误
I have the above makefile but I am getting an error
/usr/lib/gcc/i686-linux-gnu/4.8/include/emmintrin.h:31:3: error: #error "SSE2 instruction set not enabled"
# error "SSE2 instruction set not enabled"
据我了解和搜索,这是并行计算的标志.
From what I understand and googled this is a flag for parallel computation.
我尝试从其他具有相同问题的帖子中包含:
I tried from other posts with the same problem to either include:
CXXFLAGS=-03 -c Wall -mfpmath=sse
或:
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse -msse2 -msse3")
但没有任何成功.你能帮忙吗?
but without any success. Can you help?
我不确定是否需要 CXX 标志,因为在 ksw 中显示了很多(可能)级联错误,
I am not sure a CXX flags is necessary because a lot of (probably) cascading errors are shown in ksw like,
ksw.c:49:2: error: ‘__m128i’ does not name a type
__m128i *qp, *H0, *H1, *E, *Hmax;
-msse2
是特定选项,因此将其传递给 GCC 将起作用,如果您将构建脚本设置为实际执行那.https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html#x86-Options
-msse2
is the specific option, so passing that to GCC will work, if you get your build scripts set up to actually do that. https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html#x86-Options
或者更好的是,使用 -march=native
来启用您的 CPU 所拥有的一切,如果您是为本地使用而构建的,而不是用于分发可能必须在旧但-不古老的CPU.(当然,如果你关心性能,为 32 位模式构建是很奇怪的.SSE2 是 x86-64 的基线.除非你的 CPU 太旧而无法支持 SSE2,例如奔腾 III.或者例如,有没有 SSE 的嵌入式 x86 CPU,例如 AMD Geode.在这种情况下,构建了一个二进制文件(成功)使用 -msse2
可能会在这样的 CPU 上因非法指令而崩溃.)
Or better, use -march=native
to enable everything your CPU has, if you're building for local use, not for distributing a binary that might have to work on an old-but-not-ancient CPU. (Of course, if you care about performance, it's weird to be building for 32-bit mode. SSE2 is baseline for x86-64. Unless your CPU is too old to support SSE2, e.g. a Pentium III. Or for example, there are embedded x86 CPUs without SSE, like AMD Geode. In that case, a binary built (successfully) with -msse2
will probably crash with an illegal instruction on such a CPU.)
-mfpmath=sse
只是告诉 GCC 使用 SSE 进行标量 FP 数学,假设 SSE 可用;与告诉 GCC 假设目标 CPU 确实支持 SSE2 无关.将它也用于提高性能可能会很好,但在编译代码方面并不重要.
-mfpmath=sse
just tells GCC to use SSE for scalar FP math assuming that SSE is available; unrelated to telling GCC to assume the target CPU does support SSE2. It can be good to use it as well for performance, but it's not going to matter in getting your code to compile.
是的,像 __m128i
这样的 SSE1/2 内部类型只会在启用 SSE 时定义,所以 error: '__m128i' does not name a type
标记 -msse
未启用
And yes, SSE1/2 intrinsic types like __m128i
will only get defined when SSE is enabled, so error: ‘__m128i’ does not name a type
is a clear sign that -msse
wasn't enabled