AliceO2Group / AliceO2

O2 software project for the ALICE experiment at CERN
GNU General Public License v3.0
99 stars 442 forks source link

Linking issue on Mac #1077

Closed awegrzyn closed 6 years ago

awegrzyn commented 6 years ago

Any idea?

[ 81%] Linking CXX executable ../../bin/o2TPCSimulation
ld: library not found for -lSimSetup
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [bin/o2TPCSimulation] Error 1
make[1]: *** [Framework/TestWorkflows/CMakeFiles/o2TPCSimulation.dir/all] Error 2
make: *** [all] Error 2
aphecetche commented 6 years ago

I think I had this one the other day (but using a "custom" cmake configuration from my IDE, not using alibuild), and it was because some libs for the simulation was not found (Geant3,Geant4,Geant4VMC,pythia6,pythia8, there should be relevant messages in the cmake configure stage)

In the CMake configure stage, do you see the line : -- Simulation environment found

?

awegrzyn commented 6 years ago

Nope I get this instead:

DEBUG:O2:O2:0: -- Could NOT find GLFW (missing: GLFW_INCLUDE_DIR GLFW_LIBRARIES) 
DEBUG:O2:O2:0: -- Simulation environment not found : at least one of the variables G4RUNLIB, G3RUNLIB, VMCLIB, Pythia6_FOUND or PYTHIA8_FOUND was not set correctly.

cmake -L gives:

G3RUNLIB:FILEPATH=G3RUNLIB-NOTFOUND
G4RUNLIB:FILEPATH=G4RUNLIB-NOTFOUND

but Geant4_DIR, Geant3_DIR is correctly set...

aphecetche commented 6 years ago

Yes, finding the right way to configure the cmake call for G* libs is kind of a pain... as the right combination of CMAKE_PREFIX_PATH (in theory to indicate the locations of Config.cmake files), CMAKE_MODULE_PATH (in theory to indicate the locations of Find.cmake files), and CMAKE_LIBRARY_PATH (to indicate the path for find_library commands that might be used in other cmake files) must be found...

A working solution/inspiration (not rocket science at all but the result of trial and error...) might hopefully be found in https://github.com/aphecetche/scripts/blob/master/cmake/cmake-configure-o2.sh

sawenzel commented 6 years ago

I just tested aliBuild build o2 --defaults=o2 on my MAC (10.11.6) with latest alidist + O2/dev and it goes through. Can you check your versions and mention them in the ticket? Please also mention how you compile.

awegrzyn commented 6 years ago

I did rm -rf * and compiled from scratch and it fails with the same error :(

awegrzyn commented 6 years ago

I just run aliBuild build O2 --default o2 that's it.

aphecetche commented 6 years ago

I realize this won't solve your immediate problem, but the logic for deciding whether or not we have all we need for simulation is quite convoluted (and apparently fragile) IMO.

We have in O2Dependencies.cmake the lines :

guess_append_libpath(geant321 "${Geant3_DIR}")
find_package(Geant3 NO_MODULE)

(plus equivalent for G4, etc...) and guess_append_libpath is already doing a find_library.

Why can't we just use the cmake variables set by the find_package function ? (Geant3_FOUND, etc...) instead of relying on a second find_library ?

sawenzel commented 6 years ago

As debugged with @awegrzyn, this particular problem is due to having the system protection enabled on MacOS which prevents correct setup of LD_LIBRARY_PATH, which in turn did not enable the internal variable HAVESIMULATION.

@ktf, @dberzano : Do we support building with system protection on? If not, alibuild should probably fail from the start.

Independently on that, I will try to make the HAVESIMULATION detection more robust.

awegrzyn commented 6 years ago

@sawenzel It works, thanks! As I've been working with o2-dataflow defaults I forgot that system protection needs to be disabled.

ktf commented 6 years ago

I think alibuild does support SIP enabled after the changes from @syamasak .

So indeed in principle what should be done is to have simulation detection logic which is more reliable.

How about simply have the user set -DHAVESIMULATION or something similar when they want simulation enabled? After all, anyone building with alibuild already does that choice by selecting o2 vs o2-dataflow.