Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When building with intel or oneapi or ... as preferred compiler, use gcc for building cmake? #1514

Open
climbfuji opened this issue Feb 12, 2025 · 9 comments
Assignees
Labels
question Further information is requested

Comments

@climbfuji
Copy link
Collaborator

Is your feature request related to a problem? Please describe.

I am getting weird build failures for [email protected] with the latest [email protected]. Since cmake is simply a build tool that is not linked to any code we compile, I am wondering if we should build cmake with gcc when the preferred compiler is in this list:

  • intel
  • oneapi
  • nvhpc

I would prefer to build cmake with the preferred compiler when the preferred compiler is any of:

  • llvm
  • apple-clang
  • clang
  • aocc

Am I missing a compiler? Comments? Suggestions?

Describe the solution you'd like

See above

Additional context

n/a

@AlexanderRichert-NOAA
Copy link
Collaborator

Hmm... What system(s) is this on?

@climbfuji
Copy link
Collaborator Author

an NRL system

@rickgrubin-noaa
Copy link
Collaborator

Have tried a build with oneAPI @ 2025 just once, building cmake was not a problem.

That said, building with gcc when the preferred compiler is intel or oneapi (don't have experience with the other compilers) is fine with me.

I've run into a couple of other cases where one of intel / oneapi is problematic and gcc "just works" -- given that these cases have been limited to two specific hosts, I remain curious as to whether it's a host-specific / compiler ecosystem issue.

@climbfuji
Copy link
Collaborator Author

I was able to fix the bug, and it was not straightforward. If you ever see this when trying to build cmake with a compiler that clearly has C++11 support (which compiler doesn't in 2025):

CMake Error at CMakeLists.txt:93 (message):
  The C++ compiler does not support C++11 (e.g.  std::unique_ptr).


-- Configuring incomplete, errors occurred!
---------------------------------------------
Error when bootstrapping CMake:
Problem while running initial CMake
---------------------------------------------

Then check if your spack build stage directory is on an NFS mounted directory or not. If it is, change it to a local directory, a GPFS or Lustre mount, ... just not NFS. I will add something to the "Known issues" section about this.

The question remains, however. There is no reason to build cmake with Intel, especially because a gcc compiler must be present anyway as the backend. We already compile gmake with gcc. If we compile such basic build system utilities with gcc for the list of compilers suggested above, then we increase the possibility of reusing build caches across environments.

@rickgrubin-noaa
Copy link
Collaborator

We already compile gmake with gcc. If we compile such basic build system utilities with gcc for the list of compilers suggested above, then we increase the possibility of reusing build caches across environments.

Fair and valid point.

@AlexanderRichert-NOAA
Copy link
Collaborator

I'm openminded, but just based on my experience of adding gcc-built one-offs into intel envs (namely, the way in which various deps can quietly switch to gcc), I would tend to lean toward applying this on specific systems unless/until we identify it as a wider spread issue. It might also depend on why NFS is a problem, i.e., if it's because of some issue with creating temporary files used in the compiler checks or whatever, then maybe the "real" solution is to not put build_stage in NFS dirs.

@climbfuji
Copy link
Collaborator Author

I am ok either way now that I resolved this, but with the appropriate use of require this "should work".

The NFS bug is documented for cmake ("buried somewhere" may be more appropriate) and is a problem regardless of the system. The solution is to change the build_stage location. This only came up because the machine lost its GPFS in a power outage and is working off an NFS mount until the GPFS is restored.

@AlexanderRichert-NOAA
Copy link
Collaborator

Yeah, I can see some of the discussion about the issue. Looking at that, I get the impression that running CMake on NFS could conceivably lead to incorrect builds but that didn't fail-- maybe not a huge risk, but probably an argument for avoiding building on NFS (which I think will be relevant for some of our contrib-space installations...).

@stiggy87
Copy link
Contributor

The intel compiler does require gcc/g++ to be installed to use the headers, so it makes sense to use the lowest common denominator of just having cmake built withgcc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
Development

No branches or pull requests

4 participants