Brotli's dynamic library files use @loader_path within instead of full path #400

Open
opened 2026-01-29 20:43:16 +00:00 by claunia · 0 comments
Owner

Originally created by @kiracus on GitHub (Oct 17, 2021).

I notice this issue when run brew install mpv --HEAD

Since recent change from homebrew, jpeg-xl becomes one of dependencies of aom, ffmpeg, mpv, and since brotli is part of jpeg-xl, so I notice this issue during buliding mpv

The error during building mpv is

error: /Library/Developer/CommandLineTools/usr/bin/otool-classic: can't open file: @loader_path/libbrotlicommon.1.dylib (No such file or directory)

so I dig into the builing script itself.

it seems the building script will run

otool -L 'blabla/dylib' | grep -e '	' | awk '{ print $1 }'

to get the path for all dependencies' dynamic library files

Every other dynamic library works well, execpet for libbrotlidec.1.dylib and libbrotlienc.1.dylib

those outputs are

otool -L '/usr/local/opt/brotli/lib/libbrotlidec.1.dylib' | grep -e '	' | awk '{ print $1 }'
/usr/local/opt/brotli/lib/libbrotlidec.1.dylib
@loader_path/libbrotlicommon.1.dylib
/usr/lib/libSystem.B.dylib

and

otool -L '/usr/local/opt/brotli/lib/libbrotlienc.1.dylib' | grep -e '	' | awk '{ print $1 }'
/usr/local/opt/brotli/lib/libbrotlienc.1.dylib
@loader_path/libbrotlicommon.1.dylib
/usr/lib/libSystem.B.dylib

The issue is very similar with this stackoverflow thread.

And a workaround is fixing libbrotlidec.1.dylib and libbrotlienc.1.dylib by

install_name_tool -change "@loader_path/libbrotlicommon.1.dylib" "/usr/local/opt/brotli/lib/libbrotlicommon.1.dylib" /usr/local/opt/brotli/lib/libbrotlidec.1.dylib
install_name_tool -change "@loader_path/libbrotlicommon.1.dylib" "/usr/local/opt/brotli/lib/libbrotlicommon.1.dylib" /usr/local/opt/brotli/lib/libbrotlienc.1.dylib

After applying the workaround, the building script works fine.

I check homebrew's installation script for brotli and I don't think anything seems broken from homebrew side.

Is there anything brotli team could take a look at it? Would you mind always using the full path?

Thanks

Originally created by @kiracus on GitHub (Oct 17, 2021). I notice this issue when run `brew install mpv --HEAD` Since [recent change](https://github.com/Homebrew/homebrew-core/commit/093d8417e3fd32137e878dce7cb1f92d6df3fcb7) from homebrew, `jpeg-xl` becomes one of dependencies of `aom`, `ffmpeg`, `mpv`, and since `brotli` is part of `jpeg-xl`, so I notice this issue during buliding `mpv` The error during building `mpv` is ``` error: /Library/Developer/CommandLineTools/usr/bin/otool-classic: can't open file: @loader_path/libbrotlicommon.1.dylib (No such file or directory) ``` so I dig into the builing script itself. it seems the building script will run ``` otool -L 'blabla/dylib' | grep -e ' ' | awk '{ print $1 }' ``` to get the path for all dependencies' dynamic library files Every other dynamic library works well, execpet for `libbrotlidec.1.dylib` and `libbrotlienc.1.dylib` those outputs are ``` otool -L '/usr/local/opt/brotli/lib/libbrotlidec.1.dylib' | grep -e ' ' | awk '{ print $1 }' ``` ``` /usr/local/opt/brotli/lib/libbrotlidec.1.dylib @loader_path/libbrotlicommon.1.dylib /usr/lib/libSystem.B.dylib ``` and ``` otool -L '/usr/local/opt/brotli/lib/libbrotlienc.1.dylib' | grep -e ' ' | awk '{ print $1 }' ``` ``` /usr/local/opt/brotli/lib/libbrotlienc.1.dylib @loader_path/libbrotlicommon.1.dylib /usr/lib/libSystem.B.dylib ``` The issue is very similar with [this stackoverflow thread](https://stackoverflow.com/questions/1937232/). And a workaround is fixing `libbrotlidec.1.dylib` and `libbrotlienc.1.dylib` by ``` install_name_tool -change "@loader_path/libbrotlicommon.1.dylib" "/usr/local/opt/brotli/lib/libbrotlicommon.1.dylib" /usr/local/opt/brotli/lib/libbrotlidec.1.dylib install_name_tool -change "@loader_path/libbrotlicommon.1.dylib" "/usr/local/opt/brotli/lib/libbrotlicommon.1.dylib" /usr/local/opt/brotli/lib/libbrotlienc.1.dylib ``` After applying the workaround, the building script works fine. I check homebrew's [installation script](https://github.com/Homebrew/homebrew-core/blob/fe16935832089d75b702bd258e6e6068526ac08a/Formula/brotli.rb) for `brotli` and I don't think anything seems broken from homebrew side. Is there anything `brotli` team could take a look at it? Would you mind always using the full path? Thanks
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/brotli#400