Zstd: Undefined reference to ZSTD_XXH64_reset while using zstd_decompress

Created on 7 Jan 2020  路  2Comments  路  Source: facebook/zstd

Hi,

I am trying to integrate zstd to a codebase, to use ZSTD_compress and ZSTD_decompress. Build is complaining about undefined reference to ZSTD_XXH64_digest, ZSTD_XXH64_reset and ZSTD_XXH64_update. I see only definitions of xxH64_(digest/reset/update). Are these ZSTD_xxH64_* versions autogenereated? Where can I get these and link them?

src/unix/zstd/zstd_decompress.o: In function ZSTD_decompressContinue.part.9': zstd_decompress.c:(.text+0xecd): undefined reference toZSTD_XXH64_digest'
zstd_decompress.c:(.text+0xf96): undefined reference to ZSTD_XXH64_reset' zstd_decompress.c:(.text+0x129a): undefined reference toZSTD_XXH64_update'
src/unix/zstd/zstd_decompress.o: In function ZSTD_decompressContinue': zstd_decompress.c:(.text+0x278d): undefined reference toZSTD_XXH64_digest'
zstd_decompress.c:(.text+0x296e): undefined reference to ZSTD_XXH64_reset' zstd_decompress.c:(.text+0x2b9a): undefined reference toZSTD_XXH64_update'
src/unix/zstd/zstd_decompress.o: In function ZSTD_decompressMultiFrame': zstd_decompress.c:(.text+0x365a): undefined reference toZSTD_XXH64_reset'
zstd_decompress.c:(.text+0x385a): undefined reference to ZSTD_XXH64_update' zstd_decompress.c:(.text+0x391a): undefined reference toZSTD_XXH64_digest'
src/unix/zstd/zstd_decompress.o: In function ZSTD_decompress_usingDict': zstd_decompress.c:(.text+0x42b2): undefined reference toZSTD_XXH64_reset'
zstd_decompress.c:(.text+0x4499): undefined reference to ZSTD_XXH64_update' zstd_decompress.c:(.text+0x454d): undefined reference toZSTD_XXH64_digest'
src/unix/zstd/zstd_decompress.o: In function ZSTD_decompressStream': zstd_decompress.c:(.text+0x60ca): undefined reference toZSTD_XXH64_reset'
src/unix/zstd/zstd_decompress.o: In function ZSTD_decompressStream_simpleArgs': zstd_decompress.c:(.text+0x6d3f): undefined reference toZSTD_XXH64_reset'

Thanks in advance.

build issue question

Most helpful comment

Hi @nand28,

Can you describe how you've integrated and built Zstd into your project?

These symbols are declared in lib/common/xxhash.h and defined in lib/common/xxhash.c. There is some trickiness going on though: xxHash has a capability, through the XXH_NAMESPACE macro, to rename all of the symbols it defines. Zstd uses this to avoid symbol collisions when libzstd is linked into a project that itself uses xxHash, by setting the compiler option -DXXH_NAMESPACE=ZSTD_ in its build scripts.

It seems like in part of your build this macro was set, but in another part it wasn't? If you switched build patterns, maybe simply make clean and make again (or equivalent) will fix the problem?

All 2 comments

Hi @nand28,

Can you describe how you've integrated and built Zstd into your project?

These symbols are declared in lib/common/xxhash.h and defined in lib/common/xxhash.c. There is some trickiness going on though: xxHash has a capability, through the XXH_NAMESPACE macro, to rename all of the symbols it defines. Zstd uses this to avoid symbol collisions when libzstd is linked into a project that itself uses xxHash, by setting the compiler option -DXXH_NAMESPACE=ZSTD_ in its build scripts.

It seems like in part of your build this macro was set, but in another part it wasn't? If you switched build patterns, maybe simply make clean and make again (or equivalent) will fix the problem?

Thanks Felix :) Make clean worked

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vade picture vade  路  3Comments

sergeevabc picture sergeevabc  路  3Comments

TheSil picture TheSil  路  3Comments

terrelln picture terrelln  路  3Comments

escalade picture escalade  路  3Comments