How to correctly write recipe/meta.yaml for projects based on conda-forge/root?


Please read tips for efficient and successful posting and posting code

Please fill also the fields below. Note that root -b -q will tell you this info, and starting from 6.28/06 upwards, you can call .forum bug from the ROOT prompt to pre-populate a topic.

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided


Dear Experts,

I have a ROOT-based project and I also have it on conda-forge.

In meta.yaml fiel I have “usual” lines:


 requirements:
   build:
- {{ compiler(‘c’) }}
- {{ stdlib(“c”) }}
- {{ compiler(‘cxx’) }}
- cmake
- make
- ninja
host:
- root_base  >=6.28.00
- python     >=3.8.0
- gsl` `

Naively I expect that my project picks correct c++ compiler from ROOT (or picks up the ROOT version compatible with conda-forge compiler), however at the build time I have numerous warnings

$PREFIX/include/RConfigure.h:30:4: warning: #warning "The C++ standard in this build does not match ROOT configuration (202002L); this might cause unexpected issues" [-Wcpp]
   30 | #  warning "The C++ standard in this build does not match ROOT configuration (202002L); this might cause unexpected issues"
      |    ^~~~~~~
[

I suspect that these warnings coudl point that my assumptions are too naive.

Is there a recommended way to ensure that I do not have compiler conflicts at conda?

I think @vpadulan can help with this

BTW, are you using the ROOT CMake flags, or root-config --cflags to build your project?
Something like:

find_package(ROOT REQUIRED)
set(CMAKE_CXX_FLAGS ${ROOT_CXX_FLAGS})

To make sure you are using the same configuration than ROOT…

Dear @bellenot

I use my cmake ROOT_CXX_FLAGS that is

 -pipe -fsigned-char -fsized-deallocation -pthread
```

The flags from root-config are:

root-config --cflags 
-pthread -std=c++20 -m64 -fsized-deallocation -I/cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3/Tue/ROOT/HEAD/x86_64-el9-clang19-opt/include


```


(as you see these are not from conda)

nmy cmake-script after pick of ROTO_CXX_FLAGS I get c++standarf from roto-config

and set the C++ standard for targets exlicitely


target_compile_features (ostap PUBLIC cxx_std_20 )
message ( "----> C++ standard : C++20 " )
set_property(TARGET ostap PROPERTY CXX_STANDARD 20 )
```

I also have suspicion that any actions inside the cmake-script are already a bit late, since conda-forge reports the chosen compiler (gcc10) well before starting cmake

Well, OK, so let’s see what @vpadulan can tell about this…

Dear @ibelyaev ,

Thanks for reaching out to the forum!

I would start by taking inspiration from other downstream conda forge packages, e.g. CMS combine cms-combine-feedstock/recipe at main · conda-forge/cms-combine-feedstock · GitHub

Cheers,

Vincenzo

1 Like

Dear @vpadulan

Thaknk you.

Indeed I have somehtig very simlar to cms-combine., see. here recipe/meta.yaml

I’ve tried root or root_base in host and/or in build, I’ve tried too add c-compiler&cxx-compiler.

For all varant I have thee warnings.

dear @ibelyaev ,

Thanks for confirming. Can you also try adding this other file to your recipe ? cms-combine-feedstock/recipe/conda_build_config.yaml at main · conda-forge/cms-combine-feedstock · GitHub

No change..

probably due to [osx] clause. Shoul dI remove it?