Getting cmake errors compiling programs

2,452 views
Skip to first unread message

Alexander Mensah

unread,
Oct 5, 2023, 5:14:18 PM10/5/23
to deal.II User Group
deal.ii-9.5.0
Processor: 3.6 GHz 8-Core Intel Core i9
macOS: Sonoma 14.0
xcode-select version 2399.

There seems to be an issue with compiler compatability. I recieve the following error when attempting to compile one of my projects (%cmake .):
-- The C compiler identification is AppleClang 15.0.0.15000040
-- The CXX compiler identification is unknown
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - failed
-- Check for working CXX compiler: /Applications/deal.II.app/Contents/Resources/spack/opt/mpich-4.1.1-hbtt/bin/mpic++
-- Check for working CXX compiler: /Applications/deal.II.app/Contents/Resources/spack/opt/mpich-4.1.1-hbtt/bin/mpic++ - broken
CMake Error at /Applications/deal.II.app/Contents/Resources/spack/opt/cmake-3.26.3-aw3s/share/cmake-3.26/Modules/CMakeTestCXXCompiler.cmake:60 (message):
  The C++ compiler

    "/Applications/deal.II.app/Contents/Resources/spack/opt/mpich-4.1.1-hbtt/bin/mpic++"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /Users/xmen/Desktop/PRISMS/phaseField/applications/fickianDiffusion/CMakeFiles/CMakeScratch/TryCompile-3w9jnP
   
    Run Build Command(s):/Applications/deal.II.app/Contents/Resources/spack/opt/cmake-3.26.3-aw3s/bin/cmake -E env VERBOSE=1 /usr/bin/make -f Makefile cmTC_b17ed/fast && /Library/Developer/CommandLineTools/usr/bin/make  -f CMakeFiles/cmTC_b17ed.dir/build.make CMakeFiles/cmTC_b17ed.dir/build
    Building CXX object CMakeFiles/cmTC_b17ed.dir/testCXXCompiler.cxx.o
    /Applications/deal.II.app/Contents/Resources/spack/opt/mpich-4.1.1-hbtt/bin/mpic++    -o CMakeFiles/cmTC_b17ed.dir/testCXXCompiler.cxx.o -c /Users/xmen/Desktop/PRISMS/phaseField/applications/fickianDiffusion/CMakeFiles/CMakeScratch/TryCompile-3w9jnP/testCXXCompiler.cxx
    error: unable to open output file 'CMakeFiles/cmTC_b17ed.dir/testCXXCompiler.cxx.o': 'No such file or directory'
    1 error generated.
    make[1]: *** [CMakeFiles/cmTC_b17ed.dir/testCXXCompiler.cxx.o] Error 1
    make: *** [cmTC_b17ed/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!


A similar error appears attempting the same in one of the example directories:

-- The C compiler identification is unknown

-- The CXX compiler identification is unknown

-- Detecting C compiler ABI info

-- Detecting C compiler ABI info - failed

-- Check for working C compiler: /Applications/deal.II.app/Contents/Resources/spack/lib/spack/env/clang/clang

-- Check for working C compiler: /Applications/deal.II.app/Contents/Resources/spack/lib/spack/env/clang/clang - broken

CMake Error at /Applications/deal.II.app/Contents/Resources/spack/opt/cmake-3.26.3-aw3s/share/cmake-3.26/Modules/CMakeTestCCompiler.cmake:67 (message):

  The C compiler


    "/Applications/deal.II.app/Contents/Resources/spack/lib/spack/env/clang/clang"


  is not able to compile a simple test program.


  It fails with the following output:


    Change Dir: /Applications/deal.II.app/Contents/Resources/Libraries/examples/arkode/CXX_serial/CMakeFiles/CMakeScratch/TryCompile-oKoi60

    

    Run Build Command(s):/Applications/deal.II.app/Contents/Resources/spack/opt/cmake-3.26.3-aw3s/bin/cmake -E env VERBOSE=1 /usr/bin/make -f Makefile cmTC_ce711/fast && /Library/Developer/CommandLineTools/usr/bin/make  -f CMakeFiles/cmTC_ce711.dir/build.make CMakeFiles/cmTC_ce711.dir/build

    Building C object CMakeFiles/cmTC_ce711.dir/testCCompiler.c.o

    /Applications/deal.II.app/Contents/Resources/spack/lib/spack/env/clang/clang    -o CMakeFiles/cmTC_ce711.dir/testCCompiler.c.o -c /Applications/deal.II.app/Contents/Resources/Libraries/examples/arkode/CXX_serial/CMakeFiles/CMakeScratch/TryCompile-oKoi60/testCCompiler.c

    [spack cc] ERROR: Spack compiler must be run from Spack! Input 'SPACK_ENV_PATH' is missing.

    make[1]: *** [CMakeFiles/cmTC_ce711.dir/testCCompiler.c.o] Error 1

    make: *** [cmTC_ce711/fast] Error 2

  CMake will not be able to correctly generate this project.

Call Stack (most recent call first):

  CMakeLists.txt:46 (project)


Could someone help me fix this?    


Wolfgang Bangerth

unread,
Oct 5, 2023, 6:47:07 PM10/5/23
to dea...@googlegroups.com

On 10/5/23 15:14, Alexander Mensah wrote:
>
> Could someone help me fix this?

I believe that you're trying to call cmake (to configure one of the
example programs) in the directory
/Applications/deal.II.app/Contents/Resources/Libraries/examples/... but
this is a system directory that you can read files in, but not write to.
You might have to copy the tutorial program directory you're trying to
configure into your home directory.

