ANTsX / ANTsR

R interface to the ANTs biomedical image processing library
https://antsx.github.io/ANTsR
Apache License 2.0
127 stars 35 forks source link

Cmake does not detect the correct build environment with modules #312

Closed muratmaga closed 4 years ago

muratmaga commented 4 years ago

Describe the bug

I think this is a more of a cmake issue than ANTsR, so any suggestion is much appreciated but here is the situation:

The default gcc in our HPC is 4.8.5. I use module load gcc/7 to make the default gcc version as 7.3.0m which I can verify with:

[maga@magalab bin]$ gcc --version gcc (GCC) 7.3.0 Copyright (C) 2017 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

cmake is 3.15

When I start the R from the same environment and then do install_github('ANTsX/ANTsR'), cmake is finding the default gcc (4.8.5), not the module I load. Likewise a git clone and R CMD INSTALL also results in this:

  • installing to library ‘/home/maga/test/R/3.6.3/lib64/R/library’
  • installing source package ‘ANTsRCore’ ... ** using staged installation linux-gnu 0 Cloning into 'ants'... remote: Enumerating objects: 24463, done. remote: Total 24463 (delta 0), reused 0 (delta 0), pack-reused 24463 Receiving objects: 100% (24463/24463), 20.38 MiB | 9.80 MiB/s, done. Resolving deltas: 100% (17447/17447), done. Already on 'master' Already up-to-date. Note: checking out 'e0d776673499972100b070821d369caa29d13e4c'.

You are in 'detached HEAD' state. You can look around, make experimental changes and commit them, and you can discard any commits you make in this state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may do so (now or later) by using -b with the checkout command again. Example:

git checkout -b new_branch_name

HEAD is now at e0d7766... BUG: Compatibility. -- The C compiler identification is GNU 4.8.5 -- The CXX compiler identification is GNU 4.8.5 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context Add any other context about the problem here.

muratmaga commented 4 years ago

I don't know why see make still finds the old compiler after module load, but this worked for me.

https://stackoverflow.com/questions/17275348/how-to-specify-new-gcc-path-for-cmake