easybuilders / easybuild-easyconfigs

A collection of easyconfig files that describe which software to build using which build options with EasyBuild.
https://easybuild.io
GNU General Public License v2.0
371 stars 699 forks source link

RPackage is not picking up the correct toolchainopts #8930

Open eylenth opened 4 years ago

eylenth commented 4 years ago

I wanted to install a R package as a stand-alone RPackage. But I tried to define the following option in the RPackage easyconfig: toolchainopts = {'cstd': 'c99'}

Then it does not pick up the correct compilation options.

In the beginning of the config-process, it is picking up the correct C99 option: == 2019-09-17 16:24:18,816 environment.py:97 INFO Environment variable CFLAGS set to -O2 -ftree-vectorize -march=native -fno-math-errno -std=c99 (previously undefined)

but in the actual compilation process, the C99 option is stripped of again: gcc ... -fpic -O2 -ftree-vectorize -march=native -fno-math-errno -c internal.c -o internal.o

It's using the compiler flags that were used to build R itself with.

cfr. discussion Slack

boegel commented 4 years ago

Workaround that is confirmed to work:

toolchainopts = {'cstd': 'c99'}
preinstallopts = 'export PKG_CFLAGS="$CFLAGS" && '

We need change the RPackage easyblock so PKG_CFLAGS & co are always defined before running R CMD INSTALL to avoid inheriting the compiler flags used to build R itself?