Best
W.

Alexander Mensah

unread,
Oct 5, 2023, 11:42:27 PM10/5/23
to deal.II User Group
No luck


image.png

Alexander Mensah

unread,
Oct 6, 2023, 12:06:31 AM10/6/23
to deal.II User Group
If I use the 'step-1' example, I get the same error (mpic++) as with the program I want to run.

image.png

Wolfgang Bangerth

unread,
Oct 6, 2023, 11:03:32 PM10/6/23
to dea...@googlegroups.com

> If I use the 'step-1' example, I get the same error (mpic++) as with the
> program I want to run.

The error message complains that there is no file
CMakeFiles/cmTC.../testCXXCompiler.cxx.o, which should have been
produced by the commend in the preceding line from the file
/Users/xmen/Desktop/dealii-copied-files/examples/step-1/CMakeFiles/CMakeScratch/TryCompiler-.../testCXXCompiler.cxx.
Does that latter file exist?

Best
W.

Luca Heltai

unread,
Oct 7, 2023, 3:44:52 AM10/7/23
to Deal.II Users
Is this with an M2 or an Intel mac?

I think you might have installed the intel version of the library, on an M1 or M2 mac. Is this the case?

My mpich is installed (on an M2 mac) under

/Applications/deal.II.app/Contents/Resources/spack/opt/mpich-4.1.1-4l2n

notice that the last 4 letters (part of the hash of the package) are different w.r.t. your snapshot.

L.

> On 6 Oct 2023, at 06:06, Alexander Mensah <xm...@umich.edu> wrote:
>
> If I use the 'step-1' example, I get the same error (mpic++) as with the program I want to run.
>
> <image.png>
>
> On Thursday, October 5, 2023 at 11:42:27 PM UTC-4 Alexander Mensah wrote:
> No luck
>
>
>
> On Thursday, October 5, 2023 at 6:47:07 PM UTC-4 Wolfgang Bangerth wrote:
>
> On 10/5/23 15:14, Alexander Mensah wrote:
> >
> > Could someone help me fix this?
>
> I believe that you're trying to call cmake (to configure one of the
> example programs) in the directory
> /Applications/deal.II.app/Contents/Resources/Libraries/examples/... but
> this is a system directory that you can read files in, but not write to.
> You might have to copy the tutorial program directory you're trying to
> configure into your home directory.
>
> Best
> W.
>
>
> --
> 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+un...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/3f5e1911-92a1-4c0c-b5e5-42d0b8dc4f7en%40googlegroups.com.
> <image.png>

Luca Heltai

unread,
Oct 7, 2023, 3:49:17 AM10/7/23
to Deal.II Users
Sorry, I had not read carefully. I see you have an intel mac. However, the compiler you are using is not the same compiler used to compile mpich (which was created on a Mac OS ventura, with clang 14, not clang 15).

You will have to reinstall the full stack of packages.

You should be able to run

spack compiler find --scope=site
spack activate dealii
spack concretize -f -U
spack install

It will take some time, but at the end you should have a working system.

Best,
Luca.
> --
> 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+un...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/c364bdf0-9c05-4143-b855-abccdea47e90n%40googlegroups.com.

Luca Heltai

unread,
Oct 8, 2023, 3:49:59 AM10/8/23
to Deal.II Users
I updated to sonoma in order to find the problem, and I’m currently trying to recreate the package of the library.

I confirm that I observe the same behaviour.

I’ll upload a new .dmg as soon as I manage to get one working.

Best,
Luca.

> On 6 Oct 2023, at 05:42, Alexander Mensah <xm...@umich.edu> wrote:
>
> No luck
> --
> 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+un...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/811147da-83e3-453b-9051-4b6b026d3b1bn%40googlegroups.com.
> <image.png>

Luca Heltai

unread,
Oct 8, 2023, 5:23:37 PM10/8/23
to Deal.II Users
I managed to create a new dmg package. I’m testing that everything works correctly before I upload it, but I also found a quick workaround that you can use, without having to wait for me to upload a new package:

