Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 01/13] package/gcc: use BR2_USE_WCHAR to set gcc libquadmath option
@ 2016-06-27 15:11 Vicente Olivert Riera
  2016-06-27 15:11 ` [Buildroot] [PATCH 02/13] package/gcc: fix fortran support Vicente Olivert Riera
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Vicente Olivert Riera @ 2016-06-27 15:11 UTC (permalink / raw)
  To: buildroot

From: Samuel Martin <s.martin49@gmail.com>

BR2_TOOLCHAIN_BUILDROOT_WCHAR is only defined when uclibc is selected, whereas
BR2_USE_WCHAR is always defined.

So, use BR2_USE_WCHAR to drive the gcc libquadmath option.

Signed-off-by: Samuel Martin <s.martin49@gmail.com>
Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
---
 package/gcc/gcc.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/gcc/gcc.mk b/package/gcc/gcc.mk
index 46f05ff..88d2bc2 100644
--- a/package/gcc/gcc.mk
+++ b/package/gcc/gcc.mk
@@ -107,7 +107,7 @@ HOST_GCC_COMMON_CONF_OPTS += --disable-libitm
 endif
 
 # gcc 4.6.x quadmath requires wchar
-ifneq ($(BR2_TOOLCHAIN_BUILDROOT_WCHAR),y)
+ifneq ($(BR2_USE_WCHAR),y)
 HOST_GCC_COMMON_CONF_OPTS += --disable-libquadmath
 endif
 
-- 
2.7.3

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH 02/13] package/gcc: fix fortran support
  2016-06-27 15:11 [Buildroot] [PATCH 01/13] package/gcc: use BR2_USE_WCHAR to set gcc libquadmath option Vicente Olivert Riera
@ 2016-06-27 15:11 ` Vicente Olivert Riera
  2016-06-27 15:11 ` [Buildroot] [PATCH 03/13] package/gcc: wrap gfortran Vicente Olivert Riera
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Vicente Olivert Riera @ 2016-06-27 15:11 UTC (permalink / raw)
  To: buildroot

From: Samuel Martin <s.martin49@gmail.com>

Fortran depends on libquadmath, which requires a toolchain with wchar
support.

So:
- make sure libquadmath is enable and installed when fortran is enabled;
- propagate the wchar dependency (from libquadmath) to fortran, and add
  a comment when fortran is not available.

[Vincent: only do "HOST_GCC_FINAL_USR_LIBS += libquadmath" for i386 and
x86_64, otherwise it will fail saying "libquadmath.a: file not found"]

Signed-off-by: Samuel Martin <s.martin49@gmail.com>
Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
---
 package/gcc/Config.in.host         | 4 ++++
 package/gcc/gcc-final/gcc-final.mk | 4 ++++
 package/gcc/gcc.mk                 | 5 +++++
 3 files changed, 13 insertions(+)

diff --git a/package/gcc/Config.in.host b/package/gcc/Config.in.host
index 3180071..54f7e1f 100644
--- a/package/gcc/Config.in.host
+++ b/package/gcc/Config.in.host
@@ -120,11 +120,15 @@ config BR2_TOOLCHAIN_BUILDROOT_CXX
 
 config BR2_TOOLCHAIN_BUILDROOT_FORTRAN
 	bool "Enable Fortran support"
+	depends on BR2_USE_WCHAR # libquadmath
 	help
 	  Enable this option if you want your toolchain to support the
 	  Fortran language and you want Fortran libraries to be
 	  installed on your target system.
 
+comment "Fortran support needs a toolchain w/ wchar"
+	depends on !BR2_USE_WCHAR
+
 config BR2_GCC_ENABLE_TLS
 	bool "Enable compiler tls support" if BR2_TOOLCHAIN_BUILDROOT_UCLIBC
 	default y
diff --git a/package/gcc/gcc-final/gcc-final.mk b/package/gcc/gcc-final/gcc-final.mk
index 1d1d72e..e418f51 100644
--- a/package/gcc/gcc-final/gcc-final.mk
+++ b/package/gcc/gcc-final/gcc-final.mk
@@ -163,6 +163,10 @@ endif
 
 ifeq ($(BR2_TOOLCHAIN_BUILDROOT_FORTRAN),y)
 HOST_GCC_FINAL_USR_LIBS += libgfortran
+# fortran needs quadmath on x86 and x86_64
+ifeq ($(BR2_I386)$(BR2_x86_64),y)
+HOST_GCC_FINAL_USR_LIBS += libquadmath
+endif
 endif
 
 ifeq ($(BR2_GCC_ENABLE_OPENMP),y)
diff --git a/package/gcc/gcc.mk b/package/gcc/gcc.mk
index 88d2bc2..cffdb19 100644
--- a/package/gcc/gcc.mk
+++ b/package/gcc/gcc.mk
@@ -109,6 +109,11 @@ endif
 # gcc 4.6.x quadmath requires wchar
 ifneq ($(BR2_USE_WCHAR),y)
 HOST_GCC_COMMON_CONF_OPTS += --disable-libquadmath
+else
+# fortran needs quadmath on x86 and x86_64
+ifeq ($(BR2_TOOLCHAIN_BUILDROOT_FORTRAN)$(BR2_I386)$(BR2_x86_64),yy)
+HOST_GCC_COMMON_CONF_OPTS += --enable-libquadmath
+endif
 endif
 
 # libsanitizer requires wordexp, not in default uClibc config. Also
-- 
2.7.3

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH 03/13] package/gcc: wrap gfortran
  2016-06-27 15:11 [Buildroot] [PATCH 01/13] package/gcc: use BR2_USE_WCHAR to set gcc libquadmath option Vicente Olivert Riera
  2016-06-27 15:11 ` [Buildroot] [PATCH 02/13] package/gcc: fix fortran support Vicente Olivert Riera
