MantisBT - CMake | |||||
| View Issue Details | |||||
| ID | Project | Category | View Status | Date Submitted | Last Update |
| 0015872 | CMake | CMake | public | 2015-12-06 23:39 | 2016-05-02 08:30 |
| Reporter | Ben Matthews | ||||
| Assigned To | |||||
| Priority | normal | Severity | major | Reproducibility | always |
| Status | closed | Resolution | no change required | ||
| Platform | x86_64 | OS | Linux | OS Version | Various |
| Product Version | CMake 3.3.2 | ||||
| Target Version | Fixed in Version | ||||
| Summary | 0015872: Programs with Fortran entry point (but calls into C) don't link correctly using Intel or PGI compilers | ||||
| Description | CMake always seems to link mixed language programs using the C++ compiler. Intel and PGI link libcrt, which wants to have a main(). Programs with a Fortran entry point typically won't have main(). Setting the linker_language property doesn't seem to make a difference. Using the GNU compilers, CMake still uses the C++ compiler, but it gets the libraries right and everything works as expected. | ||||
| Steps To Reproduce | git clone https://github.com/matthb2/cmake_f90_entry_bug.git [^] cd cmake_f90_entry_bug mkdir build cd build CC=icc CXX=icpc FC=ifort cmake ../ make #### make Scanning dependencies of target testprog [ 50%] Building Fortran object CMakeFiles/testprog.dir/test.f90.o [100%] Linking CXX executable testprog /usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/../../../../lib64/crt1.o: In function `_start': (.text+0x20): undefined reference to `main' CMakeFiles/testprog.dir/build.make:94: recipe for target 'testprog' failed make[2]: *** [testprog] Error 1 CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/testprog.dir/all' failed make[1]: *** [CMakeFiles/testprog.dir/all] Error 2 Makefile:83: recipe for target 'all' failed make: *** [all] Error 2 | ||||
| Additional Information | Note that the example code is a bit of a simplified/contrived example. It will work fine if you remove the HAS_CXX property, but real cases also incorporate C/C++ modules and require that libc/libstdc++ be present. icc -V Intel(R) C Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 13.0.0.079 Build 20120731 Copyright (C) 1985-2012 Intel Corporation. All rights reserved. FOR NON-COMMERCIAL USE ONLY | ||||
| Tags | No tags attached. | ||||
| Relationships | |||||
| Attached Files | |||||
| Issue History | |||||
| Date Modified | Username | Field | Change | ||
| 2015-12-06 23:39 | Ben Matthews | New Issue | |||
| 2015-12-07 05:17 | tgallagher | Note Added: 0039957 | |||
| 2015-12-07 05:19 | tgallagher | Note Edited: 0039957 | bug_revision_view_page.php?rev_id=1970 | ||
| 2015-12-07 05:25 | tgallagher | Note Deleted: 0039957 | |||
| 2015-12-07 08:41 | Brad King | Note Added: 0039958 | |||
| 2015-12-07 08:41 | Brad King | Status | new => resolved | ||
| 2015-12-07 08:41 | Brad King | Resolution | open => no change required | ||
| 2016-05-02 08:30 | Robert Maynard | Note Added: 0040979 | |||
| 2016-05-02 08:30 | Robert Maynard | Status | resolved => closed | ||
| Notes | |||||
|
|
|||||
|
|
||||
|
|
|||||
|
|
||||