you need to modify the files

/Applications/deal.II.app/Contents/Resources/Libraries/bin/mpicc
/Applications/deal.II.app/Contents/Resources/Libraries/bin/mpicxx
/Applications/deal.II.app/Contents/Resources/Libraries/bin/mpifort

in these three files, search for the line

final_ldflags=" -Wl,-commons,use_dylibs"

and replace it with

final_ldflags=“ "

The newer version of clang does not support the commons and use_dylibs flags.

In your application, you should also add the following definition to your cmake command:

cmake -DCMAKE_CXX_FLAGS=-DBOOST_NO_CXX98_FUNCTION_BASE

This is because the newer clang version has removed some deprecated functions from the standard library (as std::unary_functions) which are used by boost unless you instruct boost not to use them. This is the default behavious for the cxx17 standard.

You’ll get a bunch of warnings (due to clang 15 being a bit more restrictive than clang 14), but your application should compile and run also with the package that you have currently downloaded.

Best,
Luca.




> On 6 Oct 2023, at 06:06, Alexander Mensah <xm...@umich.edu> wrote:
>
> If I use the 'step-1' example, I get the same error (mpic++) as with the program I want to run.
>
> <image.png>
>
> On Thursday, October 5, 2023 at 11:42:27 PM UTC-4 Alexander Mensah wrote:
> No luck
>
>
>
> On Thursday, October 5, 2023 at 6:47:07 PM UTC-4 Wolfgang Bangerth wrote:
>
> On 10/5/23 15:14, Alexander Mensah wrote:
> >
> > Could someone help me fix this?
>
> I believe that you're trying to call cmake (to configure one of the
> example programs) in the directory
> /Applications/deal.II.app/Contents/Resources/Libraries/examples/... but
> this is a system directory that you can read files in, but not write to.
> You might have to copy the tutorial program directory you're trying to
> configure into your home directory.
>
> Best
> W.
>
>
> --
> 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+un...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/3f5e1911-92a1-4c0c-b5e5-42d0b8dc4f7en%40googlegroups.com.
> <image.png>

Luca Heltai

unread,
Oct 9, 2023, 5:04:25 AM10/9/23
to Deal.II Users
Alexander,

can you try out our new dmg image?

https://github.com/dealii/dealii/releases/download/v9.5.1/dealii-9.5.1-sonoma-arm64-clang15.dmg

I’m preparing also a new one, where the compiler is shipped together with the image. This should be robust to the next upgrades in the OS.

Best,
Luca.

> On 6 Oct 2023, at 06:06, Alexander Mensah <xm...@umich.edu> wrote:
>
> If I use the 'step-1' example, I get the same error (mpic++) as with the program I want to run.
>
> <image.png>
>
> On Thursday, October 5, 2023 at 11:42:27 PM UTC-4 Alexander Mensah wrote:
> No luck
>
>
>
> On Thursday, October 5, 2023 at 6:47:07 PM UTC-4 Wolfgang Bangerth wrote:
>
> On 10/5/23 15:14, Alexander Mensah wrote:
> >
> > Could someone help me fix this?
>
> I believe that you're trying to call cmake (to configure one of the
> example programs) in the directory
> /Applications/deal.II.app/Contents/Resources/Libraries/examples/... but
> this is a system directory that you can read files in, but not write to.
> You might have to copy the tutorial program directory you're trying to
> configure into your home directory.
>
> Best
> W.
>
>

David Montiel Taboada

unread,
Oct 9, 2023, 8:19:03 PM10/9/23
to deal.II User Group
Hello, everyone

I tried the new image in my laptop with M2 processor and the Ventura Mac OS (13.6). It worked (I successfully ran and compiled the step-1 example). Looks like the issue was with clang 15?

However, I am not sure Alexander will be able to test the new image because his processor is Intel.

I will test deal.II with the PRISMS-PF applications and report if I see any issues. 

Thank you for your help, Luca!

David
Message has been deleted

Lex Lee

unread,
Oct 24, 2023, 7:13:47 PM10/24/23
to deal.II User Group
I hope deal.ii group could release version 9.5.1 that works with intel processor on MacOS platform. 

Luca Heltai

unread,
Oct 25, 2023, 2:31:55 AM10/25/23
to dea...@googlegroups.com
I have just updates my old Intel mac. I hope to get the package working in the next days. 

Luca

Il giorno 25 ott 2023, alle ore 01:13, Lex Lee <hitl...@gmail.com> ha scritto:

I hope deal.ii group could release version 9.5.1 that works with intel processor on MacOS platform. 

Ester Comellas

unread,
Dec 15, 2023, 3:55:10 AM12/15/23
to deal.II User Group
Hi Luca,

