alibuild icon indicating copy to clipboard operation
alibuild copied to clipboard

Environment variable from default overrides not propagated

Open matthiasrichter opened this issue 7 years ago • 5 comments

I'm testing how to set the cmake build type from the defaults file, I want to have RELEASE for all packages but the ones I'm doing development on. Here is what I'm trying in the defaults file:

diff --git a/defaults-o2.sh b/defaults-o2.sh
index 618e1b6..7605cb8 100644
--- a/defaults-o2.sh
+++ b/defaults-o2.sh
@@ -1,9 +1,9 @@
 package: defaults-o2
 version: v1
 env:
-  CXXFLAGS: "-fPIC -g -O2 -std=c++11"
-  CFLAGS: "-fPIC -g -O2"
-  CMAKE_BUILD_TYPE: "RELWITHDEBINFO"
+  CXXFLAGS: "-fPIC -O2 -std=c++11"
+  CFLAGS: "-fPIC -O2"
+  CMAKE_BUILD_TYPE: "RELEASE"
 disable:
   - AliEn-Runtime
   - AliRoot
@@ -27,6 +27,9 @@ overrides:
   libpng:
   Python-modules:
   Python:
+  FairRoot:
+    env:
+      CMAKE_BUILD_TYPE: "RELWITHDEBINFO"
 ---

However, FairRoot build uses the common build type "RELEASE". It looks like the variable I want to set in the FairRoot environment from the overrides section is not propagated.

Using branch IB/v5-08/prod

matthiasrichter avatar Mar 29 '17 12:03 matthiasrichter

Just to be sure, I have tested again with updated master branches of both alibuild and alidist, the variables from the override section doesn't seem to be propagated.

@ktf can you have a quick look whether I'm doing something wrong.

matthiasrichter avatar May 08 '17 13:05 matthiasrichter

Hi @matthiasrichter, aliBuild does propagate the environment variable CMAKE_BUILD_TYPE, but then it's up to the recipes to pick it up correctly.

For instance, in AliRoot we have:

cmake ... ${CMAKE_BUILD_TYPE:+-DCMAKE_BUILD_TYPE="$CMAKE_BUILD_TYPE"}

whereas in FairRoot we hardcoded:

-DCMAKE_BUILD_TYPE=RelWithDebInfo

I have tested the variables propagation and aliBuild works correctly, I would say this is an alidist problem of the fairroot.sh recipe instead. Do you mind opening a PR if you still have the problem, and closing this one? Thanks!

dberzano avatar Aug 17 '17 10:08 dberzano

Hi @dberzano let me check again. I had updated the FairRoot recipe in exactly the way you mention and it did not work https://github.com/matthiasrichter/alidist/commit/ed0a8daa498777cf0c9e5c351871673d0a916f20

matthiasrichter avatar Aug 17 '17 11:08 matthiasrichter

I have checked the case, it's still valid.

My user story: As a developer I want to build all packages with build type RELEASE, except some packages I'm working on. For those I want to write a custom build type in the defaults file, like e.g.

diff --git a/defaults-o2.sh b/defaults-o2.sh
index 2027e5e..1cf9042 100644
--- a/defaults-o2.sh
+++ b/defaults-o2.sh
@@ -43,6 +43,9 @@ overrides:
       - GEANT4_VMC
       - Vc
       - ZeroMQ
+  FairRoot:
+    env:
+      CMAKE_BUILD_TYPE: "RELWITHDEBINFO"
   GSL:

expecting now that the environment from the overrides section is propagated to the build of my package. This does not happen.

Note: For the recipes I'm using a patch which replace the hardcoded build type in the recipe https://github.com/matthiasrichter/alidist/commit/ed0a8daa498777cf0c9e5c351871673d0a916f20

matthiasrichter avatar Aug 17 '17 15:08 matthiasrichter

I can reproduce it with a simple "reproducer".

testme.sh package:

package: TestMe
version: v1
---
#!/bin/sh
echo $CMAKE_BUILD_TYPE
false

defaults-o2.sh:

package: defaults-o2
version: v1
env:
  CMAKE_BUILD_TYPE: "global"
overrides:
  TestMe:
    env:
      CMAKE_BUILD_TYPE: "overridden"

Expected result is overridden but I get global, meaning that the global defaults environment has precedence over the package override, which is - indeed - wrong. I am looking into it.

Thanks for spotting!

dberzano avatar Aug 17 '17 15:08 dberzano