# How do you intend to build the Fortran stdlib?

**URL:** <https://fortran-lang.discourse.group/t/how-do-you-intend-to-build-the-fortran-stdlib/1862>\
**Category:** Poll\
**Created:** [September 17, 2021, 2:11pm UTC](https://fortran-lang.discourse.group/t/how-do-you-intend-to-build-the-fortran-stdlib/1862 "2021-09-17T14:11:44Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![milancurcic](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/milancurcic/32/2_2.png) [@milancurcic](https://fortran-lang.discourse.group/u/milancurcic)\
**Post date:** [September 17, 2021, 2:11pm UTC](https://fortran-lang.discourse.group/t/how-do-you-intend-to-build-the-fortran-stdlib/1862/1 "2021-09-17T14:11:45Z")

</div>

See [#526](https://github.com/fortran-lang/stdlib/issues/526) for context. We’d like to decide whether it’s worth it to continue maintaining manual Makefiles for building Fortran stdlib.

Which system do you use, or plan to use in the future, to build the Fortran stdlib?

_Poll ([view on site](https://fortran-lang.discourse.group/t/how-do-you-intend-to-build-the-fortran-stdlib/1862/1))_

---

<div class="post-metadata">

**Author:** ![Beliavsky](https://avatars.discourse-cdn.com/v4/letter/b/ba8739/32.png) [@Beliavsky](https://fortran-lang.discourse.group/u/Beliavsky)\
**Post date:** [September 17, 2021, 2:33pm UTC](https://fortran-lang.discourse.group/t/how-do-you-intend-to-build-the-fortran-stdlib/1862/2 "2021-09-17T14:33:25Z")

</div>

I avoid CMake on Windows, where trying to get it to work has been an [exercise in frustration](https://fortran-lang.discourse.group/t/why-should-i-use-cmake/953/2). I can use fpm or a manual makefile on Windows. I like having both options, but I don’t know how much work goes into maintaining the manual make files.

---

<div class="post-metadata">

**Author:** ![zoziha](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/zoziha/32/582_2.png) [@zoziha](https://fortran-lang.discourse.group/u/zoziha)\
**Post date:** [September 17, 2021, 3:27pm UTC](https://fortran-lang.discourse.group/t/how-do-you-intend-to-build-the-fortran-stdlib/1862/3 "2021-09-17T15:27:24Z")

</div>

From the cross-platform and cross-compiler point of view, the makefile does not seem to be flexible enough.  
CMake is a good choice.  
The interesting thing is that [xmake-io/xmake: 🔥 A cross-platform build utility based on Lua (github.com)](https://github.com/xmake-io/xmake) also supports compiling fortran code, description:  
Compared with makefile/CMakeLists.txt, the configuration syntax is more concise and intuitive. It is very friendly to novices and can quickly get started in a short time. Let users focus more on actual project development.

---

<div class="post-metadata">

**Author:** ![awvwgk](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/awvwgk/32/154_2.png) [@awvwgk](https://fortran-lang.discourse.group/u/awvwgk)\
**Post date:** [September 17, 2021, 9:05pm UTC](https://fortran-lang.discourse.group/t/how-do-you-intend-to-build-the-fortran-stdlib/1862/4 "2021-09-17T21:05:01Z")

</div>

> [@Beliavsky](#):
>
> I avoid CMake on Windows, where trying to get it to work has been an [exercise in frustration](https://fortran-lang.discourse.group/t/why-should-i-use-cmake/953/2). I can use fpm or a manual makefile on Windows. I like having both options, but I don’t know how much work goes into maintaining the manual make files.

You probably referring to

> <https://github.com/fortran-lang/stdlib/issues/328>
>
> This is not a stdlib-specific problem, but others may encounter the same obstacl…e. When I try to build stdlib using cmake on Windows, I get the following problem. How do I tell cmake to use gfortran and specify its location? I see discussion of this problem \[here\](https://gitlab.kitware.com/cmake/cmake/-/issues/16250) but don't see a resolution.
> 
> c:\\fortran\\public\_domain\\github\\stdlib\_20210302\>gfortran --version
> GNU Fortran (GCC) 11.0.0 20200927 (experimental)
> Copyright (C) 2020 Free Software Foundation, Inc.
> This is free software; see the source for copying conditions. There is NO
> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
> 
> 
> c:\\fortran\\public\_domain\\github\\stdlib\_20210302\>cmake -B build
> \-- Selecting Windows SDK version 10.0.17763.0 to target Windows 10.0.21322.
> \-- The Fortran compiler identification is unknown
> CMake Error at CMakeLists.txt:2 (project):
> No CMAKE\_Fortran\_COMPILER could be found.
> 
> 
> 
> \-- Configuring incomplete, errors occurred!
> See also "C:/fortran/public\_domain/github/stdlib\_20210302/build/CMakeFiles/CMakeOutput.log".
> See also "C:/fortran/public\_domain/github/stdlib\_20210302/build/CMakeFiles/CMakeError.log".

The the issue seems that CMake’s default build backend on Windows are VS project files, but those are hardly a good fit to build a Fortran project unfortunately. I have switched to [ninja](https://ninja-build.org/) as build backend for all platforms with CMake (use `-G Ninja` in the configure stage or `export CMAKE_GENERATOR=Ninja` in your bash profile). Also, if CMake is not picking up the Fortran compiler correctly, you can set the environment variable `FC` with the absolute path to your Fortran compiler to give CMake the correct hint.

---

<div class="post-metadata">

**Author:** ![hsnyder](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/hsnyder/32/747_2.png) [@hsnyder](https://fortran-lang.discourse.group/u/hsnyder)\
**Post date:** [September 18, 2021, 12:12am UTC](https://fortran-lang.discourse.group/t/how-do-you-intend-to-build-the-fortran-stdlib/1862/5 "2021-09-18T00:12:11Z")

</div>

I use the makefile (CMake and I really don’t get along). I actually didn’t know that stdlib supported fpm (or would it be the other way around), is that a somewhat recent development?

---

<div class="post-metadata">

**Author:** ![awvwgk](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/awvwgk/32/154_2.png) [@awvwgk](https://fortran-lang.discourse.group/u/awvwgk)\
**Post date:** [September 18, 2021, 7:03am UTC](https://fortran-lang.discourse.group/t/how-do-you-intend-to-build-the-fortran-stdlib/1862/6 "2021-09-18T07:03:44Z")

</div>

@hsnyder support for fpm in the stdlib main repository is a very recent addition, it’s only present since two days now. This change is also the motivation to reevaluate the supported build systems for stdlib.

---

<div class="post-metadata">

**Author:** ![gareth](https://avatars.discourse-cdn.com/v4/letter/g/ba8739/32.png) [@gareth](https://fortran-lang.discourse.group/u/gareth)\
**Post date:** [September 18, 2021, 7:33am UTC](https://fortran-lang.discourse.group/t/how-do-you-intend-to-build-the-fortran-stdlib/1862/7 "2021-09-18T07:33:34Z")

</div>

To build `stdlib`, I use CMake as described in the README. But I don’t understand it (e.g. expect I would struggle if I had to change anything).

To compile programs that use stdlib, I use either makefiles or shell-scripts that refer to `STDLIB_CFLAGS` and `STDLIB_LIBS`.

---

<div class="post-metadata">

**Author:** ![zoziha](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/zoziha/32/582_2.png) [@zoziha](https://fortran-lang.discourse.group/u/zoziha)\
**Post date:** [September 18, 2021, 11:55am UTC](https://fortran-lang.discourse.group/t/how-do-you-intend-to-build-the-fortran-stdlib/1862/8 "2021-09-18T11:55:40Z")

</div>

From the perspective of stdlib development, it seems that we should stop using makefiles. I also think that there are many configuration files for makefiles and CMake, and they are really tiring. (We are prone to omissions, leading to CI failure)

From the user’s point of view, it seems that make is simpler, just `make -f Makefile.manual FYPPFLAGS=-DMAXRANK=4`. In fact, I don’t know CMake very well, I just can simply compile the code. But for some people who have never contacted CMake and fpm, using them requires simple tutorials. Otherwise, all they can do is: compile fails and stop trying stdlib.

Once we decide to stop supporting makefiles, we need to find a way to explain CMake’s instructions for compiling stdlib to be more **user-friendly**.  
Wait for the time to come, and encourage users to use fpm to compile stdlib. (fpm is very simple, but it is a new thing and users need to adapt.) (I believe that as the fortran-lang community grows, Fortraner will gradually know fpm enough)

To say something naive, who can even record an instructional video, briefly introduce fpm and stdlib, and conduct compiling teaching. Put the link of the video on the README.md or fortran-lang official website. 😁

---

<div class="post-metadata">

**Author:** ![epagone](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/epagone/32/252_2.png) [@epagone](https://fortran-lang.discourse.group/u/epagone)\
**Post date:** [September 18, 2021, 12:07pm UTC](https://fortran-lang.discourse.group/t/how-do-you-intend-to-build-the-fortran-stdlib/1862/9 "2021-09-18T12:07:24Z")

</div>

Sorry for nitpicking, but I have two problems with this poll and, in particular, with this question

> [@milancurcic](#):
>
> Which system do you use, or plan to use in the future, to build the Fortran stdlib?

1. It does not align with the title that seem to ask how do I build _now_ or _usually_ `stdlib` (_not_ in the future).
2. IMO it is ambiguous: I used both the `make` and `CMake` but now that I can use `fpm` I will definitely start using it as my only tool (BTW many many thanks for doing it! 👏 )

---

<div class="post-metadata">

**Author:** ![Beliavsky](https://avatars.discourse-cdn.com/v4/letter/b/ba8739/32.png) [@Beliavsky](https://fortran-lang.discourse.group/u/Beliavsky)\
**Post date:** [September 18, 2021, 12:10pm UTC](https://fortran-lang.discourse.group/t/how-do-you-intend-to-build-the-fortran-stdlib/1862/10 "2021-09-18T12:10:58Z")

</div>

> [@zoziha](#):
>
> To say something naive, who can even record an instructional video, briefly introduce fpm and stdlib, and conduct compiling teaching. Put the link of the video on the README.md or fortran-lang official website. 😁

There is a video [Fortran Package Manager (fpm) for Visual Studio](https://www.youtube.com/watch?v=FSTXETFZIg8) by @everythingfunctional . FortranCon will be held online on Sep 23-24, and @nshaffer will give a talk on [What’s new in the Fortran Standard Library?](https://tcevents.chem.uzh.ch/event/14/contributions/65/). The video last year’s talk on stdlib is [online](https://www.youtube.com/watch?v=qIZ0woAZ28k).

---

<div class="post-metadata">

**Author:** ![milancurcic](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/milancurcic/32/2_2.png) [@milancurcic](https://fortran-lang.discourse.group/u/milancurcic)\
**Post date:** [September 18, 2021, 12:21pm UTC](https://fortran-lang.discourse.group/t/how-do-you-intend-to-build-the-fortran-stdlib/1862/11 "2021-09-18T12:21:10Z")

</div>

> [@epagone](#):
>
> It does not align with the title that seem to ask how do I build _now_ or _usually_ `stdlib` ( _not_ in the future).

Thanks @epagone, I edited the title, how is it now?

---

<div class="post-metadata">

**Author:** ![epagone](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/epagone/32/252_2.png) [@epagone](https://fortran-lang.discourse.group/u/epagone)\
**Post date:** [September 18, 2021, 12:26pm UTC](https://fortran-lang.discourse.group/t/how-do-you-intend-to-build-the-fortran-stdlib/1862/12 "2021-09-18T12:26:22Z")

</div>

It is perfect, thanks for considering my comment (and apologies for my OCD 🤭)

---

<div class="post-metadata">

**Author:** ![hsnyder](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/hsnyder/32/747_2.png) [@hsnyder](https://fortran-lang.discourse.group/u/hsnyder)\
**Post date:** [September 18, 2021, 2:39pm UTC](https://fortran-lang.discourse.group/t/how-do-you-intend-to-build-the-fortran-stdlib/1862/13 "2021-09-18T14:39:21Z")

</div>

How was the use of fypp addressed in the FPM version? It looks like it was just rendered out and committed, is that right?

---

<div class="post-metadata">

**Author:** ![zoziha](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/zoziha/32/582_2.png) [@zoziha](https://fortran-lang.discourse.group/u/zoziha)\
**Post date:** [September 18, 2021, 3:02pm UTC](https://fortran-lang.discourse.group/t/how-do-you-intend-to-build-the-fortran-stdlib/1862/14 "2021-09-18T15:02:50Z")

</div>

Now it is the stdlib-fpm branch implemented through [GitHub-CI/CD](https://github.com/fortran-lang/stdlib/pull/508), see [build with fpm](https://github.com/fortran-lang/stdlib#build-with-fortran-langfpm) and [stdlib-fpm branch](https://github.com/fortran-lang/stdlib/tree/stdlib-fpm).

---

<div class="post-metadata">

**Author:** ![certik](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/certik/32/4_2.png) [@certik](https://fortran-lang.discourse.group/u/certik)\
**Post date:** [September 18, 2021, 4:20pm UTC](https://fortran-lang.discourse.group/t/how-do-you-intend-to-build-the-fortran-stdlib/1862/15 "2021-09-18T16:20:53Z")

</div>

Well, that’s a different poll now. How I intend to build stdlib is with fpm. How I currently build it is with cmake. So I voted both cmake and stdlib. I am just going to leave my vote.

---

<div class="post-metadata">

**Author:** ![milancurcic](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/milancurcic/32/2_2.png) [@milancurcic](https://fortran-lang.discourse.group/u/milancurcic)\
**Post date:** [September 18, 2021, 4:49pm UTC](https://fortran-lang.discourse.group/t/how-do-you-intend-to-build-the-fortran-stdlib/1862/16 "2021-09-18T16:49:14Z")

</div>

It’s the same poll. The body didn’t change. Only the title changed to be more consistent with the body.

Yes, it captures two pieces of information, both of which I wanted to know about. I voted for CMake because I use it and plan to use it, and fpm because I will use it for stdlib as a dependency.

---

<div class="post-metadata">

**Author:** ![milancurcic](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/milancurcic/32/2_2.png) [@milancurcic](https://fortran-lang.discourse.group/u/milancurcic)\
**Post date:** [April 22, 2022, 5:46pm UTC](https://fortran-lang.discourse.group/t/how-do-you-intend-to-build-the-fortran-stdlib/1862/17 "2022-04-22T17:46:21Z")

</div>

Let’s revive this conversation again. We just discussed it on the monthly call, and hope to make a decision soon whether to remove Makefile support from stdlib.

Does anybody here still use Make to build stdlib?