@ 2016-06-27 15:11 ` Vicente Olivert Riera
  2016-06-27 15:11 ` [Buildroot] [PATCH 04/13] pkg-cmake.mk: export the fortran compiler path in the CMake toolchain file Vicente Olivert Riera
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Vicente Olivert Riera @ 2016-06-27 15:11 UTC (permalink / raw)
  To: buildroot

From: Samuel Martin <s.martin49@gmail.com>

gfortran supports all options supported by gcc, so it can and should be called
via the toolchain wrapper.

Signed-off-by: Samuel Martin <s.martin49@gmail.com>
Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
---
 package/gcc/gcc.mk | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/package/gcc/gcc.mk b/package/gcc/gcc.mk
index cffdb19..8bc34ea 100644
--- a/package/gcc/gcc.mk
+++ b/package/gcc/gcc.mk
@@ -270,6 +270,8 @@ endif # BR2_CCACHE
 # used. However, we should not add the toolchain wrapper for them, and they
 # match the *cc-* pattern. Therefore, an additional case is added for *-ar,
 # *-ranlib and *-nm.
+# According to gfortran manpage, it supports all options supported by gcc, so
+# add gfortran to the list of the program called via the Buildroot wrapper.
 # Avoid that a .br_real is symlinked a second time.
 # Also create <arch>-linux-<tool> symlinks.
 define HOST_GCC_INSTALL_WRAPPER_AND_SIMPLE_SYMLINKS
@@ -281,7 +283,7 @@ define HOST_GCC_INSTALL_WRAPPER_AND_SIMPLE_SYMLINKS
 		*-ar|*-ranlib|*-nm) \
 			ln -snf $$i $(ARCH)-linux$${i##$(GNU_TARGET_NAME)}; \
 			;; \
-		*cc|*cc-*|*++|*++-*|*cpp) \
+		*cc|*cc-*|*++|*++-*|*cpp|*-gfortran) \
 			rm -f $$i.br_real; \
 			mv $$i $$i.br_real; \
 			ln -sf toolchain-wrapper $$i; \
-- 
2.7.3

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH 04/13] pkg-cmake.mk: export the fortran compiler path in the CMake toolchain file
  2016-06-27 15:11 [Buildroot] [PATCH 01/13] package/gcc: use BR2_USE_WCHAR to set gcc libquadmath option Vicente Olivert Riera
  2016-06-27 15:11 ` [Buildroot] [PATCH 02/13] package/gcc: fix fortran support Vicente Olivert Riera
  2016-06-27 15:11 ` [Buildroot] [PATCH 03/13] package/gcc: wrap gfortran Vicente Olivert Riera
