Skip to contentSkip to conversation

rpm: add PACKAGECONFIG for openmp and disable it by default for native builds

RFC PATCH In review Martin Jansa 2 participants 4 messages Feb 26, 2024

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 rpm: add PACKAGECONFIG for openmp and disable it by default for native builds

* and keep it enabled in target builds unless libc-musl where it was
disabled since upgrade to 4.15.1 in:
https://git.openembedded.org/openembedded-core/commit/?id=67257ca87c6fa8e6050a20ecea50daf834c7e869
and disable it for native builds to be able to reuse rpm-native
between hosts with libomp and without to avoid do_package failures like:
recipe-sysroot-native/usr/lib/rpm/rpmdeps: error while loading shared libraries: libgomp.so.1: cannot open shared object file: No such file or directory

* and on hosts without libomp it fails in do_configure:

  | CMake Error at /OE/build/tmp-glibc/work/x86_64-linux/rpm-native/4.19.1/recipe-sysroot-native/usr/share/cmake-3.28/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  |   Could NOT find OpenMP_C (missing: OpenMP_C_FLAGS OpenMP_C_LIB_NAMES)
  |   (Required is at least version "4.5")

* I've noticed this in new experimental gentoo profiles which don't enable openmp by default for gcc-13 and newer, see:
https://bugs.gentoo.org/890999
https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8189b4b48c25dbd7b330b51b53f9023cdbbb29ec
https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=94d882482714698d6d9b765920cd26bbe849336d

I'm not sure what other distributions plan with openmp support in future (and this profile is just experimental and the decision not to enable openmp by default might still change), but having the PACKAGECONFIG at least gives easy way to explicitly enable/disable this in bbappend

openmp is also explicitly disabled in gettext since 2011:
https://git.openembedded.org/openembedded-core/commit/?id=e897103a58ad672cc87d2bab3ec45501ef09f8f1

---
 meta/recipes-devtools/rpm/rpm_4.19.1.bb | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
meta/recipes-devtools/rpm/rpm_4.19.1.bb +7 -2
index 1f8611a29c..477e1c2d62 100644
@@ -52,7 +52,7 @@ DEPENDS = "lua libgcrypt file popt xz bzip2 elfutils python3 sqlite3 zstd"
 DEPENDS:append:class-native = " file-replacement-native bzip2-replacement-native"
 
 EXTRA_OECMAKE:append = " -D__CURL:FILEPATH=curl"
-EXTRA_OECMAKE:append:libc-musl = " -DENABLE_NLS=OFF -DENABLE_OPENMP=OFF"
+EXTRA_OECMAKE:append:libc-musl = " -DENABLE_NLS=OFF"
 
 # --sysconfdir prevents rpm from attempting to access machine-specific configuration in sysroot/etc; we need to have it in rootfs
 # --localstatedir prevents rpm from writing its database to native sysroot when building images
@@ -64,10 +64,15 @@ OECMAKE_GENERATOR = "Unix Makefiles"
 
 BBCLASSEXTEND = "native nativesdk"
 
-PACKAGECONFIG ??= "internal-openpgp"
+PACKAGECONFIG_OPENMP = "openmp"
+PACKAGECONFIG_OPENMP:libc-musl = ""
+PACKAGECONFIG_OPENMP:class-native = ""
+
+PACKAGECONFIG ??= "internal-openpgp ${PACKAGECONFIG_OPENMP}"
 
 PACKAGECONFIG[plugins] = "-DENABLE_PLUGINS=ON,-DENABLE_PLUGINS=OFF"
 PACKAGECONFIG[testsuite] = "-DENABLE_TESTSUITE=ON,-DENABLE_TESTSUITE=OFF"
+PACKAGECONFIG[openmp] = "-DENABLE_OPENMP=ON,-DENABLE_OPENMP=OFF"
 
 # Deprecated! https://fedoraproject.org/wiki/Changes/RpmSequoia
 PACKAGECONFIG[internal-openpgp] = "-DWITH_INTERNAL_OPENPGP=ON,-DWITH_INTERNAL_OPENPGP=OFF"
Signature · 1 line
2.44.0
#1 lore raw

This needs to be handled with care. We rely heavily on openmp support in rpm to speed up rpm operations; adding an option to turn it off is okay, but actually turning it off is not.

Alex

Quoted 90 lines · Martin Jansa

* and keep it enabled in target builds unless libc-musl where it was disabled since upgrade to 4.15.1 in:

https://git.openembedded.org/openembedded-core/commit/?id=67257ca87c6fa8e6050a20ecea50daf834c7e869
and disable it for native builds to be able to reuse rpm-native between hosts with libomp and without to avoid do_package failures like:
recipe-sysroot-native/usr/lib/rpm/rpmdeps: error while loading shared
libraries: libgomp.so.1: cannot open shared object file: No such file or directory