Have you had the chance to get the deal.ii-9.5.1 package working for macOS Sonoma & clang 15 on an Intel processor? I'm stuck installing deal.II using spack (see this other thread: https://groups.google.com/g/dealii/c/vT8LAmNtUQE), and using this pre-compiled package instead would be great.

Thanks,
Ester


El dia dimecres, 25 d’octubre del 2023 a les 8:31:55 UTC+2, luca....@gmail.com va escriure:

Vinayak Vijay

unread,
Nov 19, 2024, 7:17:39 AM11/19/24
to deal.II User Group
Hi,

I am getting a similar error as above for OS: Ubuntu24.04 LTS. How can i resolve this?


```
omnipresent@omnipresent:~/Documents/github_repos/dealii/examples/step-2/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 Clang 17.0.6

-- The CXX compiler identification is unknown
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /home/omnipresent/Documents/github_repos/spack/var/spack/environments/dealii_9_6/.spack-env/view/bin/clang - 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/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.
    gmake[1]: *** [CMakeFiles/cmTC_14ee5.dir/build.make:78: CMakeFiles/cmTC_14ee5.dir/testCXXCompiler.cxx.o] Error 1
    gmake[1]: Leaving directory '/home/omnipresent/Documents/github_repos/dealii/examples/step-2/build/CMakeFiles/CMakeScratch/TryCompile-aLSS2O'
    gmake: *** [Makefile:127: cmTC_14ee5/fast] Error 2

   
   

 

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



-- Configuring incomplete, errors occurred!

```
Thanks
Vinayak

Wolfgang Bangerth

unread,
Nov 19, 2024, 9:38:16 PM11/19/24
to dea...@googlegroups.com
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/


Vinayak Vijay

unread,
Nov 20, 2024, 11:28:36 PM11/20/24
to deal.II User Group
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

Wolfgang Bangerth

unread,
Nov 20, 2024, 11:44:12 PM11/20/24
to dea...@googlegroups.com
On 11/20/24 21:28, Vinayak Vijay wrote:
>   The C++ compiler
>
>     "/home/omnipresent/Documents/github_repos/spack/lib/spack/env/gcc/g++"
>
>   is not able to compile a simple test program.

That means it's still using a compiler spack builds itself.

As I mention, I don't know how spack works. I'm afraid that's the extent to
which I can help.

Best
W.

Vinayak Vijay

unread,
Nov 21, 2024, 12:52:24 AM11/21/24
to deal.II User Group
It does use the spack compiler for the first "cmake .." (refer attached file CMakeCache_first.txt) but for the second "cmake .." (refer attached file CMakeCache_second.txt) it uses the path that i prescribe in the CMakeFiles.txt. But then in the second case i face another issue i.e. the linker issue mentioned as mentioned before.  

Thanks, Prof. Bangerth for taking a look at this. I am still writing about the issue here in case anyone else can offer a solution.

Regards,
Vinayak
CMakeLists.txt
CMakeCache_first.txt
CMakeCache_second.txt

Nik Markus Leuenberger

unread,
Nov 21, 2024, 4:59:42 AM11/21/24
to deal.II User Group
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

Vinayak Vijay

unread,
Nov 22, 2024, 5:24:24 AM11/22/24
to deal.II User Group
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

Luca Heltai

unread,
Nov 27, 2024, 5:09:20 PM11/27/24
to Deal.II Users
The solution is quite simple, actually.

When spack compiles libraries, it does not do that by using directly a compiler, but a script around the system compilers (or the user provided compiler) that cleans the environment, and makes sure everything is in place not to fiddle around with dependencies.

Unfortunately, sometimes this compiler gets written in the final deal.II cmake files. Mac spack does it, ubuntu sometimes (not always).

The solution is the following:

Modify $(spack location -i dealii)/lib/share/cmake/deal.II/deal.IIConfig.cmake, around lines 109/110

set(DEAL_II_CXX_COMPILER "/home/omnipresent/Documents/github_repos/spack/lib/spack/env/gcc/g++")
set(DEAL_II_C_COMPILER "/home/omnipresent/Documents/github_repos/spack/lib/spack/env/gcc/gcc")

and make sure it becomes something like

set(DEAL_II_CXX_COMPILER “the_real_path_to_mpicxx")
set(DEAL_II_C_COMPILER "the_real_path_to_mpicc")

where “the_real_path_to_mpicxx” should be the path to the actual compiler you used to build deal.II.

I’m unsure why this happens. I think we should open an issue on spack.

L.
> --
> 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+un...@googlegroups.com.
> To view this discussion visit https://groups.google.com/d/msgid/dealii/3d7d1cde-ef18-4f8a-bb5d-70a7babd1774n%40googlegroups.com.
> <CMakeLists.txt><CMakeCache_first.txt><CMakeCache_second.txt>

Reply all
Reply to author
Forward
0 new messages