View Issue Details [ Jump to Notes ] | [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
0014567 | CMake | Modules | public | 2013-11-13 12:48 | 2014-06-02 08:37 | ||||
Reporter | Daniel Landau | ||||||||
Assigned To | Rolf Eike Beer | ||||||||
Priority | low | Severity | tweak | Reproducibility | always | ||||
Status | closed | Resolution | fixed | ||||||
Platform | OS | OS Version | |||||||
Product Version | CMake 2.8.12 | ||||||||
Target Version | CMake 3.0 | Fixed in Version | CMake 3.0 | ||||||
Summary | 0014567: FindOpenMP is incorrect for compilers that accept OpenMP with no flags | ||||||||
Description | The CMake FindOpenMP.cmake module tries several flags in order to find out which one is supported by the compiler. The way it does it is seems to be by testing whether a compilation returns a successful exit status. The overall effect is that since "-openmp" is tested for before " ", the former gets chosen as the flag for OpenMP when the compiler doesn't require any. The practical problem here is that the compiler that accepts "-openmp" without intending for it to signify OpenMP interpretes that as "-o penmp". This is not as big a problem as it first sounds, because CMake usually includes another -o flag later in the command line. In fact, I couldn't produce a small test case where this would lead to problems. It does lead to problems in the real word case of molecular dynamics software Gromacs (http://www.gromacs.org/ [^]), where some linking steps get generated with the order of first the intended -o flag and later -openmp. A simple fix is to simply swap the order of testing for no flag (" ") and "-openmp". | ||||||||
Steps To Reproduce | Any simple CMakeLists.txt with OpenMP and a compiler that accepts OpenMP without flags (I used the Cray compiler) will produce compilation commands with -openmp, but I couldn't generate a small test case where that leads to explicit problems. | ||||||||
Tags | No tags attached. | ||||||||
Attached Files | 0001-FindOpenMP-fix-detecting-compilers-that-do-not-need-.patch [^] (1,632 bytes) 2013-11-13 14:32 [Show Content] | ||||||||
Relationships | |
Relationships |
Notes | |
(0034447) Rolf Eike Beer (developer) 2013-11-13 14:32 |
Could you please try the attached patch. |
(0034449) Daniel Landau (reporter) 2013-11-13 14:59 |
The patch as it stands fails. If I add a space between the quotes in both places it works. Outputs with both versions: no space: -- Try OpenMP C flag = [] -- Performing Test OpenMP_FLAG_DETECTED -- Performing Test OpenMP_FLAG_DETECTED - Success -- Try OpenMP CXX flag = [-fopenmp] -- Performing Test OpenMP_FLAG_DETECTED -- Performing Test OpenMP_FLAG_DETECTED - Failed -- Try OpenMP CXX flag = [/openmp] -- Performing Test OpenMP_FLAG_DETECTED -- Performing Test OpenMP_FLAG_DETECTED - Failed -- Try OpenMP CXX flag = [-Qopenmp] -- Performing Test OpenMP_FLAG_DETECTED -- Performing Test OpenMP_FLAG_DETECTED - Failed -- Try OpenMP CXX flag = [-openmp] -- Performing Test OpenMP_FLAG_DETECTED -- Performing Test OpenMP_FLAG_DETECTED - Success -- Could NOT find OpenMP (missing: OpenMP_C_FLAGS) space: -- Try OpenMP C flag = [ ] -- Performing Test OpenMP_FLAG_DETECTED -- Performing Test OpenMP_FLAG_DETECTED - Success -- Try OpenMP CXX flag = [ ] -- Performing Test OpenMP_FLAG_DETECTED -- Performing Test OpenMP_FLAG_DETECTED - Success -- Found OpenMP: I'm not terribly experienced with CMake, but is an empty string considered a false value? |
(0034450) Rolf Eike Beer (developer) 2013-11-13 15:44 |
Yes it is. I'm wondering why it hadn't worked for the C++ compiler in the first test. But anyway, thanks for testing. Can you run a CMake dashboard using the cray compiler? We don't have any regular submissions using that compiler, so there could be other things going wrong. Fix pushed to next: http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ebf70b037ddc45941c3ad2152622fd7326517c1e [^] |
(0036012) Robert Maynard (manager) 2014-06-02 08:37 |
Closing resolved issues that have not been updated in more than 4 months. |
Notes |
Issue History | |||
Date Modified | Username | Field | Change |
2013-11-13 12:48 | Daniel Landau | New Issue | |
2013-11-13 14:32 | Rolf Eike Beer | File Added: 0001-FindOpenMP-fix-detecting-compilers-that-do-not-need-.patch | |
2013-11-13 14:32 | Rolf Eike Beer | Note Added: 0034447 | |
2013-11-13 14:59 | Daniel Landau | Note Added: 0034449 | |
2013-11-13 15:44 | Rolf Eike Beer | Note Added: 0034450 | |
2013-11-13 15:44 | Rolf Eike Beer | Assigned To | => Rolf Eike Beer |
2013-11-13 15:44 | Rolf Eike Beer | Status | new => resolved |
2013-11-13 15:44 | Rolf Eike Beer | Resolution | open => fixed |
2013-11-13 15:44 | Rolf Eike Beer | Fixed in Version | => CMake 3.0 |
2013-11-13 15:44 | Rolf Eike Beer | Target Version | => CMake 3.0 |
2014-06-02 08:37 | Robert Maynard | Note Added: 0036012 | |
2014-06-02 08:37 | Robert Maynard | Status | resolved => closed |
Issue History |
Copyright © 2000 - 2018 MantisBT Team |