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

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
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值