Skip to contentSkip to conversation

python3-matplotlib: Use lld for linking when using clang

PATCH In review Khem Raj 2 participants 5 messages Aug 12, 2020 – Aug 13, 2020

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/3 python3-matplotlib: Use lld for linking when using clang

build uses LTO and for some reason it does not work well when using clang-11

Fixes

| /mnt/b/yoe/master/build/tmp/work/armv7vet2hf-neon-yoe-linux-musleabi/python3-matplotlib/3.3.0-r0/recipe-sysroot-nat ive/usr/bin/arm-yoe-linux-musleabi/arm-yoe-linux-musleabi-ld.gold: error: /mnt/b/yoe/master/build/tmp/work/armv7vet2h f-neon-yoe-linux-musleabi/python3-matplotlib/3.3.0-r0/build/temp.linux-x86_64-3.8/extern/agg24-svn/src/agg_bezier_arc .o: not an object or archive

---
 .../recipes-devtools/python/python3-matplotlib_3.3.0.bb        | 3 +++
 1 file changed, 3 insertions(+)
meta-python/recipes-devtools/python/python3-matplotlib_3.3.0.bb +3 -0
index 2e88efb563..bc2054a4d7 100644
@@ -23,6 +23,9 @@ SRC_URI[sha256sum] = "24e8db94948019d531ce0bcd637ac24b1c8f6744ac86d2aa0eb6dbaeb1
 
 inherit pypi setuptools3 pkgconfig
 
+# LTO with clang needs lld
+LDFLAGS_append_toolchain-clang = " -fuse-ld=lld"
+
 RDEPENDS_${PN} = "\
     freetype \
     libpng \
Signature · 1 line
2.28.0
author
#1 lore raw

PATCH 2/3 lcdproc: Fix compilation with GCC >= 10.x

---
 .../0001-Fix-compilation-with-GCC-10.x.patch  | 46 +++++++++++++++++++
 .../recipes-extended/lcdproc/lcdproc_git.bb   |  1 +
 2 files changed, 47 insertions(+)
 create mode 100644 meta-oe/dynamic-layers/meta-python/recipes-extended/lcdproc/lcdproc/0001-Fix-compilation-with-GCC-10.x.patch
meta-oe/dynamic-layers/meta-python/recipes-extended/lcdproc/lcdproc/0001-Fix-compilation-with-GCC-10.x.patch new file +46 -0
new file mode 100644
index 0000000000..35634dd9ba
@@ -0,0 +1,46 @@
+From 9b07f6a472c24f5e1b65746756764391be0d55e4 Mon Sep 17 00:00:00 2001
+From: Harald Geyer <[email protected]>
+Date: Mon, 10 Feb 2020 13:15:10 +0100
+Subject: [PATCH] Fix compilation with GCC >= 10.x
+
+Starting with GCC >= 10.x, -fno-common is used as default
+instead of -fcommon. This patch fixes the compilation.
+
+Closes: #148
+
+Upstream-Status: Backport
+Suggested-by: Conrad Kostecki <[email protected]>
+Signed-off-by: Harald Geyer <[email protected]>
+---
+ clients/lcdproc/iface.c | 1 +
+ clients/lcdproc/iface.h | 2 +-
+ 2 files changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/clients/lcdproc/iface.c b/clients/lcdproc/iface.c
+index 40e50cb7..1ac355bd 100644
+--- a/clients/lcdproc/iface.c
++++ b/clients/lcdproc/iface.c
+@@ -32,6 +32,7 @@
+ #define UNSET_INT -1
+ #define UNSET_STR "\01"
+ 
++IfaceInfo iface[MAX_INTERFACES];
+ 
+ static int iface_count = 0;	/* number of interfaces */
+ static char unit_label[10] = "B";	/* default unit label is Bytes */
+diff --git a/clients/lcdproc/iface.h b/clients/lcdproc/iface.h
+index cc6dbaaf..c1bd6b5b 100644
+--- a/clients/lcdproc/iface.h
++++ b/clients/lcdproc/iface.h
+@@ -18,7 +18,7 @@
+ /** max number of interfaces in multi-interface mode */
+ #define MAX_INTERFACES 3
+ 
+-IfaceInfo iface[MAX_INTERFACES];	/* interface info */
++extern IfaceInfo iface[MAX_INTERFACES];	/* interface info */
+ 
+ /** Update screen content */
+ int iface_screen(int rep, int display, int *flags_ptr);
+-- 
+2.28.0
+
meta-oe/dynamic-layers/meta-python/recipes-extended/lcdproc/lcdproc_git.bb +1 -0
index 275b984e47..35585d0690 100644
@@ -15,6 +15,7 @@ SRC_URI = "git://github.com/lcdproc/lcdproc \
            file://0001-Fix-parallel-build-fix-port-internal-make-dependenci.patch \
            file://0002-Include-limits.h-for-PATH_MAX-definition.patch \
            file://0003-Fix-non-x86-platforms-on-musl.patch \
+           file://0001-Fix-compilation-with-GCC-10.x.patch \
            "
 
 S = "${WORKDIR}/git"
