NVIDIA / caffe

Caffe: a fast open framework for deep learning.
http://caffe.berkeleyvision.org/
Other
672 stars 263 forks source link

make error: ld returned 1 exit status #480

Closed mislulu closed 6 years ago

mislulu commented 6 years ago

Hello, I have installed the nvcaffe.0.16.5 on my computer. It has appeared this error. I added LIBRARIES += boost_thread stdc++ boost_regex at the bottom of Makefile.config (https://github.com/NVIDIA/caffe/issues/471), but it still didn't work. Can any one help me solve this problem.

CXX tools/device_query.cpp CXX tools/extract_features.cpp CXX tools/finetune_net.cpp CXX tools/caffe.cpp CXX tools/upgrade_net_proto_text.cpp CXX examples/cifar10/convert_cifar_data.cpp CXX examples/mnist/convert_mnist_data.cpp CXX examples/siamese/convert_mnist_siamese_data.cpp CXX examples/cpp_classification/classification.cpp CXX .build_release/src/caffe/proto/caffe.pb.cc AR -o .build_release/lib/libcaffe-nv.a LD -o .build_release/lib/libcaffe-nv.so.0.16.5 /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libturbojpeg.a(libturbojpeg_la-turbojpeg.o): relocation R_X86_64_32 against `.data' can not be used when making a shared object; recompile with -fPIC /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libturbojpeg.a: error adding symbols: Bad value collect2: error: ld returned 1 exit status Makefile:605: recipe for target '.build_release/lib/libcaffe-nv.so.0.16.5' failed make: *** [.build_release/lib/libcaffe-nv.so.0.16.5] Error 1

drnikolaev commented 6 years ago

Hi @mislulu https://github.com/NVIDIA/caffe#useful-notes

mislulu commented 6 years ago

Thanks for your help. I have solved the problem mentioned above. But now I have faced a new issue. As I want caffe work with python. So I umcomment the WITH_PYTHON_LAYER := 1 change the python path PYTHON_INCLUDE := /usr/include/python2.7 \ /home/ga47kes/.local/lib/python2.7/site-packages/numpy/core/include pip install all the packages in the python/requirements.txt I have made pycaffe and it worked. But when I made pytest, it has shown such error:

====================================================================== ERROR: test_solver (unittest.loader.ModuleImportFailure)

ImportError: Failed to import test module: test_solver Traceback (most recent call last): File "/usr/lib/python2.7/unittest/loader.py", line 254, in _find_tests module = self._get_module_from_name(name) File "/usr/lib/python2.7/unittest/loader.py", line 232, in _get_module_from_name import(name) File "/home/ga47kes/nccl/caffe-0.16.5/python/caffe/test/test_solver.py", line 7, in import caffe File "caffe/init.py", line 1, in from .pycaffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, RMSPropSolver, \ File "caffe/pycaffe.py", line 15, in import caffe.io File "caffe/io.py", line 4, in from skimage.transform import resize File "/home/ga47kes/.local/lib/python2.7/site-packages/skimage/transform/init.py", line 1, in from .hough_transform import (hough_line, hough_line_peaks, File "/home/ga47kes/.local/lib/python2.7/site-packages/skimage/transform/hough_transform.py", line 4, in from ._hough_transform import (_hough_circle, ImportError: cannot import name _hough_circle


Ran 12 tests in 0.001s

FAILED (errors=12) Makefile:569: recipe for target 'pytest' failed make: *** [pytest] Error 1

What's the reason for this? What should I do to the caffe work with python ? Thanks for your kindness!

drnikolaev commented 6 years ago

hi @mislulu please install all of these: https://github.com/NVIDIA/caffe/blob/caffe-0.16/python/requirements.txt

mislulu commented 6 years ago

Thanks a lot. I used this requirement.txt, but something weird happened. I have got a such error:

====================================================================== ERROR: test_solver (unittest.loader.ModuleImportFailure)

ImportError: Failed to import test module: test_solver Traceback (most recent call last): File "/usr/lib/python2.7/unittest/loader.py", line 254, in _find_tests module = self._get_module_from_name(name) File "/usr/lib/python2.7/unittest/loader.py", line 232, in _get_module_from_name import(name) File "/home/ga47kes/nccl/caffe-0.16.5/python/caffe/test/test_solver.py", line 7, in import caffe File "caffe/init.py", line 1, in from .pycaffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, RMSPropSolver, \ File "caffe/pycaffe.py", line 15, in import caffe.io File "caffe/io.py", line 2, in import skimage.io File "/home/ga47kes/.local/lib/python2.7/site-packages/skimage/io/init.py", line 11, in from ._io import * File "/home/ga47kes/.local/lib/python2.7/site-packages/skimage/io/_io.py", line 7, in from ..color import rgb2grey File "/home/ga47kes/.local/lib/python2.7/site-packages/skimage/color/init.py", line 1, in from .colorconv import (convert_colorspace, File "/home/ga47kes/.local/lib/python2.7/site-packages/skimage/color/colorconv.py", line 59, in from scipy import linalg ImportError: No module named scipy


Ran 12 tests in 0.001s

FAILED (errors=12) Makefile:569: recipe for target 'pytest' failed make: *** [pytest] Error 1

I have already got this module. ga47kes@tueimmk-dan11:~/nccl/caffe-0.16.5$ pip install scipy Requirement already satisfied: scipy in /home/ga47kes/anaconda2/lib/python2.7/site-packages

Why this happened ? Thanks for your kindness!

drnikolaev commented 6 years ago

@mislulu your python environment seems to be broken. Try to reinstall scipy and use plain Ubuntu Python, not anaconda2.

mislulu commented 6 years ago

Thanks for your help ! I have reinstall the scipy and make pytest run correctly. But there was something weird happened again. Great sorry for bothering you again. When I use python, I couldn't import caffe. But if I changed to sudo python , it worked. Now I couldn't import caffe module to python normally. How could I solve this issue?

ga47kes@tueimmk-dan11:~/install/caffe-0.16.5/python$ python Python 2.7.12 (default, Dec 4 2017, 14:50:18) [GCC 5.4.0 20160609] on linux2 Type "help", "copyright", "credits" or "license" for more information.

import caffe WARNING: Logging before InitGoogleLogging() is written to STDERR F0223 10:07:39.996796 18166 common.cpp:464] Check failed: status == CUBLAS_STATUS_SUCCESS (1 vs. 0) CUBLAS_STATUS_NOT_INITIALIZED Check failure stack trace: Aborted (core dumped) ga47kes@tueimmk-dan11:~/install/caffe-0.16.5/python$ sudo python Python 2.7.12 (default, Dec 4 2017, 14:50:18) [GCC 5.4.0 20160609] on linux2 Type "help", "copyright", "credits" or "license" for more information. import caffe

drnikolaev commented 6 years ago

Sorry, I can't help here because it's not NVCaffe issue.