View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0015460CMakeCMakepublic2015-03-19 11:022015-11-02 09:13
ReporterTiago Quintino 
Assigned To 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionfixed 
PlatformLinuxOSOpensuseOS Version13.1
Product Version 
Target VersionCMake 3.3Fixed in VersionCMake 3.3 
Summary0015460: PGI Fortran compiler does not recognise -fPIE
DescriptionBy selecting POSITION_INDEPENDENT_CODE the PGI compiler settings add automatically the flag -fPIE.
This flag does not exist for PGI Fortran Compiler.
I have checked this with pgf77, pgf90 and pgfortran.

The only workaround I found is to set the flag:

-DCMAKE_Fortran_FLAGS="-noswitcherror"

This turns off the check for flag validity in the compiler, but obviously is not a long-term solution, since now any test to compiler flags will pass irrespectively if the flag is recognised or not.

The solution I think is changing Modules/Platform/Linux-PGI.cmake to:

set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "")

Note that the flag -fPIE also does not exist for PGI C and C++ compilers.


Steps To ReproduceBuild the attached CMakeLists.txt project with

cmake -DCMAKE_Fortran_COMPILER=pgf90 ..

Additional InformationI am using CMake 3.1.2 and PGI Fortran 14.4.
The man page of compiler does not reference this flag whatsoever.
This is the output I get:

-- The C compiler identification is GNU 4.8.1
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- The Fortran compiler identification is PGI
-- Check for working Fortran compiler: /usr/local/apps/pgi/14.4/bin/pgf90
-- Check for working Fortran compiler: /usr/local/apps/pgi/14.4/bin/pgf90 -- broken
CMake Error at /usr/local/apps/cmake/3.1.2/share/cmake-3.1/Modules/CMakeTestFortranCompiler.cmake:54 (message):
  The Fortran compiler "/usr/local/apps/pgi/14.4/bin/pgf90" is not able to
  compile a simple test program.

  It fails with the following output:

   Change Dir: /home/ma/matq/git/cmake-test/pgi-pie/build/CMakeFiles/CMakeTmp

  

  Run Build Command:"/usr/bin/gmake" "cmTryCompileExec951442437/fast"

  gmake: Warning: File `Makefile' has modification time 1.9 s in the future

  /usr/bin/gmake -f CMakeFiles/cmTryCompileExec951442437.dir/build.make
  CMakeFiles/cmTryCompileExec951442437.dir/build

  gmake[1]: Entering directory
  `/home/ma/matq/git/cmake-test/pgi-pie/build/CMakeFiles/CMakeTmp'

  gmake[1]: Warning: File
  `CMakeFiles/cmTryCompileExec951442437.dir/flags.make' has modification time
  1.9 s in the future

  /usr/local/apps/cmake/3.1.2/bin/cmake -E cmake_progress_report
  /home/ma/matq/git/cmake-test/pgi-pie/build/CMakeFiles/CMakeTmp/CMakeFiles 1

  Building Fortran object
  CMakeFiles/cmTryCompileExec951442437.dir/testFortranCompiler.f.o

  /usr/local/apps/pgi/14.4/bin/pgf90 -Mpreprocess -Kieee -fPIE -c
  /home/ma/matq/git/cmake-test/pgi-pie/build/CMakeFiles/CMakeTmp/testFortranCompiler.f
  -o CMakeFiles/cmTryCompileExec951442437.dir/testFortranCompiler.f.o

  pgf90-Error-Unknown switch: -fPIE

  gmake[1]: ***
  [CMakeFiles/cmTryCompileExec951442437.dir/testFortranCompiler.f.o] Error 1

  gmake[1]: Leaving directory
  `/home/ma/matq/git/cmake-test/pgi-pie/build/CMakeFiles/CMakeTmp'

  gmake: *** [cmTryCompileExec951442437/fast] Error 2

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

TagsNo tags attached.
Attached Filestxt file icon CMakeLists.txt [^] (142 bytes) 2015-03-19 11:02 [Show Content]

 Relationships

  Notes
(0038266)
Brad King (manager)
2015-03-20 13:02

Okay, thanks. Fixed:

 PGI: Remove invalid -fPIE flag
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=00842df4 [^]
(0039741)
Robert Maynard (manager)
2015-11-02 09:13

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2015-03-19 11:02 Tiago Quintino New Issue
2015-03-19 11:02 Tiago Quintino File Added: CMakeLists.txt
2015-03-20 13:02 Brad King Note Added: 0038266
2015-03-20 13:02 Brad King Status new => resolved
2015-03-20 13:02 Brad King Resolution open => fixed
2015-03-20 13:02 Brad King Fixed in Version => CMake 3.3
2015-03-20 13:02 Brad King Target Version => CMake 3.3
2015-11-02 09:13 Robert Maynard Note Added: 0039741
2015-11-02 09:13 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team