/cs/software/anaconda3/compiler_compat/ld: cannot find -lm cannot find -lpthread cannot find -lc

老子叫甜甜 提交于 2020-01-07 04:00:57

问题


How should I fix this error in CentOS 7?

[jalal@goku HW4]$ git clone https://github.com/pathak22/pyflow.git
Cloning into 'pyflow'...
remote: Counting objects: 96, done.
remote: Total 96 (delta 0), reused 0 (delta 0), pack-reused 96
Unpacking objects: 100% (96/96), done.
[jalal@goku HW4]$ ls
pyflow
[jalal@goku HW4]$ cd pyflow/
[jalal@goku pyflow]$ ls
LICENSE  README.md  demo.py  examples  pyflow.pyx  setup.py  src
[jalal@goku pyflow]$ python demo.py 
Traceback (most recent call last):
  File "demo.py", line 11, in <module>
    import pyflow
ImportError: No module named 'pyflow'
[jalal@goku pyflow]$ python setup.py build_ext -i
Compiling pyflow.pyx because it changed.
[1/1] Cythonizing pyflow.pyx
running build_ext
building 'pyflow' extension
creating build
creating build/temp.linux-x86_64-3.5
creating build/temp.linux-x86_64-3.5/src
gcc -pthread -B /cs/software/anaconda3/compiler_compat -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/local/anaconda3/lib/python3.5/site-packages/numpy/core/include -I/usr/local/anaconda3/lib/python3.5/site-packages/numpy/core/include -I/usr/local/anaconda3/include/python3.5m -c pyflow.cpp -o build/temp.linux-x86_64-3.5/pyflow.o
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
In file included from /usr/local/anaconda3/lib/python3.5/site-packages/numpy/core/include/numpy/ndarraytypes.h:1809:0,
                 from /usr/local/anaconda3/lib/python3.5/site-packages/numpy/core/include/numpy/ndarrayobject.h:18,
                 from /usr/local/anaconda3/lib/python3.5/site-packages/numpy/core/include/numpy/arrayobject.h:4,
                 from pyflow.cpp:564:
/usr/local/anaconda3/lib/python3.5/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
 #warning "Using deprecated NumPy API, disable it by " \
  ^
gcc -pthread -B /cs/software/anaconda3/compiler_compat -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/local/anaconda3/lib/python3.5/site-packages/numpy/core/include -I/usr/local/anaconda3/lib/python3.5/site-packages/numpy/core/include -I/usr/local/anaconda3/include/python3.5m -c src/Coarse2FineFlowWrapper.cpp -o build/temp.linux-x86_64-3.5/src/Coarse2FineFlowWrapper.o
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
gcc -pthread -B /cs/software/anaconda3/compiler_compat -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/local/anaconda3/lib/python3.5/site-packages/numpy/core/include -I/usr/local/anaconda3/lib/python3.5/site-packages/numpy/core/include -I/usr/local/anaconda3/include/python3.5m -c src/GaussianPyramid.cpp -o build/temp.linux-x86_64-3.5/src/GaussianPyramid.o
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
In file included from src/Image.h:9:0,
                 from src/GaussianPyramid.h:7,
                 from src/GaussianPyramid.cpp:4:
src/ImageProcessing.h: In instantiation of ‘static void ImageProcessing::vfiltering(const T1*, T2*, int, int, int, const double*, int) [with T1 = double; T2 = double]’:
src/Image.h:1331:96:   required from ‘void Image<T>::imfilter_hv(Image<T1>&, const double*, int, const double*, int) const [with T1 = double; T = double]’
src/Image.h:1199:47:   required from ‘void Image<T>::GaussianSmoothing(Image<T1>&, double, int) const [with T1 = double; T = double]’
src/GaussianPyramid.cpp:67:45:   required from here
src/ImageProcessing.h:344:14: warning: unused variable ‘offset’ [-Wunused-variable]
  int i,j,l,k,offset,ii;
              ^
gcc -pthread -B /cs/software/anaconda3/compiler_compat -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/local/anaconda3/lib/python3.5/site-packages/numpy/core/include -I/usr/local/anaconda3/lib/python3.5/site-packages/numpy/core/include -I/usr/local/anaconda3/include/python3.5m -c src/OpticalFlow.cpp -o build/temp.linux-x86_64-3.5/src/OpticalFlow.o
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
src/OpticalFlow.cpp: In static member function ‘static void OpticalFlow::SmoothFlowSOR(const DImage&, const DImage&, DImage&, DImage&, DImage&, double, int, int, int)’:
src/OpticalFlow.cpp:267:11: warning: unused variable ‘power_alpha’ [-Wunused-variable]
    double power_alpha = 0.5;
           ^
src/OpticalFlow.cpp:287:11: warning: unused variable ‘_a’ [-Wunused-variable]
    double _a  = 10000, _b = 0.1;
           ^
src/OpticalFlow.cpp:287:24: warning: unused variable ‘_b’ [-Wunused-variable]
    double _a  = 10000, _b = 0.1;
                        ^
src/OpticalFlow.cpp: In static member function ‘static void OpticalFlow::SmoothFlowPDE(const DImage&, const DImage&, DImage&, DImage&, DImage&, double, int, int, int)’:
src/OpticalFlow.cpp:545:11: warning: unused variable ‘power_alpha’ [-Wunused-variable]
    double power_alpha = 0.5;
           ^
src/OpticalFlow.cpp:565:11: warning: unused variable ‘_a’ [-Wunused-variable]
    double _a  = 10000, _b = 0.1;
           ^
src/OpticalFlow.cpp:565:24: warning: unused variable ‘_b’ [-Wunused-variable]
    double _a  = 10000, _b = 0.1;
                        ^
In file included from src/Image.h:9:0,
                 from src/OpticalFlow.h:6,
                 from src/OpticalFlow.cpp:4:
src/ImageProcessing.h: In instantiation of ‘static void ImageProcessing::vfiltering(const T1*, T2*, int, int, int, const double*, int) [with T1 = double; T2 = double]’:
src/Image.h:1331:96:   required from ‘void Image<T>::imfilter_hv(Image<T1>&, const double*, int, const double*, int) const [with T1 = double; T = double]’
src/OpticalFlow.cpp:52:42:   required from here
src/ImageProcessing.h:344:14: warning: unused variable ‘offset’ [-Wunused-variable]
  int i,j,l,k,offset,ii;
              ^
In file included from src/OpticalFlow.h:6:0,
                 from src/OpticalFlow.cpp:4:
src/Image.h: In instantiation of ‘void Image<T>::warpImageBicubicRef(const Image<T>&, Image<T>&, const Image<T1>&, const Image<T1>&, const Image<T1>&, const Image<T2>&, const Image<T2>&) const [with T1 = double; T2 = double; T = double]’:
src/Image.h:2482:55:   required from ‘void Image<T>::warpImageBicubicRef(const Image<T>&, Image<T>&, const Image<T1>&, const Image<T1>&) const [with T1 = double; T = double]’
src/OpticalFlow.cpp:437:43:   required from here
src/Image.h:2525:4: warning: variable ‘ImgMax’ set but not used [-Wunused-but-set-variable]
  T ImgMax;
    ^
gcc -pthread -B /cs/software/anaconda3/compiler_compat -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/local/anaconda3/lib/python3.5/site-packages/numpy/core/include -I/usr/local/anaconda3/lib/python3.5/site-packages/numpy/core/include -I/usr/local/anaconda3/include/python3.5m -c src/Stochastic.cpp -o build/temp.linux-x86_64-3.5/src/Stochastic.o
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
g++ -pthread -shared -L/cs/software/anaconda3/lib -B /cs/software/anaconda3/compiler_compat -Wl,-rpath=/cs/software/anaconda3/lib,--no-as-needed build/temp.linux-x86_64-3.5/pyflow.o build/temp.linux-x86_64-3.5/src/Coarse2FineFlowWrapper.o build/temp.linux-x86_64-3.5/src/GaussianPyramid.o build/temp.linux-x86_64-3.5/src/OpticalFlow.o build/temp.linux-x86_64-3.5/src/Stochastic.o -L/cs/software/anaconda3/lib -lpython3.5m -o /home/grad3/jalal/CS585/HW4/pyflow/pyflow.cpython-35m-x86_64-linux-gnu.so
/cs/software/anaconda3/compiler_compat/ld: cannot find -lm
/cs/software/anaconda3/compiler_compat/ld: cannot find -lpthread
/cs/software/anaconda3/compiler_compat/ld: cannot find -lc
collect2: error: ld returned 1 exit status
error: command 'g++' failed with exit status 1
[jalal@goku pyflow]$ uname -a
Linux goku.bu.edu 3.10.0-693.5.2.el7.x86_64 #1 SMP Fri Oct 20 20:32:50 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

[jalal@goku pyflow]$ lsb_release -a
LSB Version:    :core-4.1-amd64:core-4.1-noarch
Distributor ID: CentOS
Description:    CentOS Linux release 7.4.1708 (Core) 
Release:    7.4.1708
Codename:   Core

回答1:


You need to install a library. I can't test right now, but running the following command in a terminal should solve the "cannot find -lm /-lc /-lpthread" error:

 sudo yum install glibc-static  


来源:https://stackoverflow.com/questions/46980152/cs-software-anaconda3-compiler-compat-ld-cannot-find-lm-cannot-find-lpthread

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!