Dear Prof. Bangerth, 

I expected it to take the default compiler. But for some reason it doesn't. 
A bit of context on my machine and installation: 

   - I am trying to install this version of dealii using spack on a clean 
   (newly installed) OS - Ubuntu24.04. 
   - Installed dealii using the command "spack install dealii" using the 
   spack/develop branch to get the latest version of dealii (spack package was 
   recently released).

Nevertheless, i tried to use the default gcc compilers by setting the 
following variables in the CMakeFiles.txt:
set(CMAKE_C_COMPILER "/usr/bin/gcc-13")
set(CMAKE_CXX_COMPILER "/usr/bin/g++-13")

Here's the output after this change:

omnipresent@dell:~/Documents/github_repos/spack/opt/spack/linux-ubuntu24.04-icelake/gcc-13.2.0/dealii-9.6.0-kt2qma7oea6a6vtupm4ho6lqkrirmcfz/share/deal.II/examples/step-1/build$
 
cmake ..
-- Using the deal.II-9.6.0 installation found at 
/home/omnipresent/Documents/github_repos/spack/var/spack/environments/dealii_9_6/.spack-env/view
-- Include macro 
/home/omnipresent/Documents/github_repos/spack/var/spack/environments/dealii_9_6/.spack-env/view/share/deal.II/macros/macro_deal_ii_add_test.cmake
-- Include macro 
/home/omnipresent/Documents/github_repos/spack/var/spack/environments/dealii_9_6/.spack-env/view/share/deal.II/macros/macro_deal_ii_initialize_cached_variables.cmake
-- Include macro 
/home/omnipresent/Documents/github_repos/spack/var/spack/environments/dealii_9_6/.spack-env/view/share/deal.II/macros/macro_deal_ii_invoke_autopilot.cmake
-- Include macro 
/home/omnipresent/Documents/github_repos/spack/var/spack/environments/dealii_9_6/.spack-env/view/share/deal.II/macros/macro_deal_ii_pickup_tests.cmake
-- Include macro 
/home/omnipresent/Documents/github_repos/spack/var/spack/environments/dealii_9_6/.spack-env/view/share/deal.II/macros/macro_deal_ii_query_git_information.cmake
-- Include macro 
/home/omnipresent/Documents/github_repos/spack/var/spack/environments/dealii_9_6/.spack-env/view/share/deal.II/macros/macro_deal_ii_setup_target.cmake
-- Include macro 
/home/omnipresent/Documents/github_repos/spack/var/spack/environments/dealii_9_6/.spack-env/view/share/deal.II/macros/macro_shell_escape_option_groups.cmake
-- Include macro 
/home/omnipresent/Documents/github_repos/spack/var/spack/environments/dealii_9_6/.spack-env/view/share/deal.II/macros/macro_target_compile_flags.cmake
-- Include macro 
/home/omnipresent/Documents/github_repos/spack/var/spack/environments/dealii_9_6/.spack-env/view/share/deal.II/macros/macro_target_link_flags.cmake
-- The C compiler identification is GNU 13.2.0
-- The CXX compiler identification is unknown
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/gcc-13 - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - failed
-- Check for working CXX compiler: 
/home/omnipresent/Documents/github_repos/spack/lib/spack/env/gcc/g++
-- 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/spack/opt/spack/linux-ubuntu24.04-icelake/gcc-13.2.0/dealii-9.6.0-kt2qma7oea6a6vtupm4ho6lqkrirmcfz/share/deal.II/examples/step-1/build/CMakeFiles/CMakeScratch/TryCompile-vtCf9n'
    
    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/opt/spack/linux-ubuntu24.04-icelake/gcc-13.2.0/gmake-4.4.1-gi7jbqxg2sbvrp26h3fbl7cstqieynuu/bin/gmake
 
-f Makefile cmTC_a92a3/fast
    
/home/omnipresent/Documents/github_repos/spack/opt/spack/linux-ubuntu24.04-icelake/gcc-13.2.0/gmake-4.4.1-gi7jbqxg2sbvrp26h3fbl7cstqieynuu/bin/gmake
 
 -f CMakeFiles/cmTC_a92a3.dir/build.make CMakeFiles/cmTC_a92a3.dir/build
    gmake[1]: Entering directory 
'/home/omnipresent/Documents/github_repos/spack/opt/spack/linux-ubuntu24.04-icelake/gcc-13.2.0/dealii-9.6.0-kt2qma7oea6a6vtupm4ho6lqkrirmcfz/share/deal.II/examples/step-1/build/CMakeFiles/CMakeScratch/TryCompile-vtCf9n'
    Building CXX object CMakeFiles/cmTC_a92a3.dir/testCXXCompiler.cxx.o
    /home/omnipresent/Documents/github_repos/spack/lib/spack/env/gcc/g++   
 -o CMakeFiles/cmTC_a92a3.dir/testCXXCompiler.cxx.o -c 
/home/omnipresent/Documents/github_repos/spack/opt/spack/linux-ubuntu24.04-icelake/gcc-13.2.0/dealii-9.6.0-kt2qma7oea6a6vtupm4ho6lqkrirmcfz/share/deal.II/examples/step-1/build/CMakeFiles/CMakeScratch/TryCompile-vtCf9n/testCXXCompiler.cxx
    [spack cc] ERROR: Spack compiler must be run from Spack! Input 
'SPACK_ENV_PATH' is missing.
    gmake[1]: *** [CMakeFiles/cmTC_a92a3.dir/build.make:78: 
CMakeFiles/cmTC_a92a3.dir/testCXXCompiler.cxx.o] Error 1
    gmake[1]: Leaving directory 
