[CMake] FortranCInterface_VERIFY problem on Mac

Michael Jackson mike.jackson at bluequartz.net
Tue Apr 12 12:58:27 EDT 2011


It looks like your fortran compiler by default compiles in 32 bit (i386) where as GCC on OS X 10.6 defaults to 64 bit (x64). You probably need to provide some compiler flags to the fortran compiler in order to get it to compile in 64 bit mode.

The error is actually pretty easy to read:
> -lgfortranbegin -lgfortran
>     ld: warning: in CMakeFiles/VerifyFortranC.dir/VerifyFortran.f.o,
> file was built for i386 which is not the architecture being linked
> (x86_64)

--
Mike Jackson <www.bluequartz.net>

On Apr 12, 2011, at 12:49 PM, tog wrote:

> Hi,
> 
> I am quite new to CMake. I want to use it for compiling an application
> mixing C & Fortran.
> 
> I have narrowed down a CMake file to this:
> 
> PROJECT(dummy)
> 
> # Set the minimum version of cmake required to 2.6
> CMAKE_MINIMUM_REQUIRED( VERSION 2.6 )
> 
> ENABLE_LANGUAGE(Fortran)
> 
> INCLUDE(FortranCInterface)
> FortranCInterface_VERIFY(CXX)
> FortranCInterface_HEADER(FC.h MACRO_NAMESPACE "FC_")
> 
> and get the following error on my Mac.
> 
> Darwin obelix 10.7.0 Darwin Kernel Version 10.7.0: Sat Jan 29 15:16:10
> PST 2011; root:xnu-1504.9.37~1/RELEASE_X86_64 x86_64
> 
> Any idea what I am doing wrong ?
> 
> Thanks
> Guillaume
> 
> ...
>     Linking CXX executable VerifyFortranC
>     "/Applications/CMake 2.8-4.app/Contents/bin/cmake" -E
> cmake_link_script CMakeFiles/VerifyFortranC.dir/link.txt --verbose=1
>     /usr/bin/c++    -Wl,-search_paths_first
> -Wl,-headerpad_max_install_names
> CMakeFiles/VerifyFortranC.dir/main.c.o
> CMakeFiles/VerifyFortranC.dir/VerifyC.c.o
> CMakeFiles/VerifyFortranC.dir/VerifyFortran.f.o
> CMakeFiles/VerifyFortranC.dir/VerifyCXX.cxx.o  -o VerifyFortranC
> -lgfortranbegin -lgfortran
>     ld: warning: in CMakeFiles/VerifyFortranC.dir/VerifyFortran.f.o,
> file was built for i386 which is not the architecture being linked
> (x86_64)
>     Undefined symbols:
>       "_VerifyFortran", referenced from:
>           _main in main.c.o
>     ld: symbol(s) not found
>     collect2: ld returned 1 exit status
>     make[2]: *** [VerifyFortranC] Error 1
>     make[1]: *** [CMakeFiles/VerifyFortranC.dir/all] Error 2
>     make: *** [all] Error 2
> 
> Call Stack (most recent call first):
>   CMakeLists.txt:9 (FortranCInterface_VERIFY)
> 
> -- 
> PGP KeyID: 2048R/EA31CFC9  subkeys.pgp.net
> _______________________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
> 
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake



More information about the CMake mailing list