Patchwork [PATCHv2,04/14] gcc: fix Fortran support

login
register
mail settings
Submitter Thomas Petazzoni
Date Sept. 2, 2013, 4:06 p.m.
Message ID <1378138000-12739-5-git-send-email-thomas.petazzoni@free-electrons.com>
Download mbox | patch
Permalink /patch/271977/
State Accepted
Headers show

Comments

Thomas Petazzoni - Sept. 2, 2013, 4:06 p.m.
This commit fixes the Fortran support in the gcc package by making
sure that the runtime Fortran library is properly installed to the
target.

It also takes this opportunity to slightly reword the Config.in option
help text, to no longer mention gcc < 4.2 since they are no longer
supported in Buildroot, and to have a more meaningful explanation.

Finally, it fixes the gcc-final.mk code to use the correct
BR2_INSTALL_FORTRAN option rather than the non-existing
BR2_GCC_CROSS_FORTRAN option, to decide whether Fortran support should
be enabled or not in the cross-compiler.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 package/gcc/Config.in.host         | 8 ++++----
 package/gcc/gcc-final/gcc-final.mk | 6 +++++-
 2 files changed, 9 insertions(+), 5 deletions(-)
Peter Korsgaard - Sept. 15, 2013, 9:07 p.m.
>>>>> "Thomas" == Thomas Petazzoni <thomas.petazzoni@free-electrons.com> writes:

 Thomas> This commit fixes the Fortran support in the gcc package by making
 Thomas> sure that the runtime Fortran library is properly installed to the
 Thomas> target.

 Thomas> It also takes this opportunity to slightly reword the Config.in option
 Thomas> help text, to no longer mention gcc < 4.2 since they are no longer
 Thomas> supported in Buildroot, and to have a more meaningful explanation.

 Thomas> Finally, it fixes the gcc-final.mk code to use the correct
 Thomas> BR2_INSTALL_FORTRAN option rather than the non-existing
 Thomas> BR2_GCC_CROSS_FORTRAN option, to decide whether Fortran support should
 Thomas> be enabled or not in the cross-compiler.

Committed, thanks.

I wonder if we shouldn't deprecate fortran (and objc) support and get
rid of them. Is there really a use case for them? Any interesting sw
that needs them?
Thomas Petazzoni - Sept. 16, 2013, 3:38 p.m.
Dear Peter Korsgaard,

On Sun, 15 Sep 2013 23:07:04 +0200, Peter Korsgaard wrote:

> I wonder if we shouldn't deprecate fortran (and objc) support and get
> rid of them. Is there really a use case for them? Any interesting sw
> that needs them?

I have no idea. I believe Objective-C is completely useless. However, I
believe Fortran *might* be useful for some scientific applications that
could be used on embedded devices. But the fact that no-one ever
complained about our Fortran support being broken (the runtime library
was never copied to the target) is a fairly strong indication that
nobody is using this.

Thomas
Samuel Martin - Sept. 16, 2013, 3:53 p.m.
Thomas, Peter,


2013/9/16 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

> Dear Peter Korsgaard,
>
> On Sun, 15 Sep 2013 23:07:04 +0200, Peter Korsgaard wrote:
>
> > I wonder if we shouldn't deprecate fortran (and objc) support and get
> > rid of them. Is there really a use case for them? Any interesting sw
> > that needs them?
>
> I have no idea. I believe Objective-C is completely useless. However, I
> believe Fortran *might* be useful for some scientific applications that
> could be used on embedded devices. But the fact that no-one ever
> complained about our Fortran support being broken (the runtime library
> was never copied to the target) is a fairly strong indication that
> nobody is using this.
>
I confirm.
I have not checked recently, but few versions ago, fortan was needed to
build opencv.


Regards,
Thomas Petazzoni - Sept. 16, 2013, 4:02 p.m.
Dear Samuel Martin,

On Mon, 16 Sep 2013 17:53:53 +0200, Samuel Martin wrote:

> > I have no idea. I believe Objective-C is completely useless. However, I
> > believe Fortran *might* be useful for some scientific applications that
> > could be used on embedded devices. But the fact that no-one ever
> > complained about our Fortran support being broken (the runtime library
> > was never copied to the target) is a fairly strong indication that
> > nobody is using this.
> >
> I confirm.
> I have not checked recently, but few versions ago, fortan was needed to
> build opencv.

