Open wgseligman opened 3 years ago
I found the answer to my problem, which only raised more issues.
In my searches for the cause of the problem, I looked in the CMakeCache.txt file. I found the line:
EXPAT_INCLUDE_DIR:PATH=/Library/Frameworks/Mono.framework/Headers
When I used
strings /Library/Frameworks/Mono.framework/Versions/1.9.1/lib/libexpat.dylib | grep expat
I saw that indeed that library had EXPAT version 2.0.1.
I never installed Mono explicitly on my computer. It must have been installed as part of some older package; the files are dated from 2013. I took the risk that nothing I'm using today still uses Mono and did:
sudo rm -rf /Library/Frameworks/Mono.framework
Now the cmake process runs through to completion.
Now the question becomes: Why did the EXPAT package search process find an obscure library header path instead of the one included in the conda environment?
I have the same problem which propagates to zlib.
My expat path that cmake found is
/Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/usr/include
and (a too old) ZLIB is found at
/Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/usr/include
even though I tell CMake to not use it (aka -DGEANT4_USE_SYSTEM_ZLIB=OFF
)
because I also have that in my conda environment (I had to install it my self)
expat 2.5.0 hf0c8a7f_0 conda-forge libzlib 1.2.13 hfd90126_4 conda-forge zlib 1.2.13 hfd90126_4 conda-forge
Ups! I forgot that I did this sometime ago and I followed this recipe https://github.com/conda-forge/geant4-feedstock/issues/4#issuecomment-696571469
Though this makes me think: just installing Geant4 doesn't appear to be enough...should the recipe include the installation of those packages by default @chrisburr ?
By creating the environment with geant4
+ cmake
+ compilers
(make
is not necessary) the build of the example works out-of-the-box.
I am not sure if it is relevant, but a few months ago I noticed that for proper operation I had to explicitly add expat
to my conda .yml
file in addition to geant4
, before our Geant4-based code would work correctly on both linux and mac (I don't recall the details of what was wrong when I didn't). Perhaps it would help to add expat also in the run:
section of https://github.com/conda-forge/geant4-feedstock/blob/main/recipe/meta.yaml ?
Issue:
I'm having problems compiling a program within conda that uses Geant4. I can reproduce the issue as follows:
Within conda, I created a geant4 environment on both Linux CentOS 7 and Mac OS X Mojave:
Then I try to build any of the examples using
cmake
:In Linux, this builds without a problem. But in Mac OS,
cmake
has a problem finding the EXPAT library. Here is the output:As you can see in the details below, conda installed expat-2.4.1 as part of the geant4 installation. When I look at the library
/Users/seligman/opt/anaconda3/envs/grams-devel/lib/libexpat.dylib
, I see it contains the stringexpat_2.4.1
.Why is it that, using conda-forge-supplied cmake, expat, and geant4, and after finding a library that apparently is of the appropriate version, that cmake is reporting this error? And why only on Mac OS and not CentOS?
Environment (
conda list
):Details about
conda
and system (conda info
):