https://github.com/jmrf/EAST并没有说明需要make,注意在lanms文件夹下有一个makefile,需要进行make,生成adaptor.so。
如果这一步没有成功生成,一般会出现以下几个错误:
g++: error: unrecognized command line option ‘-fno-plt(这是因为makefile文件的参数要修改)
ImportError: Python version mismatch: module was compiled for version 3.5, while the interpreter is running version 3.8.(这是因为adaptor.so并不是用你所在的python环境下编译生成)
步骤:
- 在command输入
python3-config --cflags
; - 复制输出的第一个句子,如:
-I/home/Wu_group/anaconda3/include/python3.8
; - 将原来的makefile文件改为:
CXXFLAGS = -I include -std=c++11 -O3 -I/home/Wu_group/anaconda3/include/python3.8
LDFLAGS = $(shell python3-config --ldflags)
DEPS = lanms.h $(shell find include -xtype f)
CXX_SOURCES = adaptor.cpp include/clipper/clipper.cpp
LIB_SO = adaptor.so
$(LIB_SO): $(CXX_SOURCES) $(DEPS)
$(CXX) -o $@ $(CXXFLAGS) $(LDFLAGS) $(CXX_SOURCES) --shared -fPIC
clean:
rm -rf $(LIB_SO)
如果不行的话,可以将第2步改成复制整个输出。