[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#957816: slurm-llnl: ftbfs with GCC-10



tags 957816 +patch
thanks

The build failures are caused by a change to default behaviour in gcc-10, previous versions of gcc defaulted to
-fcommon which allows a variable to be definined in multiple compilation units. gcc-10 on the other hand defaults
to -fno-common.

There seem to be two seperate cases. For some of the variables the extra definitions seem to be deliberate, in these
cases I added an explicit attribute to the variables in question.

On the other hand for the remaining variable it seems to be a clasic case of someone defining a variable in a header
rather than declaring it in a header and defining it in the corresponding C file. In this case I moved the definiton
to the C file.

A debdiff is attatched, I may or may not NMU this later.
diff -Nru slurm-llnl-19.05.5/debian/changelog slurm-llnl-19.05.5/debian/changelog
--- slurm-llnl-19.05.5/debian/changelog	2020-03-24 09:58:42.000000000 +0000
+++ slurm-llnl-19.05.5/debian/changelog	2020-08-22 22:59:50.000000000 +0000
@@ -1,3 +1,12 @@
+slurm-llnl (19.05.5-2.1) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * Add __attribute__((__common__)) to some "tentative import"
+    declarations in src/plugins/select/cons_tres/job_test.c
+  * Move definiton of "opt" from scanel.h to scanel.c
+
+ -- Peter Michael Green <plugwash@debian.org>  Sat, 22 Aug 2020 22:59:50 +0000
+
 slurm-llnl (19.05.5-2) unstable; urgency=medium
 
   * Declare libslurm-dev Breaks+Replaces relation with the old
diff -Nru slurm-llnl-19.05.5/debian/patches/gcc10.patch slurm-llnl-19.05.5/debian/patches/gcc10.patch
--- slurm-llnl-19.05.5/debian/patches/gcc10.patch	1970-01-01 00:00:00.000000000 +0000
+++ slurm-llnl-19.05.5/debian/patches/gcc10.patch	2020-08-22 22:59:50.000000000 +0000
@@ -0,0 +1,73 @@
+Description: Fix build with gcc-10
+ Add __attribute__((__common__)) to some "tentative import"
+ declarations in src/plugins/select/cons_tres/job_test.c
+ and move defintion of opt from scanel.h to scanel.c
+ 
+ older versions of gcc defaulted to -fcommon which allows
+ a global variable to be declared in multiple places, 
+ gcc-10 requires this to be specified explicitly either
+ through a command line option or functiona attributes.
+
+ In most cases multiple defintions of the same global
+ variable are a mistake, but in the case of those in
+ job_test.c it appears to be deliberate, so this patch
+ adds the attribute.
+
+ On the other hand the one in scanel.h looks like a
+ classic case of a defintion that should be moved
+ from a h file to the corresponding c file.
+
+Author: Peter Michael Green <plugwash@debian.org>
+
+Index: slurm-llnl-19.05.5/src/plugins/select/cons_tres/job_test.c
+===================================================================
+--- slurm-llnl-19.05.5.orig/src/plugins/select/cons_tres/job_test.c
++++ slurm-llnl-19.05.5/src/plugins/select/cons_tres/job_test.c
+@@ -52,10 +52,17 @@ extern bitstr_t *idle_node_bitmap __attr
+ extern struct node_record *node_record_table_ptr __attribute__((weak_import));
+ extern List job_list __attribute__((weak_import));
+ #else
+-slurmctld_config_t slurmctld_config;
+-bitstr_t *idle_node_bitmap;
+-struct node_record *node_record_table_ptr;
+-List job_list;
++#if __GNUC__ >= 10
++//gcc 10 needs __attribute__((__common)) for these tenative defintions
++//to compile.
++#define COMMONATTRIBUTE __attribute__((__common__))
++#else
++#define COMMONATTRIBUTE
++#endif
++slurmctld_config_t slurmctld_config COMMONATTRIBUTE;
++bitstr_t *idle_node_bitmap COMMONATTRIBUTE;
++struct node_record *node_record_table_ptr COMMONATTRIBUTE;
++List job_list COMMONATTRIBUTE;
+ #endif
+ 
+ typedef enum {
+Index: slurm-llnl-19.05.5/src/scancel/scancel.c
+===================================================================
+--- slurm-llnl-19.05.5.orig/src/scancel/scancel.c
++++ slurm-llnl-19.05.5/src/scancel/scancel.c
+@@ -61,6 +61,8 @@
+ #include "src/common/xmalloc.h"
+ #include "src/scancel/scancel.h"
+ 
++opt_t opt;
++
+ #define MAX_CANCEL_RETRY 10
+ #define MAX_THREADS 10
+ 
+Index: slurm-llnl-19.05.5/src/scancel/scancel.h
+===================================================================
+--- slurm-llnl-19.05.5.orig/src/scancel/scancel.h
++++ slurm-llnl-19.05.5/src/scancel/scancel.h
+@@ -75,7 +75,7 @@ typedef struct scancel_options {
+ 	bool *job_pend;		/* Set fi job is pending	*/
+ } opt_t;
+ 
+-opt_t opt;
++extern opt_t opt;
+ 
+ /* process options:
+  * 1. set defaults
diff -Nru slurm-llnl-19.05.5/debian/patches/series slurm-llnl-19.05.5/debian/patches/series
--- slurm-llnl-19.05.5/debian/patches/series	2020-03-24 01:02:56.000000000 +0000
+++ slurm-llnl-19.05.5/debian/patches/series	2020-08-22 22:59:50.000000000 +0000
@@ -7,3 +7,4 @@
 fix-perl-doc
 use-python3
 miscellanea-manpages
+gcc10.patch

Reply to: