Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/fortran/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ubuntu 编译caffe时发生ld错误:未找到libpng和libgfortran,共享库_Ubuntu_G++_Shared Libraries_Ld_Caffe - Fatal编程技术网

Ubuntu 编译caffe时发生ld错误:未找到libpng和libgfortran,共享库

Ubuntu 编译caffe时发生ld错误:未找到libpng和libgfortran,共享库,ubuntu,g++,shared-libraries,ld,caffe,Ubuntu,G++,Shared Libraries,Ld,Caffe,我正试图在Ubuntu14.04LTS上用Anaconda、纯CPU模式和OpenBLAS编译caffe。不幸的是,我得到一个ld错误 我按照说明添加了Anaconda没有的依赖项,并相应地调整了Makefile.config,特别是包括Anaconda路径。 当我执行makeall时,我得到了您在下面看到的错误(我还包括Makefile.config),尽管未找到的两个文件作为共享库存在于anaconda/lib文件夹及其各自的pkgs文件夹中 非常感谢你的帮助 终端: CXX/LD -o .

我正试图在Ubuntu14.04LTS上用Anaconda、纯CPU模式和OpenBLAS编译caffe。不幸的是,我得到一个ld错误

我按照说明添加了Anaconda没有的依赖项,并相应地调整了Makefile.config,特别是包括Anaconda路径。 当我执行
makeall
时,我得到了您在下面看到的错误(我还包括Makefile.config),尽管未找到的两个文件作为共享库存在于anaconda/lib文件夹及其各自的pkgs文件夹中

非常感谢你的帮助

终端:

