Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

undefined symbol BrotliEncoderDestroyPreparedDictionary #1097

Closed
0x-2a opened this issue Nov 1, 2023 · 5 comments
Closed

undefined symbol BrotliEncoderDestroyPreparedDictionary #1097

0x-2a opened this issue Nov 1, 2023 · 5 comments

Comments

@0x-2a
Copy link

0x-2a commented Nov 1, 2023

After fresh pull and cmake of 1.1.0 am seeing a symbol lookup error for BrotliEncoderDestroyPreparedDictionary. Are there additional build args needed?

OS: Amazon Linux 2023
Arch: x86

wget https://github.com/google/brotli/archive/refs/tags/v1.1.0.tar.gz
tar -xvzf v1.1.0.tar.gz
cd brotli-1.1.0/

mkdir out && cd out
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=./installed ..
cmake --build . --config Release --target install

./install-files/bin/brotli --version
brotli 1.1.0
./install-files/bin/brotli: symbol lookup error: ./install-files/bin/brotli: undefined symbol: BrotliEncoderDestroyPreparedDictionary
@eustas
Copy link
Collaborator

eustas commented Nov 3, 2023

Will check soon. Thanks for the heads-up.

@eustas
Copy link
Collaborator

eustas commented Nov 3, 2023

The problem is that unless you really install brotli, you have to specify LD_LIBRARY_PATH to point to ./installed/lib. Otherwise linked searches and finds system library does not contain mentioned symbol.

@0x-2a
Copy link
Author

0x-2a commented Nov 3, 2023

Oh right, thanks!

@0x-2a 0x-2a closed this as completed Nov 3, 2023
@C-Collamar
Copy link

The problem is that unless you really install brotli, you have to specify LD_LIBRARY_PATH to point to ./installed/lib. Otherwise linked searches and finds system library does not contain mentioned symbol.

@eustas How can I "really install brotli"? Sorry, I'm new to this.

@C-Collamar
Copy link

C-Collamar commented Feb 15, 2024

I get it now. To fix this undefined symbol error by "really" installing brotli, I have to set -DCMAKE_INSTALL_PREFIX to a path where the system usually looks into.

- cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=./installed ..
+ cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local .. 

So when I run Brotli as follows, the error goes away.

LD_LIBRARY_PATH=/usr/local/lib64 brotli --version

Now I only need to figure out how to run Brotli without specifying LD_LIBRARY_PATH every time.

Thanks anyway!


Update:

For others like me who just want to run Brotli without specifying LD_LIBRARY_PATH every time, here's the solution I ended up with.

BROTLI_VERSION="v1.1.0"
INSTALL_PREFIX="/usr/local"
INSTALL_LIBDIR="$INSTALL_PREFIX/lib64/brotli"

# build and install
cmake -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR -DCMAKE_INSTALL_LIBDIR=$INSTALL_LIBDIR -DCMAKE_BUILD_TYPE=Release ..
cmake --build . --config Release --target install

# link the libraries that brotli needs at runtime
echo "$INSTALL_LIBDIR" > "/etc/ld.so.conf.d/brotli-$BROTLI_VERSION.conf"
chmod 644 "/etc/ld.so.conf.d/brotli-$BROTLI_VERSION.conf"
ldconfig

Hope this helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants