[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cmake
Subject:    [CMake] Bug in Kitware's release of Ninja when compiling with PGI Fortran
From:       Daniel Carrera <dcarrera () gmail ! com>
Date:       2016-12-14 2:26:54
Message-ID: CAEaabNifvMYLte7P4dNyU62V88hjrNch82yLhAVa=7Jhe4VPVA () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hello,

First of all, I want to say that I think it's amazing that Kitware has gone
through the trouble of maintaining a separate build of Ninja with bugfixes
so that us Fortran users can use Ninja with CMake:


https://github.com/Kitware/ninja/releases


Since no good deed goes unpunished... I want to report that this release of
Ninja doesn't seem to like the PGI compiler. Let me show you. I have a toy
project with just two files:

- CMakeLists.txt
- src/foo.f90


Where foo.f90 is a toy program that adds two integers, and CMakeLists.tx
contains the bare minimum:

--------------------------
$ cat CMakeLists.txt
cmake_minimum_required(VERSION 3.7)

project(hello)
enable_language(Fortran)

add_executable(prog src/foo.f90)
--------------------------

At this point I should say that I am running CMake 3.7.1 freshly downloaded
from cmake.org and my OS is Ubuntu Linux 16.04 LTS. So anyway, if we
produce Makefiles everything is fine:

--------------------------
$ mkdir build
$ cd build
build $ echo $FC   # <---- PGI compiler.
pgfortran

build $ cmake ..
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- The Fortran compiler identification is PGI 16.10.0
-- Check for working Fortran compiler: /usr/local/bin/pgfortran
-- Check for working Fortran compiler: /usr/local/bin/pgfortran  -- works
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Checking whether /usr/local/bin/pgfortran supports Fortran 90
-- Checking whether /usr/local/bin/pgfortran supports Fortran 90 -- yes
-- Configuring done
-- Generating done
-- Build files have been written to: <snip>/build
--------------------------

But when I ask CMake to make Ninja files, I have a problem:


--------------------------
build $ rm -rf [a-zA-Z]*
build $ cmake -GNinja ..
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- The Fortran compiler identification is PGI 16.10.0
-- Check for working Fortran compiler: /usr/local/bin/pgfortran
CMake Error: Error required internal CMake variable not set, cmake may be
not be built correctly.
Missing variable is:
CMAKE_Fortran_PREPROCESS_SOURCE
CMake Error: Internal CMake error, TryCompile generation of cmake failed
-- Check for working Fortran compiler: /usr/local/bin/pgfortran  -- broken
CMake Error at
/opt/cmake-3.7.1-Linux-x86_64/share/cmake-3.7/Modules/CMakeTestFortranCompiler.cmake:44
(message):
  The Fortran compiler "/usr/local/bin/pgfortran" is not able to compile a
  simple test program.

  It fails with the following output:





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


-- Configuring incomplete, errors occurred!
See also "<snip>/build/CMakeFiles/CMakeOutput.log".
See also "<snip>/build/CMakeFiles/CMakeError.log".
--------------------------

I have attached CMakeError.log and CMakeOutput.log inside the Zip file
"CMakeFiles.zip". I looked at the log files and I didn't see anything
informative. This problem only occurs with the PGI compiler. CMake+Ninja
seem to work just fine for the GNU and Intel compilers.

I have verified that I can compile Fortran programs with the PGI compiler.
The PGI compiler is also a very recent download from their website. I'm
using the free "Community Edition" compiler.

I hope this helps someone find a fix so that CMake+Ninja works even better.
Once again, thank you for going through the trouble of patching somebody
else's source tree just to give me another feature.

Cheers,
Daniel.

[Attachment #5 (text/html)]

<div dir="ltr">Hello,<div><br></div><div>First of all, I want to say that I think \
it&#39;s amazing that Kitware has gone through the trouble of maintaining a separate \
build of Ninja with bugfixes so that us Fortran users can use Ninja with \
CMake:<br><div><br></div><div><br></div><div><a \
href="https://github.com/Kitware/ninja/releases">https://github.com/Kitware/ninja/releases</a><br></div><div><br></div><div><br></div><div>Since \
no good deed goes unpunished... I want to report that this release of Ninja \
doesn&#39;t seem to like the PGI compiler. Let me show you. I have a toy project with \
just two files:</div></div><div><br></div><div>- CMakeLists.txt<br></div><div>- \
src/foo.f90</div><div><br></div><div><br></div><div>Where foo.f90 is a toy program \
that adds two integers, and CMakeLists.tx contains the bare \
minimum:</div><div><br></div><div><div>--------------------------</div><div>$ cat \
CMakeLists.txt  </div><div>cmake_minimum_required(VERSION \
3.7)</div><div><br></div><div>project(hello)</div><div>enable_language(Fortran)</div><div><br></div><div>add_executable(prog \
src/foo.f90)</div></div><div>--------------------------</div><div><br></div><div>At \
this point I should say that I am running CMake 3.7.1 freshly downloaded from <a \
href="http://cmake.org">cmake.org</a> and my OS is Ubuntu Linux 16.04 LTS. So anyway, \
if we produce Makefiles everything is \
fine:</div><div><br></div><div><div>--------------------------</div><div>$ mkdir \
build</div><div>$ cd build</div><div><div>build $ echo $FC    # &lt;---- PGI \
compiler.</div><div>pgfortran</div></div><div><br></div><div>build $ cmake \
..</div><div>-- The C compiler identification is GNU 5.4.0</div><div>-- The CXX \
compiler identification is GNU 5.4.0</div><div>-- Check for working C compiler: \
/usr/bin/cc</div><div>-- Check for working C compiler: /usr/bin/cc -- \
works</div><div>-- Detecting C compiler ABI info</div><div>-- Detecting C compiler \
ABI info - done</div><div>-- Detecting C compile features</div><div>-- Detecting C \
compile features - done</div><div>-- Check for working CXX compiler: \
/usr/bin/c++</div><div>-- Check for working CXX compiler: /usr/bin/c++ -- \
works</div><div>-- Detecting CXX compiler ABI info</div><div>-- Detecting CXX \
compiler ABI info - done</div><div>-- Detecting CXX compile features</div><div>-- \
Detecting CXX compile features - done</div><div>-- The Fortran compiler \
identification is PGI 16.10.0</div><div>-- Check for working Fortran compiler: \
/usr/local/bin/pgfortran</div><div>-- Check for working Fortran compiler: \
/usr/local/bin/pgfortran   -- works</div><div>-- Detecting Fortran compiler ABI \
info</div><div>-- Detecting Fortran compiler ABI info - done</div><div>-- Checking \
whether /usr/local/bin/pgfortran supports Fortran 90</div><div>-- Checking whether \
/usr/local/bin/pgfortran supports Fortran 90 -- yes</div><div>-- Configuring \
done</div><div>-- Generating done</div><div>-- Build files have been written to: \
&lt;snip&gt;/build</div></div><div><div>--------------------------</div></div><div><br></div><div>But \
when I ask CMake to make Ninja files, I have a \
problem:</div><div><br></div><div><br></div><div><div>--------------------------</div><div>build \
$ rm -rf [a-zA-Z]*</div><div>build $ cmake -GNinja ..</div><div>-- The C compiler \
identification is GNU 5.4.0</div><div>-- The CXX compiler identification is GNU \
5.4.0</div><div>-- Check for working C compiler: /usr/bin/cc</div><div>-- Check for \
working C compiler: /usr/bin/cc -- works</div><div>-- Detecting C compiler ABI \
info</div><div>-- Detecting C compiler ABI info - done</div><div>-- Detecting C \
compile features</div><div>-- Detecting C compile features - done</div><div>-- Check \
for working CXX compiler: /usr/bin/c++</div><div>-- Check for working CXX compiler: \
/usr/bin/c++ -- works</div><div>-- Detecting CXX compiler ABI info</div><div>-- \
Detecting CXX compiler ABI info - done</div><div>-- Detecting CXX compile \
features</div><div>-- Detecting CXX compile features - done</div><div>-- The Fortran \
compiler identification is PGI 16.10.0</div><div>-- Check for working Fortran \
compiler: /usr/local/bin/pgfortran</div><div>CMake Error: Error required internal \
CMake variable not set, cmake may be not be built correctly.</div><div>Missing \
variable is:</div><div>CMAKE_Fortran_PREPROCESS_SOURCE</div><div>CMake Error: \
Internal CMake error, TryCompile generation of cmake failed</div><div>-- Check for \
working Fortran compiler: /usr/local/bin/pgfortran   -- broken</div><div>CMake Error \
at /opt/cmake-3.7.1-Linux-x86_64/share/cmake-3.7/Modules/CMakeTestFortranCompiler.cmake:44 \
(message):</div><div>   The Fortran compiler &quot;/usr/local/bin/pgfortran&quot; is \
not able to compile a</div><div>   simple test program.</div><div><br></div><div>   \
It fails with the following output:</div><div><div><br></div></div><div>     \
</div><div><br></div><div>    </div><div><br></div><div>   CMake will not be able to \
correctly generate this project.</div><div>Call Stack (most recent call \
first):</div><div>   CMakeLists.txt:4 \
(enable_language)</div><div><br></div><div><br></div><div>-- Configuring incomplete, \
errors occurred!</div><div>See also \
&quot;&lt;snip&gt;/build/CMakeFiles/CMakeOutput.log&quot;.</div><div>See also \
&quot;&lt;snip&gt;/build/CMakeFiles/CMakeError.log&quot;.</div></div><div><div>--------------------------</div></div><div><br></div><div>I \
have attached CMakeError.log and CMakeOutput.log inside the Zip file \
&quot;CMakeFiles.zip&quot;. I looked at the log files and I didn&#39;t see anything \
informative. This problem only occurs with the PGI compiler. CMake+Ninja seem to work \
just fine for the GNU and Intel compilers.</div><div><br></div><div>I have verified \
that I can compile Fortran programs with the PGI compiler. The PGI compiler is also a \
very recent download from their website. I&#39;m using the free &quot;Community \
Edition&quot; compiler.</div><div><br></div><div>I hope this helps someone find a fix \
so that CMake+Ninja works even better. Once again, thank you for going through the \
trouble of patching somebody else&#39;s source tree just to give me another \
feature.</div><div><br></div><div>Cheers,</div><div>Daniel.</div><div><br></div></div>


--001a1144551802f1d6054395124a--


["CMakeFiles.zip" (application/zip)]

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: \
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information \
on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at \
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic