Skip to contentSkip to conversation

glibc: fix multilib headers conflict for arm

PATCH In review [email protected] 2 participants 2 messages May 11, 2024

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 glibc: fix multilib headers conflict for arm

From: Kai Kang <[email protected]>

The header files conflic when multilib enabled for arm:

| Error: Transaction test error:
| file /usr/include/finclude/math-vector-fortran.h conflicts between attempted installs of

    lib32-libc6-dev-2.39+git0+312e159626-r0.armv7at2hf_neon and libc6-dev-2.39+git0+312e159626-r0.cortexa72

Invoke function oe_multilib_header to resolve it.

But gfortran-cross can NOT recognize macros such as #ifdef as expected, so pass option -nostdinc to gfortran-cross-aarch64 that not preinclude multilib specific math-vector-fortran.h [1].

[1]: https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/config/gnu-user.h;h=f7eefdafe8b330787c412ad950675d7a2d595e61;hb=HEAD#l158

---
 meta/conf/bitbake.conf                    | 5 ++++-
 meta/recipes-core/glibc/glibc-package.inc | 2 ++
 2 files changed, 6 insertions(+), 1 deletion(-)
meta/conf/bitbake.conf +4 -1
index b2c500d873..262c3e32ee 100644
@@ -555,11 +555,14 @@ HOSTTOOLS_NONFATAL += "git-lfs"
 
 CCACHE ??= ""
 
+FC_OPTIONS ??= ""
+FC_OPTIONS:append:aarch64 = " -nostdinc"
+
 TOOLCHAIN_OPTIONS = " --sysroot=${STAGING_DIR_TARGET}"
 
 export CC = "${CCACHE}${HOST_PREFIX}gcc ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}"
 export CXX = "${CCACHE}${HOST_PREFIX}g++ ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}"
-export FC = "${HOST_PREFIX}gfortran ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}"
+export FC = "${HOST_PREFIX}gfortran ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}${FC_OPTIONS}"
 export CPP = "${HOST_PREFIX}gcc -E${TOOLCHAIN_OPTIONS} ${HOST_CC_ARCH}"
 export LD = "${HOST_PREFIX}ld${TOOLCHAIN_OPTIONS} ${HOST_LD_ARCH}"
 export CCLD = "${CC}"
meta/recipes-core/glibc/glibc-package.inc +2 -0
index 0c5e3b4c3d..3a2ebfff75 100644
@@ -167,6 +167,8 @@ do_install_armmultilib () {
 	oe_multilib_header fpu_control.h gnu/lib-names.h gnu/stubs.h ieee754.h
 
 	oe_multilib_header sys/elf.h sys/procfs.h sys/ptrace.h sys/ucontext.h sys/user.h
+
+	oe_multilib_header finclude/math-vector-fortran.h
 }
 
 
Signature · 1 line
2.34.1
#1 lore raw
Quoted 33 lines · Kai Kang via lists.openembedded.org

From: Kai Kang <[email protected]>

The header files conflic when multilib enabled for arm:

Quoted 2 lines

Error: Transaction test error:
  file /usr/include/finclude/math-vector-fortran.h conflicts between attempted installs of

    lib32-libc6-dev-2.39+git0+312e159626-r0.armv7at2hf_neon and libc6-dev-2.39+git0+312e159626-r0.cortexa72

Invoke function oe_multilib_header to resolve it.

But gfortran-cross can NOT recognize macros such as #ifdef as expected, so pass option -nostdinc to gfortran-cross-aarch64 that not preinclude multilib specific math-vector-fortran.h [1].

[1]: https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/config/gnu-user.h;h=f7eefdafe8b330787c412ad950675d7a2d595e61;hb=HEAD#l158

---
 meta/conf/bitbake.conf                    | 5 ++++- meta/recipes-core/glibc/glibc-package.inc | 2 ++

 2 files changed, 6 insertions(+), 1 deletion(-)
meta/conf/bitbake.conf +0 -0
index b2c500d873..262c3e32ee 100644
@@ -555,11 +555,14 @@ HOSTTOOLS_NONFATAL += "git-lfs"


 CCACHE ??= ""

meta/conf/bitbake.conf +3 -0
+FC_OPTIONS ??= ""
+FC_OPTIONS:append:aarch64 = " -nostdinc"
+
Quoted 2 lines

 TOOLCHAIN_OPTIONS = " --sysroot=${STAGING_DIR_TARGET}"

Does nostdinc not have other fairly nasty side effects such as requiring application level changes to ensure headers are included?

A lot of these fixes feel like the solution is worse and more risky than the original problem :(.

Cheers,

Richard