christian-marie / xxhash

Haskell implementation of the XXHash algorithm
Other
16 stars 7 forks source link

linking failure against ghc-8.10.1 #6

Open l29ah opened 4 years ago

l29ah commented 4 years ago

As it has some xxhash bundled:

xxhash ‰ cabal bench
Build profile: -w ghc-8.10.1 -O1
In order, the following will be built (use -v for more details):
 - xxhash-0.0.2 (bench:bench) (first run)
Preprocessing benchmark 'bench' for xxhash-0.0.2..
Building benchmark 'bench' for xxhash-0.0.2..
Linking /tmp/xxhash/dist-newstyle/build/x86_64-linux/ghc-8.10.1/xxhash-0.0.2/b/bench/build/bench/bench ...
/usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/ghc-8.10.1/rts/libHSrts.a(xxhash.o): in function `XXH32':

/var/tmp/portage/dev-lang/ghc-8.10.1/work/ghc-8.10.1/rts/xxhash.c:321:0: error:
     multiple definition of `XXH32'; /tmp/xxhash/dist-newstyle/build/x86_64-linux/ghc-8.10.1/xxhash-0.0.2/build/libHSxxhash-0.0.2-inplace.a(xxhash.o):xxhash.c:(.text+0x0): first defined here
/usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/ghc-8.10.1/rts/libHSrts.a(xxhash.o): in function `XXH32_update':

/var/tmp/portage/dev-lang/ghc-8.10.1/work/ghc-8.10.1/rts/xxhash.c:437:0: error:
     multiple definition of `XXH32_update'; /tmp/xxhash/dist-newstyle/build/x86_64-linux/ghc-8.10.1/xxhash-0.0.2/build/libHSxxhash-0.0.2-inplace.a(xxhash.o):xxhash.c:(.text+0x1e0): first defined here
/usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/ghc-8.10.1/rts/libHSrts.a(xxhash.o): in function `XXH32_digest_endian':

/var/tmp/portage/dev-lang/ghc-8.10.1/work/ghc-8.10.1/rts/xxhash.c:451:0: error:
     multiple definition of `XXH32_digest'; /tmp/xxhash/dist-newstyle/build/x86_64-linux/ghc-8.10.1/xxhash-0.0.2/build/libHSxxhash-0.0.2-inplace.a(xxhash.o):xxhash.c:(.text+0x460): first defined here
collect2: error: ld returned 1 exit status
`x86_64-pc-linux-gnu-gcc' failed in phase `Linker'. (Exit code: 1)
joeyh commented 3 years ago

ghc bundled it in https://gitlab.haskell.org/ghc/ghc/-/merge_requests/4248

This could be considered a ghc bug I think; it could rename the functions to avoid breaking linking to xxhash3.

christian-marie commented 3 years ago

Interesting, I guess these versions don't need the dependency which is weird. Not sure how to handle this and I don't use this library anymore so won't be working on it. Good luck.