CXX/LD -o .build_release/tools/extract_features.bin
/usr/bin/ld: warning: libpng15.so.15, needed by /home/mclab/anaconda/lib/libopencv_highgui.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libgfortran.so.1, needed by /home/mclab/anaconda/lib/libopenblas.so, not found (try using -rpath or -rpath-link)
/home/mclab/anaconda/lib/libopencv_highgui.so: undefined reference to `png_set_strip_alpha@PNG15_0'
/home/mclab/anaconda/lib/libopencv_highgui.so: undefined reference to `png_get_io_ptr@PNG15_0'
/home/mclab/anaconda/lib/libopenblas.so: undefined reference to `_gfortran_pow_i4_i4'
/home/mclab/anaconda/lib/libopencv_highgui.so: undefined reference to `png_set_palette_to_rgb@PNG15_0'
/home/mclab/anaconda/lib/libopencv_highgui.so: undefined reference to `png_set_swap@PNG15_0'
/home/mclab/anaconda/lib/libopencv_highgui.so: undefined reference to `png_write_end@PNG15_0'
/home/mclab/anaconda/lib/libopencv_highgui.so: undefined reference to `png_set_compression_level@PNG15_0'
/home/mclab/anaconda/lib/libopencv_highgui.so: undefined reference to `png_write_image@PNG15_0'
/home/mclab/anaconda/lib/libopencv_highgui.so: undefined reference to `png_destroy_read_struct@PNG15_0'
/home/mclab/anaconda/lib/libopencv_highgui.so: undefined reference to `png_write_info@PNG15_0'
/home/mclab/anaconda/lib/libopencv_highgui.so: undefined reference to `png_set_gray_to_rgb@PNG15_0'
/home/mclab/anaconda/lib/libopencv_highgui.so: undefined reference to `png_destroy_write_struct@PNG15_0'
/home/mclab/anaconda/lib/libopencv_highgui.so: undefined reference to `png_get_IHDR@PNG15_0'
/home/mclab/anaconda/lib/libopencv_highgui.so: undefined reference to `png_read_update_info@PNG15_0'
/home/mclab/anaconda/lib/libopencv_highgui.so: undefined reference to `png_set_compression_strategy@PNG15_0'
/home/mclab/anaconda/lib/libopencv_highgui.so: undefined reference to `png_create_read_struct@PNG15_0'
/home/mclab/anaconda/lib/libopencv_highgui.so: undefined reference to `png_read_info@PNG15_0'
/home/mclab/anaconda/lib/libopencv_highgui.so: undefined reference to `png_set_longjmp_fn@PNG15_0'
/home/mclab/anaconda/lib/libopencv_highgui.so: undefined reference to `png_read_image@PNG15_0'
/home/mclab/anaconda/lib/libopenblas.so: undefined reference to `_gfortran_compare_string'
/home/mclab/anaconda/lib/libopencv_highgui.so: undefined reference to `png_create_write_struct@PNG15_0'
/home/mclab/anaconda/lib/libopencv_highgui.so: undefined reference to `png_set_bgr@PNG15_0'
/home/mclab/anaconda/lib/libopencv_highgui.so: undefined reference to `png_create_info_struct@PNG15_0'
/home/mclab/anaconda/lib/libopencv_highgui.so: undefined reference to `png_set_write_fn@PNG15_0'
/home/mclab/anaconda/lib/libopencv_highgui.so: undefined reference to `png_init_io@PNG15_0'
/home/mclab/anaconda/lib/libopencv_highgui.so: undefined reference to `png_set_packing@PNG15_0'
/home/mclab/anaconda/lib/libopenblas.so: undefined reference to `_gfortran_pow_r8_i4'
/home/mclab/anaconda/lib/libopenblas.so: undefined reference to `_gfortran_concat_string'
/home/mclab/anaconda/lib/libopenblas.so: undefined reference to `_gfortran_pow_r4_i4'
/home/mclab/anaconda/lib/libopenblas.so: undefined reference to `_gfortran_etime'
/home/mclab/anaconda/lib/libopencv_highgui.so: undefined reference to `png_error@PNG15_0'
/home/mclab/anaconda/lib/libopenblas.so: undefined reference to `_gfortran_copy_string'
/home/mclab/anaconda/lib/libopencv_highgui.so: undefined reference to `png_set_strip_16@PNG15_0'
/home/mclab/anaconda/lib/libopencv_highgui.so: undefined reference to `png_read_end@PNG15_0'
/home/mclab/anaconda/lib/libopencv_highgui.so: undefined reference to `png_set_IHDR@PNG15_0'
/home/mclab/anaconda/lib/libopencv_highgui.so: undefined reference to `png_set_read_fn@PNG15_0'
/home/mclab/anaconda/lib/libopencv_highgui.so: undefined reference to `png_set_expand_gray_1_2_4_to_8@PNG15_0'
/home/mclab/anaconda/lib/libopencv_highgui.so: undefined reference to `png_set_rgb_to_gray@PNG15_0'
/home/mclab/anaconda/lib/libopencv_highgui.so: undefined reference to `png_set_filter@PNG15_0'
collect2: error: ld returned 1 exit status
make: *** [.build_release/tools/extract_features.bin] Error 1
Makefile.config:

## Refer to http://caffe.berkeleyvision.org/installation.html
# Contributions simplifying and improving our build system are welcome!

# cuDNN acceleration switch (uncomment to build with cuDNN).
# USE_CUDNN := 1

# CPU-only switch (uncomment to build without GPU support).
 CPU_ONLY := 1

# To customize your choice of compiler, uncomment and set the following.
# N.B. the default for Linux is g++ and the default for OSX is clang++
 CUSTOM_CXX := g++

# CUDA directory contains bin/ and lib/ directories that we need.
CUDA_DIR := /usr/local/cuda
# On Ubuntu 14.04, if cuda tools are installed via
# "sudo apt-get install nvidia-cuda-toolkit" then use this instead:
# CUDA_DIR := /usr

# CUDA architecture setting: going with all of them.
# For CUDA < 6.0, comment the *_50 lines for compatibility.
CUDA_ARCH := -gencode arch=compute_20,code=sm_20 \
        -gencode arch=compute_20,code=sm_21 \
        -gencode arch=compute_30,code=sm_30 \
        -gencode arch=compute_35,code=sm_35 \
        -gencode arch=compute_50,code=sm_50 \
        -gencode arch=compute_50,code=compute_50

# BLAS choice:
# atlas for ATLAS (default)
# mkl for MKL
# open for OpenBlas
BLAS := open
# Custom (MKL/ATLAS/OpenBLAS) include and lib directories.
# Leave commented to accept the defaults for your choice of BLAS
# (which should work)!
 BLAS_INCLUDE := /home/mclab/anaconda/pkgs/openblas-0.2.14-1/include
 BLAS_LIB := /home/mclab/anaconda/pkgs/openblas-0.2.14-1/lib

# Homebrew puts openblas in a directory that is not on the standard search path
# BLAS_INCLUDE := $(shell brew --prefix openblas)/include
# BLAS_LIB := $(shell brew --prefix openblas)/lib

# This is required only if you will compile the matlab interface.
# MATLAB directory should contain the mex binary in /bin.
# MATLAB_DIR := /usr/local
# MATLAB_DIR := /Applications/MATLAB_R2012b.app

# NOTE: this is required only if you will compile the python interface.
# We need to be able to find Python.h and numpy/arrayobject.h.
PYTHON_INCLUDE := /home/mclab/anaconda/include/python2.7 \
        /home/mclab/anaconda/lib/python2.7/site-packages/numpy/core/include
# Anaconda Python distribution is quite popular. Include path:
# Verify anaconda location, sometimes it's in root.
# ORIGINAL:
 ANACONDA_HOME := $(HOME)/anaconda
 PYTHON_INCLUDE := $(ANACONDA_HOME)/include \
         $(ANACONDA_HOME)/include/python2.7 \
         $(ANACONDA_HOME)/lib/python2.7/site-packages/numpy/core/include \
# MODIFIED
# ANACONDA_HOME := /home/mclab/anaconda
# PYTHON_INCLUDE := /home/mclab/anaconda/include \
#        /home/mclab/anaconda/include/python2.7 \
#        /home/mclab/anaconda/lib/python2.7/site-packages/numpy/core/include \

# We need to be able to find libpythonX.X.so or .dylib.
# PYTHON_LIB := /usr/lib
 PYTHON_LIB := $(ANACONDA_HOME)/lib

# Homebrew installs numpy in a non standard path (keg only)
# PYTHON_INCLUDE += $(dir $(shell python -c 'import numpy.core; print(numpy.core.__file__)'))/include
# PYTHON_LIB += $(shell brew --prefix numpy)/lib

# Uncomment to support layers written in Python (will link against Python libs)
 WITH_PYTHON_LAYER := 1

# Whatever else you find you need goes here.
INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include
LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib

# If Homebrew is installed at a non standard location (for example your home directory) and you use it for general dependencies
# INCLUDE_DIRS += $(shell brew --prefix)/include
# LIBRARY_DIRS += $(shell brew --prefix)/lib

# Uncomment to use `pkg-config` to specify OpenCV library paths.
# (Usually not necessary -- OpenCV libraries are normally installed in one of the above $LIBRARY_DIRS.)
# USE_PKG_CONFIG := 1

BUILD_DIR := build
DISTRIBUTE_DIR := distribute

# Uncomment for debugging. Does not work on OSX due to https://github.com/BVLC/caffe/issues/171
# DEBUG := 1

# The ID of the GPU that 'make runtest' will use to run unit tests.
TEST_GPUID := 0

# enable pretty build (comment to see full commands)
Q ?= @
##请参阅http://caffe.berkeleyvision.org/installation.html
#欢迎为简化和改进我们的构建系统做出贡献!
#cuDNN加速开关(取消注释以使用cuDNN构建)。
#使用_CUDNN:=1
#仅CPU开关(取消注释以生成不支持GPU的版本)。
仅CPU_:=1
#要自定义编译器的选择,请取消注释并设置以下内容。
#注意:Linux的默认值是g++,OSX的默认值是clang++
自定义_CXX:=g++
#CUDA目录包含我们需要的bin/和lib/目录。
CUDA_DIR:=/usr/local/CUDA
#在Ubuntu 14.04上,如果cuda工具通过
#“sudo apt get install nvidia cuda toolkit”然后改用以下方法:
#CUDA_DIR:=/usr
#CUDA体系结构设置:与它们一起使用。
#对于CUDA<6.0,请注释*_50行以了解兼容性。
CUDA_ARCH:=-gencode ARCH=compute_20,code=sm_20\
-gencode arch=compute_20,code=sm_21\
-gencode arch=compute_30,code=sm_30\
-gencode arch=compute_35,code=sm_35\
-gencode arch=compute_50,code=sm_50\
-gencode arch=compute_50,code=compute_50
#BLAS选择:
#atlas for atlas(默认)
#mkl代表mkl
#开放给OpenBlas
BLAS:=打开
#自定义(MKL/ATLAS/OpenBLAS)include和lib目录。
#保留注释以接受您选择的BLAS的默认值
#(哪个应该有用)!
BLAS_INCLUDE:=/home/mclab/anaconda/pkgs/openblas-0.2.14-1/INCLUDE
BLAS_LIB:=/home/mclab/anaconda/pkgs/openblas-0.2.14-1/LIB
#Homebrew将openblas放在不在标准搜索路径上的目录中
#BLAS_INCLUDE:=$(shell brew——前缀openblas)/INCLUDE
#BLAS_LIB:=$(shell brew——前缀openblas)/LIB
#只有在编译matlab接口时,才需要这样做。
#MATLAB目录应包含/bin中的mex二进制文件。
#MATLAB_DIR:=/usr/local
#MATLAB_DIR:=/Applications/MATLAB_R2012b.app
#注意:只有在编译python接口时,才需要这样做。
#我们需要能够找到Python.h和numpy/arrayobject.h。
PYTHON_INCLUDE:=/home/mclab/anaconda/INCLUDE/python2.7\
/home/mclab/anaconda/lib/python2.7/site-packages/numpy/core/include
#Anaconda Python发行版非常流行。包含路径:
#验证蟒蛇的位置,有时它在根目录中。
#原件:
水蟒之家:=$(家)/水蟒
PYTHON_INCLUDE:=$(蟒蛇之家)/INCLUDE\
$(蟒蛇之家)/包括/蟒蛇2.7\
$(ANACONDA_HOME)/lib/python2.7/site-packages/numpy/core/include\
#修改
#蟒蛇之家:=/HOME/mclab/ANACONDA
#PYTHON_INCLUDE:=/home/mclab/anaconda/INCLUDE\
#/home/mclab/anaconda/include/python2.7\
#/home/mclab/anaconda/lib/python2.7/site-packages/numpy/core/include\
#我们需要能够找到libpythonX.X.so或.dylib。
#PYTHON_LIB:=/usr/LIB
PYTHON_LIB:=$(蟒蛇之家)/LIB
#Homebrew在非标准路径中安装numpy(仅适用于keg)
#PYTHON_INCLUDE+=$(dir$(shell PYTHON-c'import numpy.core;print(numpy.core.\uuuuu file_uu))/INCLUDE
#PYTHON_LIB+=$(shell brew——前缀numpy)/LIB
#取消注释以支持用Python编写的层(将链接到Python库)
有_PYTHON_层:=1
#你还需要的东西都放在这里。
INCLUDE_DIRS:=$(PYTHON_INCLUDE)/usr/local/INCLUDE
库目录:=$(PYTHON库)/usr/local/LIB/usr/LIB
#如果Homebrew安装在非标准位置(例如您的主目录),并且您将其用于一般依赖项
#INCLUDE_DIRS+=$(shell brew--前缀)/包括
#库\u DIRS+=$(shell brew--前缀)/lib
#取消注释以使用“pkg config”指定OpenCV库路径。
#(通常不需要——OpenCV库通常安装在上述$LIBRARY_目录之一中。)
#使用\u包装\u配置:=1
BUILD\u DIR:=构建
DISTRIBUTE_DIR:=分发
#取消调试的注释。由于以下原因,无法在OSX上工作:https://github.com/BVLC/caffe/issues/171
#调试:=1
#“make runtest”将用于运行单元测试的GPU的ID。
测试\GPUID:=0
#启用漂亮构建(注释以查看完整命令)
Q?=@

好吧,看来我自己能解决这个问题。不过,我不知道这是否是一个好的解决方案,所以我很感谢大家的评论:在/etc/ld.so.conf.d文件夹中,我创建了一个文件doublibrary.conf。此文件仅包含Anaconda的lib文件夹的完整路径。在
sudo ldconfig
之后,ld能够找到相关的包。完成后,我再次删除了该文件,但我怀疑问题是否最终得到解决。因此,我会很高兴得到评论或更好的解决方案。

好吧,看来我自己能够解决这个问题。不过,我不知道这是否是一个好的解决方案,所以我很感谢大家的评论:在/etc/ld.so.conf.d文件夹中,我创建了一个文件doublibrary.conf。此文件仅包含Anaconda的lib文件夹的完整路径。在
sudo ldconfig
之后,ld能够找到相关的包。完成后,我再次删除了该文件,但我怀疑问题是否最终得到解决。因此,我会很高兴得到评论或更好的解决方案