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

Installing with pip requires call to ldconfig if preCICE is built from source #136

Open
boris-martin opened this issue Oct 24, 2021 · 9 comments

Comments

@boris-martin
Copy link

I built preCICE from source yesterday (on Linux Mint, with parameters suggested here) and installed it succesfully, but then, running pip install --user pyprecice generates an error libprecice.so.2 not found. Running sudo ldconfig before running pip is enough to fix it.
The issue doesn't appear if we install a .deb package for libprecice. I noticed that the post-installation script of the .deb does include a call to sudo ldconfig, which explains a lot.

Suggested fix : Either add a call to ldconfig in the installation instructions (on the website) or the the install script (probably hard, since ldconfig requires superuser, it would break install into a user-chosen path without superuser). Unless something is wrong on the binding side, but I doubt it.

@ajaust
Copy link
Collaborator

ajaust commented Oct 24, 2021

@BenjaminRodenberg Is this an installation procedure we missed? I normally install all (preCICE + bindings) from source. I do this either by hand or via Spack and never ran into this problem so far.

@renefritze
Copy link

I do have to manually call ldconfig too when I install preCICE in our container stack. If you need a reproducer, this dockerfile could be trimmed further.

@MakisH
Copy link
Member

MakisH commented Nov 11, 2021

@boris-martin when building any library from source (i.e., not installing it via a system package manager, such as APT), the system needs to know where to find it. There are a few ways to do that:

  • Copy the library to a path known by the system to contain libraries (i.e., installing it). Usually these are paths that require root access to write to, hence the sudo.
  • Tell the system (the linker, ld), that there are additional places to look for libraries.

The linker looks for libraries in specific paths, using ldconfig. There is a list of these paths in /etc/ld.so.conf (or starting from that). When installing a system package, we usually call ldconfig (as root) to update the cache of what libraries are available where. However, this is not really possible in systems without root access, where package managers such as Spack become very useful.

The linker also looks in paths defined by LD_LIBRARY_PATH and this is one of the options we give to the user to link to preCICE. Some resources argue that this is not a very good practice, but it is quite common and works.

I always build preCICE from source (on Ubuntu, which should be the same as Mint) and I never need to manually run ldconfig, becuase I extend my LD_LIBRARY_PATH in my ~/.bashrc. How and where have you defined these variables?

@boris-martin
Copy link
Author

My bad, never read that part of the documentation. Replacing the call to ldconfig by something like export LD_LIBRARY_PATH=/usr/local/lib/ does work as intended. My bad !
However the documentation for linking shows this as troubleshooting while it would happend every time, so maybe it should be more visible ?
Or maybe put on the binding doc that correct linking is required ?

@BenjaminRodenberg
Copy link
Member

@boris-martin: If you have a more visible place in mind where we should post this information, feel free to edit the README.md and open a PR. I remember putting it under troubleshooting just to have it documented somewhere without thinking a lot about it.

@boris-martin
Copy link
Author

boris-martin commented Nov 11, 2021

@BenjaminRodenberg Actually the README is fine, the problem is that when you install the binding through the website, you're told that pip install is enough, which is not neccesarily true. I didn't think of looking here for instructions, actually
I'll probably open a PR, but it could be website related and not binding-related

@MakisH
Copy link
Member

MakisH commented Nov 11, 2021

It is also listed in the building from source: preparation page. But I understand that maybe this is not the right point in the workflow. Which pages did you read, in which order? Where would it make more sense for you?

We can definitely add an info-box somewhere.

@IshaanDesai
Copy link
Member

@BenjaminRodenberg Actually the README is fine, the problem is that when you install the binding through the website, you're told that pip install is enough, which is not neccesarily true. I didn't think of looking here for instructions, actually I'll probably open a PR, but it could be website related and not binding-related

A related issue to this is #114 which suggests a broad overhaul of the README and porting a majority of the stuff to the website for better accessibility. @MakisH would this make things clear in an overall sense keeping this issue in context?

@MakisH
Copy link
Member

MakisH commented Nov 11, 2021

It would definitely make sense, but I think this is an issue in the preCICE documentation, not the Python bindings documentation.

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

6 participants