Genivia / ugrep

NEW ugrep 6.5: a more powerful, ultra fast, user-friendly, compatible grep. Includes a TUI, Google-like Boolean search with AND/OR/NOT, fuzzy search, hexdumps, searches (nested) archives (zip, 7z, tar, pax, cpio), compressed files (gz, Z, bz2, lzma, xz, lz4, zstd, brotli), pdfs, docs, and more
https://ugrep.com
BSD 3-Clause "New" or "Revised" License
2.59k stars 109 forks source link

building with --enable-static fails on linux #413

Closed stephentalley closed 1 month ago

stephentalley commented 1 month ago

Building from:

148290c Robert van Engelen - 2024/07/09 01:49pm (3 weeks ago) (HEAD -> master, tag: v6.2.0, origin/master, origin/HEAD)
released 6.2.0

Running these commands:

make distclean
./configure --enable-static && make

…produces this error:

/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/libbrotlidec.a(decode.c.o): in function `DecodeLiteralBlockSwitch':
(.text+0x894): undefined reference to `_kBrotliPrefixCodeRanges'
/usr/bin/ld: (.text+0x97b): undefined reference to `_kBrotliContextLookupTable'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/libbrotlidec.a(decode.c.o): in function `SafeDecodeLiteralBlockSwitch':
(.text+0xb58): undefined reference to `_kBrotliPrefixCodeRanges'
/usr/bin/ld: (.text+0xc0a): undefined reference to `_kBrotliPrefixCodeRanges'
/usr/bin/ld: (.text+0xd42): undefined reference to `_kBrotliContextLookupTable'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/libbrotlidec.a(decode.c.o): in function `DecodeCommandBlockSwitch':
(.text+0xedc): undefined reference to `_kBrotliPrefixCodeRanges'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/libbrotlidec.a(decode.c.o): in function `SafeDecodeCommandBlockSwitch':
(.text+0x1155): undefined reference to `_kBrotliPrefixCodeRanges'
/usr/bin/ld: (.text+0x120a): undefined reference to `_kBrotliPrefixCodeRanges'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/libbrotlidec.a(decode.c.o): in function `DecodeDistanceBlockSwitch':
(.text+0x147c): undefined reference to `_kBrotliPrefixCodeRanges'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/libbrotlidec.a(decode.c.o): in function `SafeDecodeDistanceBlockSwitch':
(.text+0x1705): undefined reference to `_kBrotliPrefixCodeRanges'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/libbrotlidec.a(decode.c.o):(.text+0x17ba): more undefined references to `_kBrotliPrefixCodeRanges' follow
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/libbrotlidec.a(decode.c.o): in function `ProcessCommands':
(.text+0x3576): undefined reference to `BrotliTransformDictionaryWord'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/libbrotlidec.a(decode.c.o): in function `SafeProcessCommands':
(.text+0x4111): undefined reference to `BrotliTransformDictionaryWord'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/libbrotlidec.a(decode.c.o): in function `BrotliDecoderDecompressStream':
(.text+0x5097): undefined reference to `_kBrotliContextLookupTable'
/usr/bin/ld: (.text+0x53bc): undefined reference to `_kBrotliPrefixCodeRanges'
/usr/bin/ld: (.text+0x5ad6): undefined reference to `_kBrotliPrefixCodeRanges'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/libbrotlidec.a(state.c.o): in function `BrotliDecoderStateInit':
(.text+0x154): undefined reference to `BrotliGetDictionary'
/usr/bin/ld: (.text+0x160): undefined reference to `BrotliGetTransforms'
/usr/bin/ld: (.text+0x17b): undefined reference to `BrotliDefaultAllocFunc'
/usr/bin/ld: (.text+0x182): undefined reference to `BrotliDefaultFreeFunc'
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:493: ugrep] Error 1
make[2]: Leaving directory '/data/nobackup/git/ugrep/src'
make[1]: *** [Makefile:565: all-recursive] Error 1
make[1]: Leaving directory '/data/nobackup/git/ugrep'
make: *** [Makefile:402: all] Error 2
genivia-inc commented 1 month ago

Sure. When a library is not available in static form or has issues when linked in static form like brotli then this always fails. I've seen this before and there is no easy way to work around it. The static auto-build of ugrep also does not include brotli. You have to exclude brotli:

./build.sh --enable-static --without-brotli