diff mbox series

sanity: Add sanity test for 'bad' gcc installs on ubuntu 24.04

Message ID 20250708221814.791307-1-richard.purdie@linuxfoundation.org
State Accepted, archived
Commit 087b2730bb2446ad5ea98c233e349d2787c17ff1
Headers show
Series sanity: Add sanity test for 'bad' gcc installs on ubuntu 24.04 | expand

Commit Message

Richard Purdie July 8, 2025, 10:18 p.m. UTC
Installing emacs on Ubuntu 24.04 pulls in emacs-gtk which leads to libgcc-14-dev
despite gcc being 13. This breaks libcxx-native and compiler-rt-native builds.
We've tried various ways of addressing this buit they don't work. Instead, detect
this situation and tell the user to either install or remove a package.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 meta/classes-global/sanity.bbclass | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Khem Raj July 9, 2025, 4:37 a.m. UTC | #1
On Tue, Jul 8, 2025 at 3:18 PM Richard Purdie via
lists.openembedded.org
<richard.purdie=linuxfoundation.org@lists.openembedded.org> wrote:
>
> Installing emacs on Ubuntu 24.04 pulls in emacs-gtk which leads to libgcc-14-dev
> despite gcc being 13. This breaks libcxx-native and compiler-rt-native builds.
> We've tried various ways of addressing this buit they don't work. Instead, detect
> this situation and tell the user to either install or remove a package.
>
> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> ---
>  meta/classes-global/sanity.bbclass | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/meta/classes-global/sanity.bbclass b/meta/classes-global/sanity.bbclass
> index 1044ed9cc69..d875a022db0 100644
> --- a/meta/classes-global/sanity.bbclass
> +++ b/meta/classes-global/sanity.bbclass
> @@ -672,6 +672,8 @@ def check_sanity_sstate_dir_change(sstate_dir, data):
>      return testmsg
>
>  def check_sanity_version_change(status, d):
> +    import glob
> +
>      # Sanity checks to be done when SANITY_VERSION or NATIVELSBSTRING changes
>      # In other words, these tests run once in a given build directory and then
>      # never again until the sanity version or host distribution id/version changes.
> @@ -703,6 +705,11 @@ def check_sanity_version_change(status, d):
>      if not check_app_exists('g++', d):
>          missing = missing + "C++ Compiler (g++),"
>
> +    # installing emacs on Ubuntu 24.04 pulls in emacs-gtk -> libgcc-14-dev despite gcc being 13
> +    # this breaks libcxx-native and compiler-rt-native builds so tell the user to fix things
> +    if glob.glob("/usr/lib/gcc/*/14/libgcc_s.so") and not glob.glob("/usr/lib/gcc/*/14/libstdc++.so"):
> +        status.addresult('libgcc-14-dev is installed and not libstdc++-14-dev which will break clang native compiles. Please remove one or install the other.')
> +

TBH this is good to bring to notice of such installations, since this
situation happens with special installations
and not with standard vanilla systems, it might be good for users to
know these caveats. Good that you found
out a package installed on top of  vanilla ubuntu 24.04 which can
cause this situation.

>      required_utilities = d.getVar('SANITY_REQUIRED_UTILITIES')
>
>      for util in required_utilities.split():
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#220053): https://lists.openembedded.org/g/openembedded-core/message/220053
> Mute This Topic: https://lists.openembedded.org/mt/114055527/1997914
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [raj.khem@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
diff mbox series

Patch

diff --git a/meta/classes-global/sanity.bbclass b/meta/classes-global/sanity.bbclass
index 1044ed9cc69..d875a022db0 100644
--- a/meta/classes-global/sanity.bbclass
+++ b/meta/classes-global/sanity.bbclass
@@ -672,6 +672,8 @@  def check_sanity_sstate_dir_change(sstate_dir, data):
     return testmsg
 
 def check_sanity_version_change(status, d):
+    import glob
+
     # Sanity checks to be done when SANITY_VERSION or NATIVELSBSTRING changes
     # In other words, these tests run once in a given build directory and then 
     # never again until the sanity version or host distribution id/version changes.
@@ -703,6 +705,11 @@  def check_sanity_version_change(status, d):
     if not check_app_exists('g++', d):
         missing = missing + "C++ Compiler (g++),"
 
+    # installing emacs on Ubuntu 24.04 pulls in emacs-gtk -> libgcc-14-dev despite gcc being 13
+    # this breaks libcxx-native and compiler-rt-native builds so tell the user to fix things
+    if glob.glob("/usr/lib/gcc/*/14/libgcc_s.so") and not glob.glob("/usr/lib/gcc/*/14/libstdc++.so"):
+        status.addresult('libgcc-14-dev is installed and not libstdc++-14-dev which will break clang native compiles. Please remove one or install the other.')
+
     required_utilities = d.getVar('SANITY_REQUIRED_UTILITIES')
 
     for util in required_utilities.split():