@ 2016-06-27 15:11 ` Vicente Olivert Riera
  2016-06-27 15:11 ` [Buildroot] [PATCH 05/13] toolchain: add hidden symbol for fortran support in the toolchain Vicente Olivert Riera
  2016-07-01 15:30 ` [Buildroot] [PATCH 01/13] package/gcc: use BR2_USE_WCHAR to set gcc libquadmath option Thomas Petazzoni
  4 siblings, 0 replies; 6+ messages in thread
From: Vicente Olivert Riera @ 2016-06-27 15:11 UTC (permalink / raw)
  To: buildroot

From: Samuel Martin <s.martin49@gmail.com>

Since the fortran support is conditional, only enable it when needed.

Signed-off-by: Samuel Martin <s.martin49@gmail.com>
Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
---
 package/pkg-cmake.mk                | 2 ++
 support/misc/toolchainfile.cmake.in | 3 +++
 2 files changed, 5 insertions(+)

diff --git a/package/pkg-cmake.mk b/package/pkg-cmake.mk
index 81dcfcc..d30b66b 100644
--- a/package/pkg-cmake.mk
+++ b/package/pkg-cmake.mk
@@ -246,6 +246,8 @@ $(HOST_DIR)/usr/share/buildroot/toolchainfile.cmake:
 		-e 's#@@TARGET_LDFLAGS@@#$(call qstrip,$(TARGET_LDFLAGS))#' \
 		-e 's#@@TARGET_CC@@#$(subst $(HOST_DIR)/,,$(call qstrip,$(TARGET_CC)))#' \
 		-e 's#@@TARGET_CXX@@#$(subst $(HOST_DIR)/,,$(call qstrip,$(TARGET_CXX)))#' \
+		-e 's#@@TARGET_FC@@#$(subst $(HOST_DIR)/,,$(call qstrip,$(TARGET_FC)))#' \
 		-e 's#@@CMAKE_SYSTEM_PROCESSOR@@#$(call qstrip,$(CMAKE_SYSTEM_PROCESSOR))#' \
+		-e 's#@@TOOLCHAIN_HAS_FORTRAN@@#$(if $(BR2_TOOLCHAIN_HAS_FORTRAN),1,0)#' \
 		$(TOPDIR)/support/misc/toolchainfile.cmake.in \
 		> $@
diff --git a/support/misc/toolchainfile.cmake.in b/support/misc/toolchainfile.cmake.in
index 5cf381e..ac81e9a 100644
--- a/support/misc/toolchainfile.cmake.in
+++ b/support/misc/toolchainfile.cmake.in
@@ -29,3 +29,6 @@ set(ENV{PKG_CONFIG_SYSROOT_DIR} "${RELOCATED_HOST_DIR}/@@STAGING_SUBDIR@@")
 # This toolchain file can be used both inside and outside Buildroot.
 set(CMAKE_C_COMPILER "${RELOCATED_HOST_DIR}/@@TARGET_CC@@")
 set(CMAKE_CXX_COMPILER "${RELOCATED_HOST_DIR}/@@TARGET_CXX@@")
+if(@@TOOLCHAIN_HAS_FORTRAN@@)
+  set(CMAKE_Fortran_COMPILER "${RELOCATED_HOST_DIR}/@@TARGET_FC@@")
+endif()
-- 
2.7.3

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH 05/13] toolchain: add hidden symbol for fortran support in the toolchain
  2016-06-27 15:11 [Buildroot] [PATCH 01/13] package/gcc: use BR2_USE_WCHAR to set gcc libquadmath option Vicente Olivert Riera
                   ` (2 preceding siblings ...)
  2016-06-27 15:11 ` [Buildroot] [PATCH 04/13] pkg-cmake.mk: export the fortran compiler path in the CMake toolchain file Vicente Olivert Riera
@ 2016-06-27 15:11 ` Vicente Olivert Riera
  2016-07-01 15:30 ` [Buildroot] [PATCH 01/13] package/gcc: use BR2_USE_WCHAR to set gcc libquadmath option Thomas Petazzoni
  4 siblings, 0 replies; 6+ messages in thread
From: Vicente Olivert Riera @ 2016-06-27 15:11 UTC (permalink / raw)
  To: buildroot

From: Samuel Martin <s.martin49@gmail.com>

This symbol should be used in all packages requiring/testing for fortran
support.

Signed-off-by: Samuel Martin <s.martin49@gmail.com>
Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
---
 toolchain/toolchain-common.in | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/toolchain/toolchain-common.in b/toolchain/toolchain-common.in
index 1fe28a9..232377f 100644
--- a/toolchain/toolchain-common.in
+++ b/toolchain/toolchain-common.in
@@ -21,6 +21,9 @@ config BR2_ENABLE_LOCALE
 config BR2_INSTALL_LIBSTDCPP
 	bool
 
+config BR2_TOOLCHAIN_HAS_FORTRAN
+	bool
+
 config BR2_TOOLCHAIN_HAS_THREADS
 	bool
 
-- 
2.7.3

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH 01/13] package/gcc: use BR2_USE_WCHAR to set gcc libquadmath option
  2016-06-27 15:11 [Buildroot] [PATCH 01/13] package/gcc: use BR2_USE_WCHAR to set gcc libquadmath option Vicente Olivert Riera
                   ` (3 preceding siblings ...)
  2016-06-27 15:11 ` [Buildroot] [PATCH 05/13] toolchain: add hidden symbol for fortran support in the toolchain Vicente Olivert Riera
@ 2016-07-01 15:30 ` Thomas Petazzoni
  4 siblings, 0 replies; 6+ messages in thread