Signature · 1 line
2.28.0
author
#2 lore raw

PATCH 3/3 python3-pandas: Add workaround to fix build with clang

In reply to Khem Raj

This is a bug introduced by cython [1]
the workaround suppressed the additional warnings seen with clang [2]

[1] https://github.com/cython/cython/issues/3474
[2] https://github.com/pandas-dev/pandas/issues/33239

---
 meta-python/recipes-devtools/python/python3-pandas_1.1.0.bb | 2 ++
 1 file changed, 2 insertions(+)
meta-python/recipes-devtools/python/python3-pandas_1.1.0.bb +2 -0
index f100677caa..7d65287cb0 100644
@@ -15,6 +15,8 @@ DEPENDS += " \
     ${PYTHON_PN}-numpy-native ${PYTHON_PN}-cython-native \
 "
 
+CFLAGS_append_toolchain-clang = " -Wno-error=deprecated-declarations"
+
 RDEPENDS_${PN} += " \
     ${PYTHON_PN}-json \
     ${PYTHON_PN}-numpy \
Signature · 1 line
2.28.0
Acked-by on v1 3/3
#3 lore raw

Re: [oe] [meta-python][PATCH 3/3] python3-pandas: Add workaround to fix build with clang

Quoted 7 lines · Khem Raj

This is a bug introduced by cython [1]
the workaround suppressed the additional warnings seen with clang [2]

[1] https://github.com/cython/cython/issues/3474
[2] https://github.com/pandas-dev/pandas/issues/33239

Quoted 19 lines
---
  meta-python/recipes-devtools/python/python3-pandas_1.1.0.bb | 2 ++
  1 file changed, 2 insertions(+)
meta-python/recipes-devtools/python/python3-pandas_1.1.0.bb +2 -0
index f100677caa..7d65287cb0 100644
@@ -15,6 +15,8 @@ DEPENDS += " \
      ${PYTHON_PN}-numpy-native ${PYTHON_PN}-cython-native \
  "
 
+CFLAGS_append_toolchain-clang = " -Wno-error=deprecated-declarations"
+
  RDEPENDS_${PN} += " \
      ${PYTHON_PN}-json \
      ${PYTHON_PN}-numpy \
Acked-by on v1 1/3
#4 lore raw
In reply to Khem Raj
Quoted 11 lines · Khem Raj

build uses LTO and for some reason it does not work well when using clang-11

Fixes

| /mnt/b/yoe/master/build/tmp/work/armv7vet2hf-neon-yoe-linux-musleabi/python3-matplotlib/3.3.0-r0/recipe-sysroot-nat ive/usr/bin/arm-yoe-linux-musleabi/arm-yoe-linux-musleabi-ld.gold: error: /mnt/b/yoe/master/build/tmp/work/armv7vet2h f-neon-yoe-linux-musleabi/python3-matplotlib/3.3.0-r0/build/temp.linux-x86_64-3.8/extern/agg24-svn/src/agg_bezier_arc .o: not an object or archive

Quoted 20 lines
---
  .../recipes-devtools/python/python3-matplotlib_3.3.0.bb        | 3 +++
  1 file changed, 3 insertions(+)
meta-python/recipes-devtools/python/python3-matplotlib_3.3.0.bb +3 -0
index 2e88efb563..bc2054a4d7 100644
@@ -23,6 +23,9 @@ SRC_URI[sha256sum] = "24e8db94948019d531ce0bcd637ac24b1c8f6744ac86d2aa0eb6dbaeb1
 
  inherit pypi setuptools3 pkgconfig
 
+# LTO with clang needs lld
+LDFLAGS_append_toolchain-clang = " -fuse-ld=lld"
+
  RDEPENDS_${PN} = "\
      freetype \
      libpng \