markfasheh / duperemove

Tools for deduping file systems
GNU General Public License v2.0
816 stars 81 forks source link

FTBFS with GCC 10: multiple definition of `alloc__mutex' #229

Closed thiagomacieira closed 4 years ago

thiagomacieira commented 4 years ago
/usr/bin/ld: find_dupes.o:/builddir/build/BUILD/duperemove-0.11.1/find_dupes.c:337: multiple definition of `alloc__mutex'; hash-tree.o:/builddir/build/BUILD/duperemove-0.11.1/hash-tree.c:39: first defined here
collect2: error: ld returned 1 exit status
make: *** [Makefile:83: duperemove] Error 1
make: *** Waiting for unfinished jobs....
/usr/bin/ld: filerec.o:/builddir/build/BUILD/duperemove-0.11.1/filerec.c:53: multiple definition of `alloc__mutex'; hash-tree.o:/builddir/build/BUILD/duperemove-0.11.1/hash-tree.c:39: first defined here
/usr/bin/ld: results-tree.o:/builddir/build/BUILD/duperemove-0.11.1/results-tree.c:39: multiple definition of `alloc__mutex'; hash-tree.o:/builddir/build/BUILD/duperemove-0.11.1/hash-tree.c:39: first defined here
collect2: error: ld returned 1 exit status
make: *** [Makefile:119: hashstats] Error 1
thiagomacieira commented 4 years ago
#define declare_alloc_tracking(_type)                   \
GMutex  alloc_##_mutex;                         \
unsigned long long num_##_type = 0;                 \
unsigned long long max_##_type = 0;                 \

The mutex variable looks wrong. You're concatenating two tokens in the preprocessor but neither is the macro parameter, like it is on all the other declarations.

Either way, please either make them static or, if the mutex is really meant to be shared, make it extern and define it in a single .c file.

lorddoskias commented 4 years ago

This should be fixed in trunk.