Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

//home/wanghao/anaconda/lib/libpng16.so.16:对‘inflateValidate@ZLIB_1.2.9’未定义的引用 #6139

Closed
Rythsman opened this issue Dec 29, 2017 · 18 comments

Comments

@Rythsman
Copy link

Issue summary

when i run "make test -j8", it shows:

//home/wanghao/anaconda/lib/libpng16.so.16:对‘inflateValidate@ZLIB_1.2.9’未定义的引用
collect2: error: ld returned 1 exit status
Makefile:615: recipe for target '.build_release/test/test_math_functions.testbin' failed
make: *** [.build_release/test/test_math_functions.testbin] Error 1
make: *** 正在等待未完成的任务....
//home/wanghao/anaconda/lib/libpng16.so.16:对‘inflateValidate@ZLIB_1.2.9’未定义的引用
collect2: error: ld returned 1 exit status
Makefile:615: recipe for target '.build_release/test/test_internal_thread.testbin' failed
make: *** [.build_release/test/test_internal_thread.testbin] Error 1
//home/wanghao/anaconda/lib/libpng16.so.16:对‘inflateValidate@ZLIB_1.2.9’未定义的引用
collect2: error: ld returned 1 exit status
Makefile:615: recipe for target '.build_release/test/test_softmax_with_loss_layer.testbin' failed
make: *** [.build_release/test/test_softmax_with_loss_layer.testbin] Error 1
//home/wanghao/anaconda/lib/libpng16.so.16:对‘inflateValidate@ZLIB_1.2.9’未定义的引用
collect2: error: ld returned 1 exit status
Makefile:615: recipe for target '.build_release/test/test_hinge_loss_layer.testbin' failed
make: *** [.build_release/test/test_hinge_loss_layer.testbin] Error 1
//home//home//wanghaowanghao//anacondaanaconda//liblib//libpng16.so.16��libpng16.so.16:对‘inflateValidate@ZLIB_1.2.9’未定义��对�℀嘼��inflateValidate�@�ZLIB_1.2.9
’未定义的引collect2: error: ld returned 1 exit status
用
collect2: error: ld returned 1 exit status
Makefile:615: recipe for target '.build_release/test/test_deconvolution_layer.testbin' failed
make: *** [.build_release/test/test_deconvolution_layer.testbin] Error 1
Makefile:615: recipe for target '.build_release/test/test_dummy_data_layer.testbin' failed
make: *** [.build_release/test/test_dummy_data_layer.testbin] Error 1
//home/wanghao/anaconda/lib/libpng16.so.16:对‘inflateValidate@ZLIB_1.2.9’未定义的引用
collect2: error: ld returned 1 exit status
Makefile:615: recipe for target '.build_release/test/test_gradient_based_solver.testbin' failed
make: *** [.build_release/test/test_gradient_based_solver.testbin] Error 1
//home/wanghao/anaconda/lib/libpng16.so.16:对‘inflateValidate@ZLIB_1.2.9’未定义的引用
collect2: error: ld returned 1 exit status
Makefile:603: recipe for target '.build_release/test/test_all.testbin' failed
make: *** [.build_release/test/test_all.testbin] Error 1

Steps to reproduce

this is my 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

# uncomment to disable IO dependencies and corresponding data layers
# USE_OPENCV := 0
# USE_LEVELDB := 0
# USE_LMDB := 0

# uncomment to allow MDB_NOLOCK when reading LMDB files (only if necessary)
#	You should not set this flag if you will be reading LMDBs with any
#	possibility of simultaneous read and write
# ALLOW_LMDB_NOLOCK := 1

# Uncomment if you're using OpenCV 3
# OPENCV_VERSION := 3

# 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 through *_61 lines for compatibility.
# For CUDA < 8.0, comment the *_60 and *_61 lines for compatibility.
# For CUDA >= 9.0, comment the *_20 and *_21 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_52,code=sm_52 \
		-gencode arch=compute_60,code=sm_60 \
		-gencode arch=compute_61,code=sm_61 \
		-gencode arch=compute_61,code=compute_61