* and on hosts without libomp it fails in do_configure:
| CMake Error at
/OE/build/tmp-glibc/work/x86_64-linux/rpm-native/4.19.1/recipe-sysroot-native/usr/share/cmake-3.28/Modules/FindPackageHandleStandardArgs.cmake:230 (message):

  |   Could NOT find OpenMP_C (missing: OpenMP_C_FLAGS OpenMP_C_LIB_NAMES)
  |   (Required is at least version "4.5")

* I've noticed this in new experimental gentoo profiles which don't enable openmp by default for gcc-13 and newer, see:
https://bugs.gentoo.org/890999

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8189b4b48c25dbd7b330b51b53f9023cdbbb29ec

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=94d882482714698d6d9b765920cd26bbe849336d

I'm not sure what other distributions plan with openmp support in future (and this profile is just experimental and the decision not to enable openmp by default might still change), but having the PACKAGECONFIG at least gives easy way to explicitly enable/disable this in bbappend

openmp is also explicitly disabled in gettext since 2011:

https://git.openembedded.org/openembedded-core/commit/?id=e897103a58ad672cc87d2bab3ec45501ef09f8f1

---
 meta/recipes-devtools/rpm/rpm_4.19.1.bb | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
meta/recipes-devtools/rpm/rpm_4.19.1.bb +0 -0
index 1f8611a29c..477e1c2d62 100644
@@ -52,7 +52,7 @@ DEPENDS = "lua libgcrypt file popt xz bzip2 elfutils

python3 sqlite3 zstd"
DEPENDS:append:class-native = " file-replacement-native
bzip2-replacement-native"

EXTRA_OECMAKE:append = " -D__CURL:FILEPATH=curl"

meta/recipes-devtools/rpm/rpm_4.19.1.bb +1 -1
-EXTRA_OECMAKE:append:libc-musl = " -DENABLE_NLS=OFF -DENABLE_OPENMP=OFF"
+EXTRA_OECMAKE:append:libc-musl = " -DENABLE_NLS=OFF"
 
 # --sysconfdir prevents rpm from attempting to access machine-specific

configuration in sysroot/etc; we need to have it in rootfs
# --localstatedir prevents rpm from writing its database to native
sysroot when building images

meta/recipes-devtools/rpm/rpm_4.19.1.bb +6 -1
@@ -64,10 +64,15 @@ OECMAKE_GENERATOR = "Unix Makefiles"
 
 BBCLASSEXTEND = "native nativesdk"
 
-PACKAGECONFIG ??= "internal-openpgp"
+PACKAGECONFIG_OPENMP = "openmp"
+PACKAGECONFIG_OPENMP:libc-musl = ""
+PACKAGECONFIG_OPENMP:class-native = ""
+
+PACKAGECONFIG ??= "internal-openpgp ${PACKAGECONFIG_OPENMP}"
 
 PACKAGECONFIG[plugins] = "-DENABLE_PLUGINS=ON,-DENABLE_PLUGINS=OFF"
 PACKAGECONFIG[testsuite] = "-DENABLE_TESTSUITE=ON,-DENABLE_TESTSUITE=OFF"
+PACKAGECONFIG[openmp] = "-DENABLE_OPENMP=ON,-DENABLE_OPENMP=OFF"
 
 # Deprecated! https://fedoraproject.org/wiki/Changes/RpmSequoia
 PACKAGECONFIG[internal-openpgp] =

"-DWITH_INTERNAL_OPENPGP=ON,-DWITH_INTERNAL_OPENPGP=OFF" --
2.44.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#196205):
https://lists.openembedded.org/g/openembedded-core/message/196205
Mute This Topic: https://lists.openembedded.org/mt/104582694/1686489
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#2 lore raw
Quoted 2 lines · Alexander Kanavin

This needs to be handled with care. We rely heavily on openmp support in rpm to speed up rpm operations; adding an option to turn it off is okay, but actually turning it off is not.

That's why it was sent only as RFC, do you want me to re-send v2 RFC with keeping it enabled for native builds or should I wait for more (unlikely) feedback from others? When explicitly enabled for native it might start failing on hosts without openmp (where it was autodetected as disabled until now).

I use package_ipk, so from rpm-native I'm using only the rpmdeps.

This can surely wait for styhead release (as I'm probably the only one seeing this issue and only with experimental profile).

#3 lore raw

Just the option, preserving existing behavior please.

Alex

Quoted 18 lines · Martin Jansa
Quoted 2 lines · Alexander Kanavin

This needs to be handled with care. We rely heavily on openmp support in

rpm to speed up rpm operations; adding an option to turn it off is okay, but actually turning it off is not.

That's why it was sent only as RFC, do you want me to re-send v2 RFC with keeping it enabled for native builds or should I wait for more (unlikely) feedback from others? When explicitly enabled for native it might start failing on hosts without openmp (where it was autodetected as disabled until now).

I use package_ipk, so from rpm-native I'm using only the rpmdeps.

This can surely wait for styhead release (as I'm probably the only one seeing this issue and only with experimental profile).