bcache-tools icon indicating copy to clipboard operation
bcache-tools copied to clipboard

build error: undefined reference to `crc64'

Open darmac opened this issue 4 years ago • 4 comments

build bcache-tools faild at version: 1.0.8

log:

/tmp/root/spack-stage/spack-stage-bcache-1.0.8-tnsdfcsyjb6kbe5yraubcegcuk237xuy/spack-src/bcache-super-show.c:117: undefined reference to `crc64'
collect2: error: ld returned 1 exit status
make: *** [<builtin>: bcache-super-show] Error 1
make: *** Waiting for unfinished jobs....
/usr/local/bin/ld: /tmp/ccSk24CW.o: in function `write_sb':
/tmp/root/spack-stage/spack-stage-bcache-1.0.8-tnsdfcsyjb6kbe5yraubcegcuk237xuy/spack-src/make-bcache.c:277: undefined reference to `crc64'
collect2: error: ld returned 1 exit status
make: *** [<builtin>: make-bcache] Error 1

I think we should remove inline to make it linked with other obj? or move crc64 inline code to bcache.h?

# grep -nr "crc64"
bcache.c:118:inline uint64_t crc64(const void *_data, size_t len)
bcache.h:118:uint64_t crc64(const void *_data, size_t len);
bcache.h:124:   crc64(((void *) (i)) + 8, ((void *) end(i)) - (((void *) (i)) + 8))

darmac avatar Mar 19 '20 07:03 darmac

@darmac I suffer the same issue too on CentOS8.0

[root@localhost bcache-tools-1.0.8]# sudo make install cc -O2 -Wall -g pkg-config --cflags uuid blkid make-bcache.c bcache.o pkg-config --libs uuid blkid -o make-bcache /tmp/ccRws7L1.o: In function write_sb': /root/wayne/bcache-tools-1.0.8/make-bcache.c:277: undefined reference to crc64' collect2: error: ld returned 1 exit status make: *** [: make-bcache] Error 1 [root@localhost bcache-tools-1.0.8]# uname -a Linux localhost 4.18.0-80.el8.x86_64 #1 SMP Tue Jun 4 09:19:46 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux [root@localhost bcache-tools-1.0.8]#

anyone can help on this?

gwnet avatar Jul 28 '20 12:07 gwnet

try this patch https://github.com/spack/spack/pull/15563/commits/3a4e304df3f87dfd850f1ca60a5fd8ff6dca4dfa#diff-893b0c35d1b8543f1dd4a62ad2bec568

darmac avatar Jul 28 '20 13:07 darmac

@darmac buddy, could you please show me the detail command that I can merge your this patch?

gwnet avatar Jul 28 '20 13:07 gwnet

some one already open an issue like this: https://github.com/g2p/bcache-tools/issues/30 you can use patch command to apply these patches.

darmac avatar Jul 29 '20 01:07 darmac