Skip to contentSkip to conversation

libgfortran: fix buildpath QA issue

PATCH In review [email protected] 2 participants 3 messages Oct 18, 2024 – Oct 23, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 libgfortran: fix buildpath QA issue

From: Chen Qi <[email protected]>

The '-fdebug-prefix-map' options are used to map source files locations, otherwise, DW_AT_comp_dir will contain buildpath.

The '-gno-record-gcc-switches' option is used to fix the buildpath introduced
by '-fintrinsic-modules-path' option, which is automatically added by fortran.
Here's some output from 'readelf --debug-dump libgfortran.so.5.0.0' when this
option is not added:
"""
<0><1a37d3>: Abbrev Number: 4 (DW_TAG_compile_unit)
<1a37d4> DW_AT_producer : (indirect string, offset: 0xd653): GNU Fortran2008 14.2.0 -m64
-march=core2 -mtune=core2 -msse3
-mfpmath=sse -mshstk -g -O2 -O2 -fstack-protector-strong -fimplicit-none -fno-repack-arrays -fno-underscoring -fcf-protection=full -fallow-leading-underscore -fbuilding-libgfortran -fPIC -fintrinsic-modules-path /ala-lpggp72/qichen/Yocto/builds/build-poky/tmp/work/ core2-64-poky-linux/libgfortran/14.2.0/recipe-sysroot-native/usr/bin/x86_64-poky-linux /../../lib/x86_64-poky-linux/gcc/x86_64-poky-linux/14.2.0/finclude -fpre-include=../../../../recipe-sysroot/usr/include/finclude/math-vector-fortran.h
"""

See https://gcc.gnu.org/pipermail/fortran/2024-October/061204.html for more detailed information.

---
 meta/recipes-devtools/gcc/libgfortran.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-devtools/gcc/libgfortran.inc +1 -1
index c68645e392..2a08872c25 100644
@@ -8,7 +8,7 @@ EXTRA_OECONF_PATHS = "\
 # An arm hard float target like raspberrypi4 won't build
 # as CFLAGS don't make it to the fortran compiler otherwise
 # (the configure script sets FC to $GFORTRAN unconditionally)
-export GFORTRAN = "${FC}"
+export GFORTRAN = "${FC} -fcanon-prefix-map -fdebug-prefix-map=${S}=${TARGET_DBGSRC_DIR} -fdebug-prefix-map=${B}=${TARGET_DBGSRC_DIR} -gno-record-gcc-switches"
 
 do_configure () {
 	for target in libbacktrace libgfortran
Signature · 1 line
2.25.1
#1 lore raw

PATCH 2/2 oeqa/selftest/cases/buildoptions.py: ensure libgfortran's package_qa is run

From: Chen Qi <[email protected]>

fortran-helloworld DEPENDS on libgfortran, so merely 'bitbake fortran-helloworld' does not ensure that libgfortran's package_qa is run. This actually covers the buildpath issue in libgfortran. This patch ensures that libgfortran's package_qa is run to avoid any future regression.

---
 meta/lib/oeqa/selftest/cases/buildoptions.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/lib/oeqa/selftest/cases/buildoptions.py +1 -1
index 423c31e189..4e82c34de9 100644
@@ -203,7 +203,7 @@ class ToolchainOptions(OESelftestTestCase):
 
         features = 'FORTRAN:forcevariable = ",fortran"\n'
         self.write_config(features)
-        bitbake('fortran-helloworld')
+        bitbake('libgfortran fortran-helloworld')
 
 @OETestTag("yocto-mirrors")
 class SourceMirroring(OESelftestTestCase):
Signature · 1 line
2.25.1
#2 lore raw

Re: [OE-core][PATCH 2/2] oeqa/selftest/cases/buildoptions.py: ensure libgfortran's package_qa is run

Quoted 17 lines · Chen Qi via lists.openembedded.org

From: Chen Qi <[email protected]>

fortran-helloworld DEPENDS on libgfortran, so merely 'bitbake fortran-helloworld' does not ensure that libgfortran's package_qa is run. This actually covers the buildpath issue in libgfortran. This patch ensures that libgfortran's package_qa is run to avoid any future regression.

---
 meta/lib/oeqa/selftest/cases/buildoptions.py | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)
meta/lib/oeqa/selftest/cases/buildoptions.py +0 -0
index 423c31e189..4e82c34de9 100644
@@ -203,7 +203,7 @@ class ToolchainOptions(OESelftestTestCase):
Quoted 8 lines


         features = 'FORTRAN:forcevariable = ",fortran"\n' self.write_config(features)
-        bitbake('fortran-helloworld')
+        bitbake('libgfortran fortran-helloworld')
 @OETestTag("yocto-mirrors")
 class SourceMirroring(OESelftestTestCase):

I took the first patch but this second one made me worry about our task dependencies. I've looked into it and I think there is a bigger issue. I've sent an alternative one to insane.bbclass which should mean this is unneeded. If you could double check that would be great.

Thanks,

Richard