vtraag / leidenalg

Implementation of the Leiden algorithm for various quality functions to be used with igraph in Python.
GNU General Public License v3.0
566 stars 76 forks source link

Difficulty building the project from source on Mac #140

Closed EllingtonKirby closed 12 months ago

EllingtonKirby commented 1 year ago

Hey! Thanks for your awesome work on this project. I am working with the Leiden algorithm for a research project, so I wanted to make some minor modifications to the C++ source. As such I followed the build instructions from the repo.

I was able to get everything working in the end, but I wanted to let you know the additional steps I took, to see if there was an error I made that would have simplified the process.

For reference, I am using Mac OS 12.5.1.

Here are the steps I took:

Now everything is working well (untill I start fiddling around with the c++ source lol) but I just wanted to know if I really errored somewhere in the build process and could have avoided manually copying the .dylib files. Hopefully this was clear, and if there is any info I can add let me know!

vtraag commented 12 months ago

In principle, this would be the way to go. However, instead of moving around the .dylib files, you could make sure you either install the .dylib files directly in the correct location, or you could include the path where you installed the library in DYLD_LIBRARY_PATH (note however that this will also be changed around by conda). The install location is indicated in CMake by CMAKE_INSTALL_PREFIX. You can check out and edit the provided build script to accommodate it to your own environment. At the moment, the build scripts also fetches the code, which is not what you'd want to do of course when you want to make changes.

Personally, what I would do is the following. First install igraph manually to your desired location, see https://igraph.org/c/html/latest/igraph-Installation.html for more detail. Make sure to specify the build location by passing -DCMAKE_INSTALL_PREFIX=<dir> at configuration time, where you should of course adapt <dir> to the actual build location. Then clone this repository somewhere, and from within the repository directory you can then build it using the usual CMake steps:

mkdir build
cmake .. -DCMAKE_INSTALL_PREFIX=<dir>
cmake --build . --target install

You can then easily adapt the C++ code and test it in Python.

Good luck! Let me know if you need more help.

EllingtonKirby commented 12 months ago

Thank you for the advice. I got things working using a little script I wrote, but when I try and clean things up at the end I will try and adapt your suggested method.

The included script only fetches the from github if there is no libleidenalg directory, so it is working well for me when I already have the library.

Thank you for your help!