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

Cannot find FANN source libs in multiarch #25

Open
randomstuff opened this issue Mar 1, 2018 · 3 comments
Open

Cannot find FANN source libs in multiarch #25

randomstuff opened this issue Mar 1, 2018 · 3 comments

Comments

@randomstuff
Copy link

randomstuff commented Mar 1, 2018

When trying to install this library I get:

$ pip install .
Processing /home/johndoe/src/fann2
    Complete output from command python setup.py egg_info:
    Looking for FANN libs...
    Traceback (most recent call last):
      File "", line 1, in 
      File "/tmp/pip-e23ii2o4-build/setup.py", line 92, in 
        build_swig()
      File "/tmp/pip-e23ii2o4-build/setup.py", line 85, in build_swig
        find_fann()
      File "/tmp/pip-e23ii2o4-build/setup.py", line 73, in find_fann
        raise Exception("Couldn't find FANN source libs!")
    Exception: Couldn't find FANN source libs!
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-e23ii2o4-build/

The reason is that on multiarch systems (at least Debian-based ones) libdoublefann is located in /usr/lib/$ARCH/libdoublefann.so (eg. /usr/lib/x86_64-linux-gnu/libdoublefann.so)::

Patching the setup code like this fixes the issue:

def find_fann():
    '''Find doublefann library'''
    # FANN possible libs directories (as $LD_LIBRARY_PATH), also includes
    # pkgsrc framework support.
    if sys.platform == "win32":
        dirs = sys.path
        for ver in dirs:
            if os.path.isdir(ver):
                if find_x(ver):
                    return True
        raise Exception("Couldn't find FANN source libs!")
    else:
        # Patched the path here:
        dirs = ['/lib', '/usr/lib/', '/usr/lib/x86_64-linux-gnu', '/usr/lib64', '/usr/local/lib', '/usr/pkg/lib']
        for path in dirs:
            if os.path.isdir(path):
                if find_x(path):
                    return True
        raise Exception("Couldn't find FANN source libs!")
@randomstuff
Copy link
Author

But this is not a correct solution as the correct ARCH to use depends on the architecture of the python interpreter. I'd tend to remove find_fann() altogether and just try to compile the thing.

@randomstuff randomstuff changed the title Cannot find FANN source libs in mutliarch Cannot find FANN source libs in multiarch Mar 2, 2018
@randomstuff
Copy link
Author

Another problem with this is that it wont honor LD_LIBRARY_PATH.

@kirkhansen
Copy link

This took me longer than it should have to debug. I spent quite a bit of time trying to understand how the shared file objects were not on the LD_LIBRARY_PATH; turns out they were, and I noticed that find_fann function ignored the multiarch directory.

My workaround was to symlink the shared file objects to one of the listed directories in find_fann

I agree with @randomstuff to remove that function and just attempt to compile.

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

2 participants