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

dlopen _caffe.so Symbol not found #4918

Closed
Sirius-zn opened this issue Oct 28, 2016 · 3 comments
Closed

dlopen _caffe.so Symbol not found #4918

Sirius-zn opened this issue Oct 28, 2016 · 3 comments

Comments

@Sirius-zn
Copy link

Hello,

So I am a new faster-rcnn user (https://github.com/rbgirshick/py-faster-rcnn) and I am trying to build caffe (the caffe included in the faster-rcnn) as CPU-only mode on my mac (10.11.6) . I am able to do make, make test, and make runtest by commenting out some GPU related code and modifying the Makefile.config file. However, when I open python and do import caffe I get the following error:

Python 2.7.9 |Anaconda custom (x86_64)| (default, Dec 15 2014, 10:37:34)
[GCC 4.2.1 (Apple Inc. build 5577)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://binstar.org

import caffe
Traceback (most recent call last):
File "", line 1, in
File "/Users/Sirius_zn/Desktop/C3PO/full_installation_python/py-faster-rcnn/caffe-fast-rcnn/python/caffe/init.py", line 1, in
from .pycaffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, RMSPropSolver, AdaDeltaSolver, AdamSolver
File "/Users/Sirius_zn/Desktop/C3PO/full_installation_python/py-faster-rcnn/caffe-fast-rcnn/python/caffe/pycaffe.py", line 13, in
from ._caffe import Net, SGDSolver, NesterovSolver, AdaGradSolver,
ImportError: dlopen(/Users/Sirius_zn/Desktop/C3PO/full_installation_python/py-faster-rcnn/caffe-fast-rcnn/python/caffe/_caffe.so, 2): Symbol not found: ___addtf3
Referenced from: /usr/local/opt/gcc/lib/gcc/6/libquadmath.0.dylib
Expected in: /usr/local/lib/libgcc_s.1.dylib
in /usr/local/opt/gcc/lib/gcc/6/libquadmath.0.dylib

I have double checked that I have _caffe.so in the path mentioned above.

Sirius_zn (master *) tools $ ls /Users/Sirius_zn/Desktop/C3PO/full_installation_python/py-faster-rcnn/tools/../caffe-fast-rcnn/python/caffe/
init.py caffe.so draw.py net_spec.py pycaffe.pyc
_init.pyc classifier.py imagenet proto test
_caffe.cpp detector.py io.py pycaffe.py

And I have been googling around for a while, and could not bypass this error. I tried setting PYTHONPATH but the problem is sill there.

Sirius_zn (master *) tools $ echo $PYTHONPATH
/Users/Sirius_zn/Desktop/C3PO/full_installation_python/py-faster-rcnn/caffe-fast-rcnn/python/

Also I have seen some threads about mac's System Integrity Protection might be causing my problem but I am not sure here.

Can anyone help?

Thanks!!

@marcociccone
Copy link

I have the same problem, anyone can help?

@jxr041100
Copy link

I have the same problem, who can help?

ImportError: Failed to import test module: test_solver
Traceback (most recent call last):
File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/loader.py", line 254, in _find_tests
module = self._get_module_from_name(name)
File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/loader.py", line 232, in _get_module_from_name
import(name)
File "/Users/jianfengren/tools/caffe/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, AdaDeltaSolver, AdamSolver
File "caffe/pycaffe.py", line 13, in
from ._caffe import Net, SGDSolver, NesterovSolver, AdaGradSolver,
ImportError: dlopen(caffe/_caffe.so, 2): Symbol not found: ___addtf3
Referenced from: /usr/local/opt/gcc/lib/gcc/6/libquadmath.0.dylib
Expected in: /usr/lib/libSystem.B.dylib
in /usr/local/opt/gcc/lib/gcc/6/libquadmath.0.dylib

@khambsimp
Copy link

Hi so I think the solution is to reinstall your gcc library using Homebrew and to make sure it is linked to your system gcc. In order to do so Homebrew gives the instructions for pasting in terminal:
brew install gcc

which since I had gcc already installed then have the response
Warning: gcc 7.1.0 is already installed, it's just not linked.
You can use brew link gcc to link this version.
Khambrels-Air:~ khambrelsimpson$ brew link gcc
Linking /usr/local/Cellar/gcc/7.1.0...
Error: Could not symlink bin/gfortran
Target /usr/local/bin/gfortran
already exists. You may want to remove it:
rm '/usr/local/bin/gfortran'

To force the link and overwrite all conflicting files:
brew link --overwrite gcc

To list all files that would be deleted:
brew link --overwrite --dry-run gcc

after choosing to link and overwrite old gcc files using
brew link --overwrite gcc

import caffe began to work for me.

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

5 participants