makefile环境不匹配导致的编译错误g++: error: unrecognized command line option ‘ 您所在的位置:网站首页 unrcognized makefile环境不匹配导致的编译错误g++: error: unrecognized command line option ‘

makefile环境不匹配导致的编译错误g++: error: unrecognized command line option ‘

2024-07-09 13:14| 来源: 网络整理| 查看: 265

makefile:

CXXFLAGS = -I include -std=c++11 -O3 $(shell python3-config --cflags) LDFLAGS = $(shell python3-config --ldflags) DEPS = $(shell find include -xtype f) CXX_SOURCES = pse.cpp LIB_SO = pse.so $(LIB_SO): $(CXX_SOURCES) $(DEPS) $(CXX) -o $@ $(CXXFLAGS) $(LDFLAGS) $(CXX_SOURCES) --shared -fPIC clean: rm -rf $(LIB_SO)

报错:

g++ -o pse.so -I include -std=c++11 -O3 -I/home/GZKP/.conda/envs/py36/include/python3.6m -I/home/GZKP/.conda/envs/py36/include/python3.6m -Wno-unused-result -Wsign-compare -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O3 -ffunction-sections -pipe -isystem /home/GZKP/.conda/envs/py36/include -fdebug-prefix-map=/tmp/build/80754af9/python_1588903631989/work=/usr/local/src/conda/python-3.6.10 -fdebug-prefix-map=/home/GZKP/.conda/envs/py36=/usr/local/src/conda-prefix -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -flto -DNDEBUG -fwrapv -O3 -Wall -L/home/GZKP/.conda/envs/py36/lib/python3.6/config-3.6m-x86_64-linux-gnu -L/home/GZKP/.conda/envs/py36/lib -lpython3.6m -lpthread -ldl -lutil -lrt -lm -Xlinker -export-dynamic pse.cpp --shared -fPIC g++: error: unrecognized command line option ‘-fno-plt’ Makefile:10: recipe for target 'pse.so' failed make: *** [pse.so] Error 1

修改:

CXXFLAGS = -I include -std=c++11 -O3 -I/home/GZKP/.conda/envs/py36/include/python3.6m LDFLAGS = $(shell python3-config --ldflags) DEPS = $(shell find include -xtype f) CXX_SOURCES = pse.cpp LIB_SO = pse.so $(LIB_SO): $(CXX_SOURCES) $(DEPS) $(CXX) -o $@ $(CXXFLAGS) $(LDFLAGS) $(CXX_SOURCES) --shared -fPIC clean: rm -rf $(LIB_SO)

原因anaconda 自带的是python3.7的环境,而我们进入了虚拟环境,python3.6 , 所以要指定成对应的 python3.xm 就行 如果是虚拟环境路径为/home/GZKP/.conda/envs/py36/include/python3.6m ,不是的话直接在anaconda下找include即可。如果运行环境和make文件里写的编译目标不同会报错:

Traceback (most recent call last): File "/home/GZKP/.conda/envs/py36/lib/python3.6/site-packages/web/application.py", line 257, in process return self.handle() File "/home/GZKP/.conda/envs/py36/lib/python3.6/site-packages/web/application.py", line 248, in handle return self._delegate(fn, self.fvars, args) File "/home/GZKP/.conda/envs/py36/lib/python3.6/site-packages/web/application.py", line 488, in _delegate return handle_class(cls) File "/home/GZKP/.conda/envs/py36/lib/python3.6/site-packages/web/application.py", line 466, in handle_class return tocall(*args) File "/home/GZKP/chineseocr_lite-master/app.py", line 80, in POST result = text_predict(img) File "/home/GZKP/chineseocr_lite-master/model.py", line 163, in text_predict preds, boxes_list, rects_re, t = text_handle.predict(img, long_size=pse_long_size) File "/home/GZKP/chineseocr_lite-master/psenet/PSENET.py", line 120, in predict preds, boxes_list, rects = pse_decode(preds[0], self.scale) File "/home/GZKP/chineseocr_lite-master/psenet/pse/__init__.py", line 62, in decode pred, label_values = pse_warpper(preds, 5) File "/home/GZKP/chineseocr_lite-master/psenet/pse/__init__.py", line 20, in pse_warpper from .pse import pse_cpp ImportError: /home/GZKP/chineseocr_lite-master/psenet/pse/pse.so: undefined symbol: PyThread_tss_get


【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有