esa / pagmo2

A C++ platform to perform parallel computations of optimisation tasks (global and local) via the asynchronous generalized island model.
https://esa.github.io/pagmo2/
GNU General Public License v3.0
823 stars 161 forks source link

cannot find -lpagmo #425

Closed daliaibrahim closed 4 years ago

daliaibrahim commented 4 years ago

Hello, I tried to build a project which is using pagmo library. I tried to install pagmo via anaconda by making a new env and " conda install pagmo pagmo-devel " I found the path of include files and add it but the project always give me error "cannot find -lpagmo" where is lib files ?? any advice what should i do ?

mlooz commented 4 years ago

Hello, thanks for using pagmo!

Can you post your full command and the error message you get? Thank you!

daliaibrahim commented 4 years ago

Thanks for replying, I run the code by type make -B -C .. cwaggle_orbital_av

the make file CC=g++ CFLAGS=-O3 -std=c++17 LD_LIBRARY_PATH=/home/mun/anaconda3/envs/my_env/lib/pagmo LDFLAGS=-O3 -lsfml-graphics -lsfml-window -lsfml-system -lsfml-audio -lpagmo INCLUDES=-I./include/ -I/home/mun/anaconda3/envs/Testenv/include/ -I/home/mun/anaconda3/envs/Testenv/include/eigen3/ -I/home/mun/anaconda3/envs/Testenv/lib/pagmo -I/home/mun/anaconda3/envs/Testenv/include/coin -L/home/mun/.local/lib cwaggle_orbital_av:$(OBJ_ORBITAL_AV) Makefile $(CC) $(OBJ_ORBITAL_AV) -o ./bin/$@ $(LDFLAGS)

======== the output and error massage is make: Entering directory '/home/mun/Dropbox/Code/cwaggle-orbital_av' g++ -c -O3 -std=c++17 -I./include/ -I/home/mun/anaconda3/envs/Testenv/include/ -I/home/mun/anaconda3/envs/Testenv/include/eigen3/ -I/home/mun/anaconda3/envs/Testenv/lib/pagmo -I/home/mun/anaconda3/envs/Testenv/include/coin -L/home/mun/.local/lib src/orbital_av/main.cpp -o src/orbital_av/main.o In file included from /home/mun/anaconda3/envs/Testenv/include/pagmo/pagmo.hpp:36:0, from src/orbital_av/main.cpp:13: /home/mun/anaconda3/envs/Testenv/include/pagmo/archipelago.hpp:144:35: warning: type attributes ignored after type is already defined [-Wattributes] friend class PAGMO_DLL_PUBLIC island; ^~~~~~ g++ src/orbital_av/main.o -o ./bin/cwaggle_orbital_av -O3 -lsfml-graphics -lsfml-window -lsfml-system -lsfml-audio -lpagmo /usr/bin/ld: cannot find -lpagmo collect2: error: ld returned 1 exit status Makefile:26: recipe for target 'cwaggle_orbital_av' failed make: *** [cwaggle_orbital_av] Error 1 make: Leaving directory '/home/mun/Dropbox/Code/cwaggle-orbital_av'

mlooz commented 4 years ago

Thanks for the messages! What is the content of the directory /home/mun/anaconda3/envs/my_env/lib/pagmo ? Have you tried adding it also with the -L flag? LD_LIBRARY_PATH is for loading shared libraries when running the compiled executable.

daliaibrahim commented 4 years ago

that path was empty I remove the anaconda and reinstall it again and the same error is the same I also do not find lpagmo anywhere but I found this path '/home/mun/anacondaNew/envs/Env1/lib/cmake/pagmo' it has some files like pagmo-config.cmake , pagmo_export.cmake , ......

Do you think we should include them or build them somehow to get the Lib folder. and how we can do that to get lpagmo lib?

darioizzo commented 4 years ago

I think there is some confusion here. pagmo headers and libraries are installed via the conda package manager using:

conda install pagmo-devel

After that you will have the pagmo headers in .../CONDA_BASE_DIR/envs/MY_ENVIRONMENT/include/pagmo, while the pagmo library libpagmo.so will be located in .../CONDA_BASE_DIR/lib/libpagmo.so

Can you please update your command line to reflect this structure and try again? After you have installed the pagmo-devel package from conda?

daliaibrahim commented 4 years ago

Thanks for replying. I installed pagmo-devel yes you are right, I found Libpagmo.so under lib and i added the path to my makefile but still have same problem cannot find -lpagmo

This is makefile CC=g++ CFLAGS=-O3 -std=c++17 LD_LIBRARY_PATH=/home/mun/anacondaNew/envs/Env1/lib LDFLAGS=-O3 -lsfml-graphics -lsfml-window -lsfml-system -lsfml-audio -lpagmo INCLUDES=-I./include/ -I/home/mun/anacondaNew/envs/Env1/include/ -I/home/mun/anacondaNew/envs/Env1/include/eigen3/ -I/home/mun/anacondaNew/envs/Env1/include/coin -L/home/mun/anacondaNew/envs/Env1/lib/ SRC_EXAMPLE=$(wildcard src/example/*.cpp) cwaggle_orbital_av:$(OBJ_ORBITAL_AV) Makefile $(CC) $(OBJ_ORBITAL_AV) -o ./bin/$@ $(LDFLAGS)

and i run by this command make -B -C .. cwaggle_orbital_av

darioizzo commented 4 years ago

After installing pagmo-devel activate the conda environment and follow the docs here: https://esa.github.io/pagmo2/quickstart.html#using-pagmo-with-cmake

darioizzo commented 4 years ago

closing this as related to the user local setup.