markfasheh / duperemove

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

/root/git/duperemove/duperemove.c:457: undefined reference to `__sync_add_and_fetch_8' on ARM #98

Closed eriktews closed 8 years ago

eriktews commented 9 years ago

Hi

When I try to compile duperemove on my Raspberry Pi 2, I get the following error message:

gcc -Wall -ggdb -D_FILE_OFFSET_BITS=64 -DVERSTRING=\"v0.09.5\"  -pthread -I/usr/include/glib-2.0 -I/usr/lib/arm-linux-gnueabihf/glib-2.0/include   -rdynamic duperemove.o hash-tree.o results-tree.o rbtree.o dedupe.o filerec.o btrfs-util.o util.o serialize.o memstats.o csum-gcrypt.o -o duperemove -L/lib/arm-linux-gnueabihf -lgcrypt -pthread -lgthread-2.0 -lrt -lglib-2.0  
duperemove.o: In function `csum_whole_file':
/root/git/duperemove/duperemove.c:457: undefined reference to `__sync_add_and_fetch_8'
collect2: ld returned 1 exit status
Makefile:67: recipe for target 'duperemove' failed
make: *** [duperemove] Error 1

duperemove uses the __sync_add_and_fetch macro in https://github.com/markfasheh/duperemove/blob/f6963d4e89ed60538f36b234e56e99f70c889d0a/file_scan.c#L399 which probably uses some machine instructions that are not available on ARM, so I cannot compile it on my Raspberry Pi 2. The problem in general is discussed here: https://lists.gnu.org/archive/html/gnustep-dev/2015-04/msg00018.html The problem is present in v0.09 as well as in the master branch.

It would be great when I could also compile the utility on my RPI, so I would suggest to either use other instructions here, or alternatively just skip the print for ARM when a better solution is not available.

markfasheh commented 8 years ago

Hey is this still a problem? I got my hands on an RPi 3 and things compile fine on raspbian Jesse. If it doesn't would you mind doing 'make clean; make CFLAGS=-march=pentium;' and see if that helps?

markfasheh commented 8 years ago

Going to close for now sorry it took me so long to get to this. If you still have the problem and care feel free to reopen.

eriktews commented 8 years ago

Hi, so this happens when running debian wheezy, but maybe it is not a problem when a newer version of Debian (and the glibc) is installed, which might provide the macro. Since backwards compatibility with Debian wheezy is not important, I assume it should be fine to keep this bug closed.

By the way, CFLAGS=-march=pentium should never yield in good results on ARM, until now there is no pentium ARM CPU.