'/home/omnipresent/Documents/github_repos/spack/opt/spack/linux-ubuntu24.04-icelake/gcc-13.2.0/dealii-9.6.0-kt2qma7oea6a6vtupm4ho6lqkrirmcfz/share/deal.II/examples/step-1/build/CMakeFiles/CMakeScratch/TryCompile-vtCf9n'
    gmake: *** [Makefile:127: cmTC_a92a3/fast] Error 2
    
    

  

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:39 (project)


-- Configuring incomplete, errors occurred!
omnipresent@dell:~/Documents/github_repos/spack/opt/spack/linux-ubuntu24.04-icelake/gcc-13.2.0/dealii-9.6.0-kt2qma7oea6a6vtupm4ho6lqkrirmcfz/share/deal.II/examples/step-1/build$
 
cmake ..
-- Using the deal.II-9.6.0 installation found at 
/home/omnipresent/Documents/github_repos/spack/var/spack/environments/dealii_9_6/.spack-env/view
-- Include macro 
/home/omnipresent/Documents/github_repos/spack/var/spack/environments/dealii_9_6/.spack-env/view/share/deal.II/macros/macro_deal_ii_add_test.cmake
-- Include macro 
/home/omnipresent/Documents/github_repos/spack/var/spack/environments/dealii_9_6/.spack-env/view/share/deal.II/macros/macro_deal_ii_initialize_cached_variables.cmake
-- Include macro 
/home/omnipresent/Documents/github_repos/spack/var/spack/environments/dealii_9_6/.spack-env/view/share/deal.II/macros/macro_deal_ii_invoke_autopilot.cmake
-- Include macro 
/home/omnipresent/Documents/github_repos/spack/var/spack/environments/dealii_9_6/.spack-env/view/share/deal.II/macros/macro_deal_ii_pickup_tests.cmake
-- Include macro 
/home/omnipresent/Documents/github_repos/spack/var/spack/environments/dealii_9_6/.spack-env/view/share/deal.II/macros/macro_deal_ii_query_git_information.cmake
-- Include macro 
/home/omnipresent/Documents/github_repos/spack/var/spack/environments/dealii_9_6/.spack-env/view/share/deal.II/macros/macro_deal_ii_setup_target.cmake
-- Include macro 
/home/omnipresent/Documents/github_repos/spack/var/spack/environments/dealii_9_6/.spack-env/view/share/deal.II/macros/macro_shell_escape_option_groups.cmake
-- Include macro 
/home/omnipresent/Documents/github_repos/spack/var/spack/environments/dealii_9_6/.spack-env/view/share/deal.II/macros/macro_target_compile_flags.cmake
-- Include macro 
/home/omnipresent/Documents/github_repos/spack/var/spack/environments/dealii_9_6/.spack-env/view/share/deal.II/macros/macro_target_link_flags.cmake
-- The CXX compiler identification is GNU 13.2.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/g++-13 - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Autopilot invoked
###
#
#  Project  step-1  set up with  deal.II-9.6.0  found at
#     
 
/home/omnipresent/Documents/github_repos/spack/var/spack/environments/dealii_9_6/.spack-env/view
#
#  CMAKE_BUILD_TYPE:          Debug
#
#  You can now run
#       $ make                - to compile and link the program
#       $ make run            - to (compile, link and) run the program
#
#       $ make debug          - to switch the build type to 'Debug'
#       $ make release        - to switch the build type to 'Release'
#
#       $ make edit_cache     - to change (cached) configuration variables
#                               and rerun the configure and generate phases 
of CMake
#
#       $ make strip_comments - to strip the source files in this
#                               directory off their comments; this is 
irreversible
#       $ make clean          - to remove the generated executable as well 
as
#                               all intermediate compilation files
#       $ make runclean       - to remove all output generated by the 
program
#       $ make distclean      - to clean the directory from _all_ generated
#                               files (includes clean, runclean and the 
removal
#                               of the generated build system)
#       $ make info           - to view this message again
#
#  Have a nice day!
#
###
-- Configuring done (0.1s)
-- Generating done (0.0s)
-- Build files have been written to: 
/home/omnipresent/Documents/github_repos/spack/opt/spack/linux-ubuntu24.04-icelake/gcc-13.2.0/dealii-9.6.0-kt2qma7oea6a6vtupm4ho6lqkrirmcfz/share/deal.II/examples/step-1/build
omnipresent@dell:~/Documents/github_repos/spack/opt/spack/linux-ubuntu24.04-icelake/gcc-13.2.0/dealii-9.6.0-kt2qma7oea6a6vtupm4ho6lqkrirmcfz/share/deal.II/examples/step-1/build$
 
make -j40
[ 50%] Building CXX object CMakeFiles/step-1.dir/step-1.cc.o
[100%] Linking CXX executable step-1
ld.lld: error: unable to find library -lopen-pal
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/step-1.dir/build.make:355: step-1] Error 1
make[1]: *** [CMakeFiles/Makefile2:90: CMakeFiles/step-1.dir/all] Error 2
make: *** [Makefile:91: all] Error 2


It looks like it compiled on the second "cmake .." command (surprising to 
me). But then when i try to "make", it shows the linker error for which i 
am unable to find a solution.

Can someone help with this?

Thanks
Vinayak


On Wednesday, November 20, 2024 at 8:08:16 AM UTC+5:30 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: bang...@colostate.edu
> 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 dealii+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/dealii/06982016-ab07-47dc-80bb-5c4e5684b89en%40googlegroups.com.

Reply via email to