From: Thomas Petazzoni @ 2016-07-01 15:30 UTC (permalink / raw)
  To: buildroot

Hello,

On Mon, 27 Jun 2016 16:11:15 +0100, Vicente Olivert Riera wrote:
> From: Samuel Martin <s.martin49@gmail.com>
> 
> BR2_TOOLCHAIN_BUILDROOT_WCHAR is only defined when uclibc is selected, whereas
> BR2_USE_WCHAR is always defined.
> 
> So, use BR2_USE_WCHAR to drive the gcc libquadmath option.
> 
> Signed-off-by: Samuel Martin <s.martin49@gmail.com>
> Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>

I've applied, after doing some tweaks, see below.

> ---
>  package/gcc/gcc.mk | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/package/gcc/gcc.mk b/package/gcc/gcc.mk
> index 46f05ff..88d2bc2 100644
> --- a/package/gcc/gcc.mk
> +++ b/package/gcc/gcc.mk
> @@ -107,7 +107,7 @@ HOST_GCC_COMMON_CONF_OPTS += --disable-libitm
>  endif
>  
>  # gcc 4.6.x quadmath requires wchar

I've updated this commit, because the requirement on wchar doesn't
apply just to gcc 4.6. It applies *since* 4.6, because that's when
libquadmath was introduced.

> -ifneq ($(BR2_TOOLCHAIN_BUILDROOT_WCHAR),y)
> +ifneq ($(BR2_USE_WCHAR),y)

And I've inverted the condition to use positive logic:

ifeq ($(BR2_USE_WCHAR),)

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-07-01 15:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-27 15:11 [Buildroot] [PATCH 01/13] package/gcc: use BR2_USE_WCHAR to set gcc libquadmath option Vicente Olivert Riera
2016-06-27 15:11 ` [Buildroot] [PATCH 02/13] package/gcc: fix fortran support Vicente Olivert Riera
2016-06-27 15:11 ` [Buildroot] [PATCH 03/13] package/gcc: wrap gfortran Vicente Olivert Riera
2016-06-27 15:11 ` [Buildroot] [PATCH 04/13] pkg-cmake.mk: export the fortran compiler path in the CMake toolchain file Vicente Olivert Riera
2016-06-27 15:11 ` [Buildroot] [PATCH 05/13] toolchain: add hidden symbol for fortran support in the toolchain Vicente Olivert Riera
2016-07-01 15:30 ` [Buildroot] [PATCH 01/13] package/gcc: use BR2_USE_WCHAR to set gcc libquadmath option Thomas Petazzoni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox