This solves the problem. I also did the same thing earlier by setting CMAKE_CXX_COMPILER using the set(...) command of cmake. This solves the compiler issue. I seem to also not get the linking error mentioned above anymore. Not sure if it got solved due to this or some other change I made (which I didn't keep track of). Thanks for your help. Vinayak On Thursday, November 21, 2024 at 3:29:42 PM UTC+5:30 [email protected] wrote:
> Dear Alexander and Vinayak, > > I also used spack for the installation and for me, something similar (the > same?) happend. > > Running simply cmake . gives the following error. > > *$ cmake .* > -- Check for working CXX compiler: /home/~/spack/lib/spack/env/gcc/g++ - > broken > CMake Error at > /usr/local/share/cmake-3.27/Modules/CMakeTestCXXCompiler.cmake:60 (message): > The C++ compiler > > "/home/~/spack/lib/spack/env/gcc/g++" > > > is not able to compile a simple test program. > > It fails with the following output: > > What now works for me is running > *$ cmake -DCMAKE_CXX_COMPILER=g++ * > instead which I think is essentially what Prof. Bangerth was getting at > above by using the compiler that your system has. > > I don't remember but I think I must have found out with the help of > ChatGPT. > Before you try running cmake again, run * $ rm CMakeCache.txt* > such that you start from the beginning with cmake. > > Hope that will work for you too. > Best, > Nik > > On Tuesday, November 19, 2024 at 6:38:16 PM UTC-8 Wolfgang Bangerth wrote: > >> On 11/19/24 05:17, Vinayak Vijay wrote: >> > -- Check for working CXX compiler: >> > /home/omnipresent/Documents/github_repos/spack/lib/spack/env/gcc/g++ - >> broken >> > CMake Error at >> > >> /home/omnipresent/Documents/github_repos/spack/opt/spack/linux-ubuntu24.04-icelake/gcc-13.2.0/cmake-3.30.5-74qenkgyifomlcmwslmffwjq3vbfs5km/share/cmake-3.30/Modules/CMakeTestCXXCompiler.cmake:73 >> >> (message): >> > The C++ compiler >> > >> > >> "/home/omnipresent/Documents/github_repos/spack/lib/spack/env/gcc/g++" >> > >> > is not able to compile a simple test program. >> > >> > It fails with the following output: >> > >> > Change Dir: >> > >> '/home/omnipresent/Documents/github_repos/dealii/examples/step-2/build/CMakeFiles/CMakeScratch/TryCompile-aLSS2O' >> >> >> > >> > Run Build Command(s): >> > >> /home/omnipresent/Documents/github_repos/spack/opt/spack/linux-ubuntu24.04-icelake/gcc-13.2.0/cmake-3.30.5-74qenkgyifomlcmwslmffwjq3vbfs5km/bin/cmake >> >> -E env VERBOSE=1 >> /home/omnipresent/Documents/github_repos/spack/var/spack/environments/dealii_9_6/.spack-env/view/bin/gmake >> >> -f Makefile cmTC_14ee5/fast >> > >> /home/omnipresent/Documents/github_repos/spack/var/spack/environments/dealii_9_6/.spack-env/view/bin/gmake >> >> -f CMakeFiles/cmTC_14ee5.dir/build.make CMakeFiles/cmTC_14ee5.dir/build >> > gmake[1]: Entering directory >> > >> '/home/omnipresent/Documents/github_repos/dealii/examples/step-2/build/CMakeFiles/CMakeScratch/TryCompile-aLSS2O' >> >> >> > Building CXX object CMakeFiles/cmTC_14ee5.dir/testCXXCompiler.cxx.o >> > >> /home/omnipresent/Documents/github_repos/spack/lib/spack/env/gcc/g++ >> > -o CMakeFiles/cmTC_14ee5.dir/testCXXCompiler.cxx.o -c >> > >> /home/omnipresent/Documents/github_repos/dealii/examples/step-2/build/CMakeFiles/CMakeScratch/TryCompile-aLSS2O/testCXXCompiler.cxx >> >> >> > [spack cc] ERROR: Spack compiler must be run from Spack! Input >> > 'SPACK_ENV_PATH' is missing. >> >> Vijay: >> the way I read this error is that you asked Spack to download and install >> its >> own compiler, and that it now insists that you keep using that going >> forward: >> ERROR: Spack compiler must be run from Spack! Input 'SPACK_ENV_PATH' is >> missing. >> >> I really don't know anything about Spack (perhaps others here do), but my >> suggestion is to always rely on the compiler your system has. I see no >> reason >> not to use the compiler that comes with Ubuntu 24.04. >> >> Best >> W. >> >> -- >> ------------------------------------------------------------------------ >> Wolfgang Bangerth email: [email protected] >> www: http://www.math.colostate.edu/~bangerth/ >> >> >> -- The deal.II project is located at http://www.dealii.org/ For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en --- You received this message because you are subscribed to the Google Groups "deal.II User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/dealii/502982e2-ca14-4604-8543-653a61bc3f3cn%40googlegroups.com.