Doh? Where is this information coming from? There might be a Fortran
API to OpenCV, but I really doubt that Fortran is a requirement to
build OpenCV, because we don't enable Fortran in any of our
configurations, and still OpenCV builds fine.

Thomas
Samuel Martin - Sept. 16, 2013, 4:21 p.m.
2013/9/16 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

> Dear Samuel Martin,
>
> On Mon, 16 Sep 2013 17:53:53 +0200, Samuel Martin wrote:
>
> > > I have no idea. I believe Objective-C is completely useless. However, I
> > > believe Fortran *might* be useful for some scientific applications that
> > > could be used on embedded devices. But the fact that no-one ever
> > > complained about our Fortran support being broken (the runtime library
> > > was never copied to the target) is a fairly strong indication that
> > > nobody is using this.
> > >
> > I confirm.
> > I have not checked recently, but few versions ago, fortan was needed to
> > build opencv.
>
> Doh? Where is this information coming from? There might be a Fortran
> API to OpenCV, but I really doubt that Fortran is a requirement to
> build OpenCV, because we don't enable Fortran in any of our
> configurations, and still OpenCV builds fine.
>

Well, after checking, fortran seems not need anymore to build opencv, for
at least 2 years...

Patch

diff --git a/package/gcc/Config.in.host b/package/gcc/Config.in.host
index 7e6df2d..b440ee2 100644
--- a/package/gcc/Config.in.host
+++ b/package/gcc/Config.in.host
@@ -119,13 +119,13 @@  config BR2_INSTALL_OBJC
 	  Build/install Objective-C compiler and runtime?
 
 config BR2_INSTALL_FORTRAN
-	bool "Build/install Fortran compiler and runtime?"
+	bool "Enable Fortran support"
 	depends on !BR2_avr32
 	select BR2_PACKAGE_LIBMPFR
 	help
-	  Build/install Fortran compiler and runtime?
-	  Note that it is highly recommended NOT to use gfortran
-	  from gcc older than 4.2.0
+	  Enable the support for the Fortran language in the
+	  cross-compiler, and install the Fortran runtime to the
+	  target.
 
 config BR2_GCC_ENABLE_TLS
 	bool "Enable compiler tls support" if BR2_TOOLCHAIN_BUILDROOT_UCLIBC
diff --git a/package/gcc/gcc-final/gcc-final.mk b/package/gcc/gcc-final/gcc-final.mk
index b62dfe2..15adadd 100644
--- a/package/gcc/gcc-final/gcc-final.mk
+++ b/package/gcc/gcc-final/gcc-final.mk
@@ -34,7 +34,7 @@  HOST_GCC_FINAL_PRE_CONFIGURE_HOOKS += HOST_GCC_FINAL_CONFIGURE_SYMLINK
 # Languages supported by the cross-compiler
 GCC_FINAL_CROSS_LANGUAGES-y = c
 GCC_FINAL_CROSS_LANGUAGES-$(BR2_INSTALL_LIBSTDCPP) += c++
-GCC_FINAL_CROSS_LANGUAGES-$(BR2_GCC_CROSS_FORTRAN) += fortran
+GCC_FINAL_CROSS_LANGUAGES-$(BR2_INSTALL_FORTRAN) += fortran
 GCC_FINAL_CROSS_LANGUAGES-$(BR2_GCC_CROSS_OBJC)    += objc
 GCC_FINAL_CROSS_LANGUAGES = $(subst $(space),$(comma),$(GCC_FINAL_CROSS_LANGUAGES-y))
 
@@ -113,6 +113,10 @@  ifeq ($(BR2_GCC_ENABLE_OPENMP),y)
 HOST_GCC_FINAL_USR_LIBS += libgomp
 endif
 
+ifeq ($(BR2_INSTALL_FORTRAN),y)
+HOST_GCC_FINAL_USR_LIBS += libgfortran
+endif
+
 ifneq ($(HOST_GCC_FINAL_USR_LIBS),)
 define HOST_GCC_FINAL_INSTALL_USR_LIBS
 	mkdir -p $(TARGET_DIR)/usr/lib