CRPropa / CRPropa3

CRPropa is a public astrophysical simulation framework for propagating extraterrestrial ultra-high energy particles. https://crpropa.github.io/CRPropa3/
https://crpropa.desy.de
GNU General Public License v3.0
68 stars 67 forks source link

Make with gperftools fails: cannot find -lprofiler #372

Closed saikatxdas closed 1 year ago

saikatxdas commented 2 years ago

Dear developers,

I have problems installing CRPropa on my system System Information: (Please fill out the following information)

Did you install CRPropa from git or download a release? I installed version 3.1.7 from the releases.

Things that I tried before asking for help: I read and followed the installation instructions at https://crpropa.github.io/CRPropa3/ . Before writing this request I also checked previous installation issues at https://github.com/CRPropa/CRPropa3/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3Ainstallation+ .

From past issues, I found a similar problem was reported in #236 and the issue can be bypassed by using the flag -DNO_TCMALLOC=TRUE. The same applies to me. But I want to know if this can be resolved, as I want to compile with google-perftools.

make -j4 fails with the following error

/usr/bin/ld: cannot find -lprofiler
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/crpropa.dir/build.make:1154: libcrpropa.so] Error 1
make[2]: Leaving directory '/sc/home/saikat.das/codes/CRPropa3-3.1.7/build'
make[1]: *** [CMakeFiles/Makefile2:460: CMakeFiles/crpropa.dir/all] Error 2
make[1]: Leaving directory '/sc/home/saikat.das/codes/CRPropa3-3.1.7/build'
make: *** [Makefile:160: all] Error 2 

I have installed google perftools from the following link and made a local installation using ./configure --prefix=$CRPROPA_DIR https://github.com/gperftools/gperftools

I have specified the tcmalloc library path correctly using ccmake. Here are the files CMakeCache.txt and the logfile from VERBOSE=1 make

lukasmerten commented 2 years ago

@saikatxdas: Does that problem still persist? Can you provide any additional information?

saikatxdas commented 2 years ago

@lukasmerten Sorry for my late reply. Yes, the problem still persists. However, I have not tried updating to CRPropa 3.2. Maybe I will check that.

lukasmerten commented 1 year ago

If that's still an issue with version 3.2 please reopen.

cxwx commented 1 year ago

It depends on how the libprofiler.dylib is linked for oneself, so one could change the DYLD_LIBRARY_PATH or modify the CMakeLists.txt add the linked lib for me it's install with homebrew, so I add the

if(APPLE)
link_directories(
  /opt/homebrew/lib/
  )
endif(APPLE)

should I made a pull request?

AlenaBakalova commented 1 year ago

Hi everyone. We just encountered the same problem with a student today. She has a macos Ventura 13.5. During the make command, it returns an error "library not found for -lprofiler". Is there a solution yet? Thank you!

cxwx commented 1 year ago

Hi everyone. We just encountered the same problem with a student today. She has a macos Ventura 13.5. During the make command, it returns an error "library not found for -lprofiler". Is there a solution yet? Thank you!

I made a pull request for -lprofiler problem https://github.com/CRPropa/CRPropa3/pull/437 I suppose one install googleperftools with the pkg.

AlenaBakalova commented 1 year ago

She installed gperftool using port. We tryed to modify the cmakelist with the: if(APPLE) find_package(PkgConfig) pkg_check_modules(profiler REQUIRED) endif(APPLE) but still got the same error... Should we modify something else too? I am not familliar with macos at all, is there a difference when we istall using homebrew and this mac port?

cxwx commented 1 year ago

as I'm not using macport

can you find your googleperftools PATH? it should include

lib
|-- libprofiler.a
|-- libprofiler.dylib
|-- pkgconfig
    |-- libprofiler.pc

at pkgconfig there should be libprofiler.pc also you can try to set PKG_CONFIG_PATH to that path, so that cmake could find the PATH