From fb106ee08b57b61378519750753ee9dcc1ac9e19 Mon Sep 17 00:00:00 2001 From: Sergei Trofimovich Date: Sun, 12 Sep 2021 09:35:02 +0100 Subject: [PATCH] libomxil-bellagio: fix build failures against -fno-common compiler On vanilla gcc-10 (and gcc-9 -fno-common) build fails as: ``` ../libtool --tag=CC --mode=link gcc ... -o libomxil-bellagio.la ... ld: .libs/libomxil_bellagio_la-omx_reference_resource_manager.o:(.bss+0x18): multiple definition of `globalIndex'; .libs/libomxil_bellagio_la-st_static_component_loader.o:(.bss+0x358): first defined here ``` Upstream gcc-10 changed the default from -fcommon to fno-common: https://gcc.gnu.org/PR85678. The error also happens if CFLAGS=-fno-common passed explicitly. --- .../libraries/libomxil-bellagio/default.nix | 5 ++- .../libomxil-bellagio/fno-common.patch | 32 +++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 pkgs/development/libraries/libomxil-bellagio/fno-common.patch diff --git a/pkgs/development/libraries/libomxil-bellagio/default.nix b/pkgs/development/libraries/libomxil-bellagio/default.nix index 5e3b0c6798a6..22a6de9fd956 100644 --- a/pkgs/development/libraries/libomxil-bellagio/default.nix +++ b/pkgs/development/libraries/libomxil-bellagio/default.nix @@ -12,7 +12,10 @@ stdenv.mkDerivation rec { configureFlags = lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ "ac_cv_func_malloc_0_nonnull=yes" ]; - patches = [ ./fedora-fixes.patch ]; + patches = [ + ./fedora-fixes.patch + ./fno-common.patch + ]; doCheck = false; # fails diff --git a/pkgs/development/libraries/libomxil-bellagio/fno-common.patch b/pkgs/development/libraries/libomxil-bellagio/fno-common.patch new file mode 100644 index 000000000000..be70391adaae --- /dev/null +++ b/pkgs/development/libraries/libomxil-bellagio/fno-common.patch @@ -0,0 +1,32 @@ +Fix build faiure on gcc-10 (defaults to -fno-common). +--- a/src/omx_reference_resource_manager.c ++++ b/src/omx_reference_resource_manager.c +@@ -30,6 +30,11 @@ + #include "base/omx_base_component.h" + #include "queue.h" + ++int globalIndex; ++NameIndexType *listOfcomponentRegistered; ++ComponentListType **globalComponentList; ++ComponentListType **globalWaitingComponentList; ++ + /** + * This is the static base pointer of the list + */ +--- a/src/omx_reference_resource_manager.h ++++ b/src/omx_reference_resource_manager.h +@@ -49,10 +49,10 @@ struct NameIndexType { + }; + + +-int globalIndex; +-NameIndexType *listOfcomponentRegistered; +-ComponentListType **globalComponentList; +-ComponentListType **globalWaitingComponentList; ++extern int globalIndex; ++extern NameIndexType *listOfcomponentRegistered; ++extern ComponentListType **globalComponentList; ++extern ComponentListType **globalWaitingComponentList; + + OMX_ERRORTYPE RM_RegisterComponent(char *name, int max_components); + OMX_ERRORTYPE addElemToList(ComponentListType **list, OMX_COMPONENTTYPE *openmaxStandComp, int index, OMX_BOOL bIsWaiting);