# Verifying Fortran/C Compiler Fails

**URL:** https://discourse.cmake.org/t/verifying-fortran-c-compiler-fails/2183
**Category:** Usage
**Created:** [November 16, 2020, 4:30pm UTC](https://discourse.cmake.org/t/verifying-fortran-c-compiler-fails/2183 "2020-11-16T16:30:13Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![RonRahaman](https://discourse.cmake.org/user_avatar/discourse.cmake.org/ronrahaman/32/953_2.png) [@RonRahaman](https://discourse.cmake.org/u/RonRahaman)
#### Post date: [November 16, 2020, 4:30pm UTC](https://discourse.cmake.org/t/verifying-fortran-c-compiler-fails/2183/1 "2020-11-16T16:30:13Z")

</div>

Hi all, `FortranCInterface_VERIFY` isn’t working on my Mac after an OS and compiler updates.

I’m running on macOS 11 with gcc-10 from Homebrew and cmake 18. I’m getting these errors in stdout (let me know if you want to see more)

```auto
-- Detecting Fortran/C Interface
Failed to compile
-- Verifying Fortran/C Compiler Compatibility
Failed to compile
CMake Warning (dev) at /usr/local/Cellar/cmake/3.18.4/share/cmake/Modules/FortranCInterface.cmake:309 (message):
  No FortranCInterface mangling known for VerifyFortran
Call Stack (most recent call first):
  /usr/local/Cellar/cmake/3.18.4/share/cmake/Modules/FortranCInterface/Verify/CMakeLists.txt:16 (FortranCInterface_HEADER)
This warning is for project developers. Use -Wno-dev to suppress it.

-- Verifying Fortran/C Compiler Compatibility - Failed
CMake Error at /usr/local/Cellar/cmake/3.18.4/share/cmake/Modules/FortranCInterface.cmake:383 (message):
  The Fortran compiler:

    /usr/local/bin/gfortran-10

  and the C compiler:

    /usr/local/bin/gcc-10

  failed to compile a simple test project using both languages. The output
  was:

******A BUNCH OF STUFF****

    /usr/local/bin/gcc-10 -O3 -DNDEBUG -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.0.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/VerifyFortranC.dir/main.c.o CMakeFiles/VerifyFortranC.dir/VerifyC.c.o -o VerifyFortranC libVerifyFortran.a -lgfortran -lquadmath -lm
    ld: warning: ignoring file libVerifyFortran.a, building for macOS-x86_64 but attempting to link with file built for macOS-x86_64
    Undefined symbols for architecture x86_64:
      "_VerifyFortran", referenced from:
          _main in main.c.o
    ld: symbol(s) not found for architecture x86_64
    collect2: error: ld returned 1 exit status

```

And I did some detective work and I found that the name mangling was indeed wrong:

```auto
$ nm CMakeFiles/FortranCInterface/VerifyC/libVerifyFortran.a
VerifyFortran.f.o:
00000000000000d0 r EH_frame1
                 U __gfortran_st_write
                 U __gfortran_st_write_done
                 U __gfortran_transfer_character_write
0000000000000000 T _verifyfortran_
0000000000000058 r lC0
00000000000000c8 r lC1
00000000000000b8 r lC2

$ nm CMakeFiles/FortranCInterface/VerifyC/CMakeFiles/VerifyFortranC.dir/main.c.o
0000000000000018 r EH_frame1
                 U _VerifyC
                 U _VerifyFortran
0000000000000000 T _main

$ cat ./CMakeFiles/FortranCInterface/VerifyC/VerifyFortran.h
#ifndef FortranCInterface_HEADER_INCLUDED
#define FortranCInterface_HEADER_INCLUDED

/*--------------------------------------------------------------------------*/
/* Mangle some symbols automatically. */

#endif

```

Again, let me know if you need more log output.

---

<div class="post-metadata">

### Author: ![RonRahaman](https://discourse.cmake.org/user_avatar/discourse.cmake.org/ronrahaman/32/953_2.png) [@RonRahaman](https://discourse.cmake.org/u/RonRahaman)
#### Post date: [November 16, 2020, 4:33pm UTC](https://discourse.cmake.org/t/verifying-fortran-c-compiler-fails/2183/2 "2020-11-16T16:33:11Z")

</div>

Right now, I’m thinking this would succeed if the name-manging macros were actually set in `VerifyFortran.h`. Based on CMake’s messages and looking at the generated `VerifyFortran.h`, it looks the macros weren’t discovered.

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [November 16, 2020, 6:48pm UTC](https://discourse.cmake.org/t/verifying-fortran-c-compiler-fails/2183/3 "2020-11-16T18:48:38Z")

</div>

Cc: @chuckatkins @brad.king

---

<div class="post-metadata">

### Author: ![brad.king](https://discourse.cmake.org/user_avatar/discourse.cmake.org/brad.king/32/11_2.png) [@brad.king](https://discourse.cmake.org/u/brad.king)
#### Post date: [November 17, 2020, 1:03pm UTC](https://discourse.cmake.org/t/verifying-fortran-c-compiler-fails/2183/4 "2020-11-17T13:03:40Z")

</div>

> `FortranCInterface_VERIFY` isn’t working on my Mac after an OS and compiler updates.  
> I’m running on macOS 11 with gcc-10 from Homebrew

Please open an issue for that over in our [issue tracker](https://gitlab.kitware.com/cmake/cmake/-/issues). Attach to the issue a tarball of the `CMakeFiles/` directory from the top of a build tree from a tiny test project that reproduces the problem.

---

<div class="post-metadata">

### Author: ![brad.king](https://discourse.cmake.org/user_avatar/discourse.cmake.org/brad.king/32/11_2.png) [@brad.king](https://discourse.cmake.org/u/brad.king)
#### Post date: [November 18, 2020, 3:51pm UTC](https://discourse.cmake.org/t/verifying-fortran-c-compiler-fails/2183/5 "2020-11-18T15:51:41Z")

</div>

I see [CMake Issue 21454](https://gitlab.kitware.com/cmake/cmake/-/issues/21454), thanks!

---

<div class="post-metadata">

### Author: ![RonRahaman](https://discourse.cmake.org/user_avatar/discourse.cmake.org/ronrahaman/32/953_2.png) [@RonRahaman](https://discourse.cmake.org/u/RonRahaman)
#### Post date: [November 18, 2020, 3:52pm UTC](https://discourse.cmake.org/t/verifying-fortran-c-compiler-fails/2183/6 "2020-11-18T15:52:32Z")

</div>

My pleasure, thanks for the help
