[CMake] Support of compile features for Fujitsu C++ Compiler

Zehner Paul zehner.paul at jaxa.jp
Wed May 29 02:20:57 EDT 2019


Dear all,

A naive grep tells me the IAR compiler detection sets CMAKE_CXX_LINK_FLAGS
in its compiler detection.

If I use `CMAKE_CXX_LINK_FLAGS`, I have to pass the option manually, which is not convenient. I was looking for something more automatic:

  1.  I set `cxx_std_14` in `target_compile_feature` of my `CMakeLists.txt`;
  2.  Then `CMAKE_CXX14_STANDARD_COMPILE_OPTION` is added to the compiler flags (which is the case);
  3.  Then `CMAKE_CXX14_STANDARD_LINK_OPTION` (or `CMAKE_CXX14_STANDARD_COMPILE_OPTION` by default) is added to the linker flags.

I cannot find in the documentation if such a thing is possible. Is it?

Best regards,


--

Paul Zehner, Ph. D.

Invited Researcher

Numerical Simulation Research Unit

Japan Aerospace Exploration Agency

7-44-1 Jindaiji Higashi-machi, Chofu-shi, Tokyo

182-8522, Japan

Tel. +81-50-3362-7933

Fax. +81-422-40-3327

zehner.paul at jaxa.jp<mailto:zehner.paul at jaxa.jp>

www.jaxa.jp<http://www.jaxa.jp>

________________________________
From: CMake <cmake-bounces at cmake.org> on behalf of Patrick Griffiths <patrick.griffiths at gmail.com>
Sent: Friday, May 24, 2019 21:09
To: cmake at cmake.org
Subject: Re: [CMake] Support of compile features for Fujitsu C++ Compiler

A naive grep tells me the IAR compiler detection sets CMAKE_CXX_LINK_FLAGS
in its compiler detection. Maybe that'd work for you?


On Fri, May 24, 2019 at 3:48 AM Zehner Paul <zehner.paul at jaxa.jp> wrote:

> Hello all,
>
> So, I managed to configure my `Fujitsu-CXX.cmake` file to use the Fujitsu
> C++ compiler with MPI as well. The problem of not detecting headers of the
> STL (like `array`) was due to the fact the C++ standard flag was not set
> correctly.
>
> I am facing another problem though: the linker needs the C++ standard flag
> to be set, which is not something GCC needs. I could not find a way to make
> `CMAKE_CXX**_STANDARD_COMPILE_OPTION` applied to the linker as well. What I
> am missing?
>
> Best regards,
>
> --
>
> *Paul Zehner, Ph. D.*
>
> Invited Researcher
>
> Numerical Simulation Research Unit
>
> *Japan Aerospace Exploration Agency*
>
> *7-44-1 Jindaiji Higashi-machi, Chofu-shi, Tokyo*
>
> *182-8522, Japan*
>
> *Tel. +81-50-3362-7933*
>
> *Fax. +81-422-40-3327*
>
> zehner.paul at jaxa.jp
>
> www.jaxa.jp<http://www.jaxa.jp>
> ------------------------------
> *From:* CMake <cmake-bounces at cmake.org> on behalf of Zehner Paul <
> zehner.paul at jaxa.jp>
> *Sent:* Tuesday, May 14, 2019 11:58
> *To:* Robert Maynard
> *Cc:* cmake at cmake.org
> *Subject:* Re: [CMake] Support of compile features for Fujitsu C++
> Compiler
>
> Robert,
>
> so that all users could benefit from the improved compiler detection :)
> That is my plan! If I can make a compiler module which works well enough,
> I will submit it as a merge request.
>
> Regarding the detection of MPI with FindMPI, I failed to detect the MPI
> compiler using `MPI_CXX_COMPILER_FLAGS`. But using the normal Fujitsu
> compiler binary (not the wrapper) and setting `MPI_CXX_COMPILER`, I can
> detect it.
>
> The problem is now that it does not detect the STL anymore at compiling
> time: "error: namespace "std" has no member "array"" (note that I used to
> build the project with a hand made Makefile, so the source code is valid).
> I checked the `include` directory of the compiler and it contains the Array
> header, though. In other warnings, I clearly see that this `include`
> directory is used. What is wrong here?
>
> Best regards,
>
>
> --
>
> Paul Zehner, Ph. D.
>
> Invited Researcher
>
> Numerical Simulation Research Unit
>
> Japan Aerospace Exploration Agency
>
> 7-44-1 Jindaiji Higashi-machi, Chofu-shi, Tokyo
>
> 182-8522, Japan
>
> Tel. +81-50-3362-7933
>
> Fax. +81-422-40-3327
>
> zehner.paul at jaxa.jp<mailto:zehner.paul at jaxa.jp <zehner.paul at jaxa.jp>>
>
> www.jaxa.jp<http://www.jaxa.jp>
>
> ________________________________
> From: Robert Maynard <robert.maynard at kitware.com>
> Sent: Thursday, May 9, 2019 23:29
> To: Zehner Paul
> Cc: Kai Wolf; cmake at cmake.org
> Subject: Re: [CMake] Support of compile features for Fujitsu C++ Compiler
>
> The goal would be to upstream the compiler changes to cmake so that
> all users could benefit from the improved compiler detection :)
>
> I would look at the FindMPI docs on locating the correct mpi compiler:
>
> https://cmake.org/cmake/help/v3.14/module/FindMPI.html#variables-for-locating-mpi
> . It looks like what you will need to specify is
> MPI_<lang>_COMPILER_FLAGS
>
> On Wed, May 8, 2019 at 10:15 PM Zehner Paul <zehner.paul at jaxa.jp> wrote:
> >
> > Thank you for your answer.
> >
> > This means I have to override
> `/usr/share/cmake/Modules/Compiler/Fujitsu-DetermineCompiler.cmake`? This
> is not unfeasible, but it may seems tricky to my users. Since detecting
> compiler version is not a crucial task, maybe I will keep this file as it
> and concentrate on other ones.
> >
> > Another question I have is regarding MPI. The `find_package(MPI
> REQUIRED)` directive fails with "Could NOT find MPI (missing:
> MPI_CXX_FOUND)". I have no clue on how to help the detection of MPI. The
> compiler I give to CMake is actually an MPI wrapper that only needs one
> argument to enable MPI features. I tried with some exotic-named GCC
> compilers at my lab (which are MPI wrappers as well) and it could detect
> MPI with no problem. Where should I start?
> >
> > Best regards,
> >
> > --
> >
> > Paul Zehner, Ph. D.
> >
> > Invited Researcher
> >
> > Numerical Simulation Research Unit
> >
> > Japan Aerospace Exploration Agency
> >
> > 7-44-1 Jindaiji Higashi-machi, Chofu-shi, Tokyo
> >
> > 182-8522, Japan
> >
> > Tel. +81-50-3362-7933
> >
> > Fax. +81-422-40-3327
> >
> > zehner.paul at jaxa.jp
> >
> > www.jaxa.jp<http://www.jaxa.jp>
> >
> > ________________________________
> > From: Robert Maynard <robert.maynard at kitware.com>
> > Sent: Thursday, May 9, 2019 3:12
> > To: Zehner Paul
> > Cc: Kai Wolf; cmake at cmake.org
> > Subject: Re: [CMake] Support of compile features for Fujitsu C++ Compiler
> >
> > I believe the only way is to have your version of
> > Fujitsu-DetermineCompiler.cmake be installed over the one provided by
> > CMake. When it comes to known compilers CMake explicitly includes the
> > version it ships.
> >
> > On Tue, May 7, 2019 at 11:01 PM Zehner Paul <zehner.paul at jaxa.jp> wrote:
> > >
> > > Robert,
> > >
> > > Thank you for the advice.
> > >
> > > As I want to take account of compiler version, I overrided the
> `Fujitsu-DetermineCompiler.cmake` file by copy-pasting and editing it in
> the folder of `CMAKE_MODULE_PATH`. However, the installation
> `Fujitsu-DetermineCompiler.cmake` file is always used instead. What should
> I do?
> > >
> > > Best regards,
> > >
> > > --
> > >
> > > Paul Zehner, Ph. D.
> > >
> > > Invited Researcher
> > >
> > > Numerical Simulation Research Unit
> > >
> > > Japan Aerospace Exploration Agency
> > >
> > > 7-44-1 Jindaiji Higashi-machi, Chofu-shi, Tokyo
> > >
> > > 182-8522, Japan
> > >
> > > Tel. +81-50-3362-7933
> > >
> > > Fax. +81-422-40-3327
> > >
> > > zehner.paul at jaxa.jp
> > >
> > > www.jaxa.jp<http://www.jaxa.jp>
> > >
> > > ________________________________
> > > From: Robert Maynard <robert.maynard at kitware.com>
> > > Sent: Friday, April 26, 2019 23:32
> > > To: Zehner Paul
> > > Cc: Kai Wolf; cmake at cmake.org
> > > Subject: Re: [CMake] Support of compile features for Fujitsu C++
> Compiler
> > >
> > > For an initial implementation I would base the work on the PGI
> > > compiler module (
> > >
> https://gitlab.kitware.com/cmake/cmake/blob/v3.14.3/Modules/Compiler/PGI-CXX.cmake
> > > ) not the GNU-CXX module.
> > > This will allow you to add a new compiler with only meta-language
> > > flags ( cxx_std_11, cxx_std_14, ... ) and you avoid the complexity of
> > > having to manually build the feature tables.
> > >
> > > On Fri, Apr 26, 2019 at 3:58 AM Zehner Paul <zehner.paul at jaxa.jp>
> wrote:
> > > >
> > > > Kai,
> > > >
> > > >
> > > > Thanks for your answer and for your presentation. So, I will try to
> add support for this Fujitsu compiler. Is there a list of the common
> compile features that I can base me upon? I plan use `GNU-CXX.cmake` as a
> source of inspiration.
> > > >
> > > >
> > > > If I succeed to complete the `Fujitsu-CXX.cmake` file, I will
> propose it as a merge request.
> > > >
> > > >
> > > > --
> > > >
> > > > Paul Zehner, Ph. D.
> > > >
> > > > Invited Researcher
> > > >
> > > > Numerical Simulation Research Unit
> > > >
> > > > Japan Aerospace Exploration Agency
> > > >
> > > > 7-44-1 Jindaiji Higashi-machi, Chofu-shi, Tokyo
> > > >
> > > > 182-8522, Japan
> > > >
> > > > Tel. +81-50-3362-7933
> > > >
> > > > Fax. +81-422-40-3327
> > > >
> > > > zehner.paul at jaxa.jp
> > > >
> > > > www.jaxa.jp<http://www.jaxa.jp>
> > > >
> > > >
> > > >
> > > > ________________________________
> > > > From: Kai Wolf <kai.wolf at gmail.com>
> > > > Sent: Friday, April 26, 2019 16:22
> > > > To: Zehner Paul
> > > > Cc: cmake at cmake.org
> > > > Subject: Re: [CMake] Support of compile features for Fujitsu C++
> Compiler
> > > >
> > > > If you want to add support to your specific compiler, you could add
> or extend another Fujitsu-DetermineCompiler.cmake
> > > > file and append your CMAKE_MODULE_PATH in order to CMake to find it.
> You probably also need to adjust
> > > > *Fujitsu-CXX.cmake, Fujitsu-CXX-FeatureTests.cmake and so on.
> > > >
> > > > I gave a talk a few years ago that shortly explains the whole
> process of CMake initialization and compiler verification which
> > > > you can find here:
> https://github.com/NewProggie/Talks/blob/master/2017-06-dep-management-with-cmake-MUC%2B%2B.pdf
> > > >
> > > >
> > > > Greetings,
> > > >
> > > > Kai
> > > >
> > > > http://kai-wolf.me
> > > > http://effective-cmake.com
> > > >
> > > > Am 26.04.2019 um 07:35 schrieb Zehner Paul <zehner.paul at jaxa.jp>:
> > > >
> > > > Hello Cmake community,
> > > >
> > > > I would like to use Cmake to build research simulation programs in a
> Fujitsu supercomputer environment. Unfortunately, it seems that Cmake
> (version 3.14) does not support any compile feature for the Fujitsu C++
> compiler (FCCpx, version 2.0.0 P-id: T01815-02 (Jul 12 2018 13:13:18)). I
> add I am pretty new to Cmake. Searching for similar issues, I found only
> this [thread](
> https://cmake.org/pipermail/cmake-developers/2014-August/010989.html),
> which talk about basic support of the compiler.
> > > >
> > > > I tested it on a simple project, and the line:
> > > >
> > > > ```cmake
> > > > target_compile_features(test PUBLIC cxx_std_11)
> > > > ```
> > > >
> > > > fails with this message:
> > > >
> > > > ```
> > > > CMake Error at CMakeLists.txt:15 (target_compile_features):
> > > >   target_compile_features no known features for CXX compiler
> > > >
> > > >   "Fujitsu"
> > > >
> > > >   version .
> > > >
> > > > ```
> > > >
> > > > So, it seems that the compiler is detected (without its version),
> but compile features are not known. To be sure, I ran this simple test to
> list any supported features:
> > > >
> > > > ```cmake
> > > > cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
> > > > project(foobar CXX)
> > > > message("Your C++ compiler supports these C++ features:")
> > > > foreach(i ${CMAKE_CXX_COMPILE_FEATURES})
> > > >     message("${i}")
> > > > endforeach()
> > > > ```
> > > >
> > > > and no feature are listed.
> > > >
> > > > So, what should I do from now on? Are there some people here using
> Cmake with Fujitsu who could help me? Should I propose a patch with the
> different compile features of the compiler? Or should I address it to
> Fujitsu?
> > > >
> > > > Thanks for your help,
> > > >
> > > > --
> > > > Paul Zehner, Ph. D.
> > > > Invited Researcher
> > > > Numerical Simulation Research Unit
> > > > Japan Aerospace Exploration Agency
> > > > 7-44-1 Jindaiji Higashi-machi, Chofu-shi, Tokyo
> > > > 182-8522, Japan
> > > > Tel. +81-50-3362-7933
> > > > Fax. +81-422-40-3327
> > > > zehner.paul at jaxa.jp
> > > > www.jaxa.jp<http://www.jaxa.jp>
> > > > --
> > > >
> > > > Powered by www.kitware.com<http://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:
> > > > https://cmake.org/mailman/listinfo/cmake
> > > >
> > > >
> > > > --
> > > >
> > > > Powered by www.kitware.com<http://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:
> > > > https://cmake.org/mailman/listinfo/cmake
> --
>
> Powered by www.kitware.com<http://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:
> https://cmake.org/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20190529/6e13fe02/attachment-0001.html>


More information about the CMake mailing list