# BLAS choice:
# atlas for ATLAS (default)
# mkl for MKL
# open for OpenBlas
BLAS := atlas
# Custom (MKL/ATLAS/OpenBLAS) include and lib directories.
# Leave commented to accept the defaults for your choice of BLAS
# (which should work)!
# BLAS_INCLUDE := /path/to/your/blas
# BLAS_LIB := /path/to/your/blas

# 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 := /usr/include/python2.7 \
#		 /usr/lib/python2.7/dist-packages/numpy/core/include
# Anaconda Python distribution is quite popular. Include path:
# Verify anaconda location, sometimes it's in root.
#  ANACONDA_HOME := $(HOME)/anaconda
#  PYTHON_INCLUDE := $(ANACONDA_HOME)/include \
#		 $(ANACONDA_HOME)/include/python3.6m \
#		 $(ANACONDA_HOME)/lib/python3.6/site-packages/numpy/core/include

# Uncomment to use Python 3 (default is Python 2)
  PYTHON_LIBRARIES := boost_python3 python3.5m
  PYTHON_INCLUDE := /usr/include/python3.5m \
                 /usr/lib/python3.5/dist-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 /usr/include/hdf5/serial /opt/Opencv2/include
LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib /usr/lib/x86_64-linux-gnu/hdf5/serial /opt/Opencv2/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

# NCCL acceleration switch (uncomment to build with NCCL)
# https://github.com/NVIDIA/nccl (last tested version: v1.2.3-1+cuda8.0)
# USE_NCCL := 1

# 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

# N.B. both build and distribute dirs are cleared on `make clean`
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 ?= @

The problem seems about python version,I trid to use caffe with python3.5 ,but I don't konw why it shows //home/anaconda/lib... and I have

#  ANACONDA_HOME := $(HOME)/anaconda
#  PYTHON_INCLUDE := $(ANACONDA_HOME)/include \
#		 $(ANACONDA_HOME)/include/python3.6m \
#		 $(ANACONDA_HOME)/lib/python3.6/site-packages/numpy/core/include

Your system configuration

Operating system: ubuntu16.04 kylin
Compiler: gcc 5.4.0
CUDA version (if applicable): no
CUDNN version (if applicable):no
BLAS:atlas
Python or MATLAB version (for pycaffe and matcaffe respectively):python

@Noiredd
Copy link
Member

Noiredd commented Jan 12, 2018

This looks like a problem with linker being unable to find libpng library. Searching the internet yields for example this answer - have you tried anything like this?

I am closing this for now. If you need further assistance, please post to the caffe-users list instead. This helps developers maintain a clear, uncluttered, and efficient view of the state of Caffe. Please read the guidelines for contributing before submitting an issue or a pull request.

@Noiredd Noiredd closed this as completed Jan 12, 2018
@minhthong494
Copy link

minhthong494 commented Jan 12, 2018

I have a same problem.  Can anyone help? I tried Noiredd solution but it didn't work

//home/thong/anaconda3/lib/libpng16.so.16: undefined reference to `inflateValidate@ZLIB_1.2.9'
collect2: error: ld returned 1 exit status
Makefile:627: recipe for target '.build_release/tools/extract_features.bin' failed
make: *** [.build_release/tools/extract_features.bin] Error 1
make: *** Waiting for unfinished jobs....
//home/thong/anaconda3/lib/libpng16.so.16: undefined reference to `inflateValidate@ZLIB_1.2.9'
collect2: error: ld returned 1 exit status
Makefile:627: recipe for target '.build_release/tools/compute_image_mean.bin' failed
make: *** [.build_release/tools/compute_image_mean.bin] Error 1
//home/thong/anaconda3/lib/libpng16.so.16: undefined reference to `inflateValidate@ZLIB_1.2.9'
collect2: error: ld returned 1 exit status
Makefile:627: recipe for target '.build_release/tools/upgrade_net_proto_text.bin' failed
make: *** [.build_release/tools/upgrade_net_proto_text.bin] Error 1
//home/thong/anaconda3/lib/libpng16.so.16: undefined reference to `inflateValidate@ZLIB_1.2.9'
collect2: error: ld returned 1 exit status
Makefile:627: recipe for target '.build_release/tools/upgrade_net_proto_binary.bin' failed
make: *** [.build_release/tools/upgrade_net_proto_binary.bin] Error 1

@minhthong494
Copy link

minhthong494 commented Jan 13, 2018

I solved my issue by remove zlib
sudo apt autoremove zlib1g-dev
Then I installed again without error

@hogwild
Copy link

hogwild commented Feb 24, 2018

I solved the same problem by adding the following into the Makefile.config:
LINKFLAGS := -Wl,-rpath,$(HOME)/anaconda3/lib

@dingjiangang
Copy link

/home/dingjiangang/projects/joinMap/build> make -j2
[ 50%] Linking CXX executable joinMap
//home/dingjiangang/anaconda3/lib/libpng16.so.16: undefined reference to `inflateValidate@ZLIB_1.2.9'
collect2: error: ld returned 1 exit status
CMakeFiles/joinMap.dir/build.make:361: recipe for target 'joinMap' failed
make[2]: *** [joinMap] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/joinMap.dir/all' failed
make[1]: *** [CMakeFiles/joinMap.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
*** Failure: Exit code 2 ***

how to solve it ,thank you

@guanxiongsun
Copy link

I think it's something wrong with the ZLIB library. On Ubuntu 16.04, ZLIB's version is 1.2.8 by default.
So I download the source code of ZLIB, the verion is 1.2.11(1.2.9 is also okay).
Than I compile and install it on my machine with the following commands:
cd path/to/zlib
./configure
make
make install
Than I re-compiled caffe. It works~

@Omegastick
Copy link

@sunguanxiong You are a lifesaver

@zhangxiaoya
Copy link

From ZLIB download last version zlib and install.

@LongruiDong
Copy link

I solved the same problem by adding the following into the Makefile.config:
LINKFLAGS := -Wl,-rpath,$(HOME)/anaconda3/lib

it works for me,thanks~

@GongCheng1919
Copy link

I solved the same problem by adding the following into the Makefile.config:
LINKFLAGS := -Wl,-rpath,$(HOME)/anaconda3/lib

It is work for me, thank you!

@doantientai
Copy link

I solved the same problem by adding the following into the Makefile.config:
LINKFLAGS := -Wl,-rpath,$(HOME)/anaconda3/lib

It worked for me too.

@terasakisatoshi
Copy link

This works for me.

git clone https://github.com/madler/zlib
cd path/to/zlib
./configure
make
make install # you may add 'sudo'

@notabigfish
Copy link

I think it's something wrong with the ZLIB library. On Ubuntu 16.04, ZLIB's version is 1.2.8 by default.
So I download the source code of ZLIB, the verion is 1.2.11(1.2.9 is also okay).
Than I compile and install it on my machine with the following commands:
cd path/to/zlib
./configure
make
make install
Than I re-compiled caffe. It works~

This worked for me! Thank you!

@ejuoy
Copy link

ejuoy commented Jun 25, 2019

This works for me.

git clone https://github.com/madler/zlib
cd path/to/zlib
./configure
make
make install # you may add 'sudo'

good ,thank you

@NescobarAlopLop
Copy link

Had the same problem, removed the package from conda: conda remove libpng and installed sudo apt-get install libpng16-16
Worked for me

@renfeier
Copy link

I solved the same problem by adding the following into the Makefile.config:
LINKFLAGS := -Wl,-rpath,$(HOME)/anaconda3/lib

works for me !

@allen7270
Copy link

This works for me.

git clone https://github.com/madler/zlib
cd path/to/zlib
./configure
make
make install # you may add 'sudo'

It's work for me! thank you!

@kittimzhe
Copy link

I solved the same problem by adding the following into the Makefile.config:
LINKFLAGS := -Wl,-rpath,$(HOME)/anaconda3/lib

works for me !

where are the makefile.config?
when I use "locate Makefile.config", it turns to:
/opt/Qt5.9.0/5.9/Src/qtwebengine/src/3rdparty/chromium/third_party/swiftshader/third_party/LLVM/Makefile.config.in
/usr/src/linux-headers-4.15.0-117/tools/perf/Makefile.config
/usr/src/linux-headers-4.15.0-117/tools/power/acpi/Makefile.config
/usr/src/linux-headers-4.15.0-29/tools/perf/Makefile.config
/usr/src/linux-headers-4.15.0-29/tools/power/acpi/Makefile.config

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests