Closed peterjc closed 1 month ago
Thanks for the thorough report. We use pkg-config
to detect most libraries, including libjpeg. You get this one, most likely due to being in your $PATH:
checking for pkg-config... /Users/USERNAME/mambaforge/bin/pkg-config
This pkg-config
finds the libjpeg.dylib
in its own prefix (/Users/USERNAME/mambaforge/
), but when you run Chafa, /Users/USERNAME/mambaforge/lib
is not in the dynamic library search path, so it can't load the library that was configured.
There are several solutions, depending on what you want:
/Users/USERNAME/mambaforge/lib
to your runtime library search path. On Linux, this is LD_LIBRARY_PATH
in the env. On MacOS, I think DYLD_FALLBACK_LIBRARY_PATH
is the one you want./Users/USERNAME/mambaforge/bin
from your $PATH before configuring the build. The system pkg-config will be used instead. It should find the system libjpeg (or none at all).PKG_CONFIG_LIBDIR
or related env variables to look for libraries somewhere else. See man pkg-config
.--enable-rpath
may work too. It should then find the linked libraries regardless of search path. However this is not considered best practice.The first suggestion works for me, thank you:
$ DYLD_FALLBACK_LIBRARY_PATH="/$HOME/mambaforge/lib" chafa --version
Chafa version 1.15.0
Loaders: GIF JPEG PNG QOI SVG TIFF WebP XWD
Features: mmx sse4.1 popcnt avx2
Applying: mmx sse4.1 popcnt avx2
Copyright (C) 2018-2023 Hans Petter Jansson et al.
Incl. libnsgif copyright (C) 2004 Richard Wilson, copyright (C) 2008 Sean Fox
Incl. LodePNG copyright (C) 2005-2018 Lode Vandevenne
Incl. QOI decoder copyright (C) 2021 Dominic Szablewski
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Long term I'd prefer to install chafa from conda (and have some experience with writing recipes for conda-forge), but in the short term I will try this:
$ mv ~/bin/chafa ~/bin/.chafa
$ nano ~/bin/chafa # see below
$ chmod a+x ~/bin/chafa
$ cat ~/bin/chafa
#!/bin/bash
# Wrapper to call the real chafa binary with path magic for libjpeg
DYLD_FALLBACK_LIBRARY_PATH="/$HOME/mambaforge/lib" $HOME/bin/.chafa $@
This appears to be enough to use within offpunk https://offpunk.net/
Attempting to install on macOS Intel, with many libraries installed via conda:
Fetched with git:
Then ran
./autogen.sh --prefix $HOME
Then
make
:Then
make install
Finally tried to run the tool:
The output of
autogen.sh
claims it did findlibjpeg
though. Presumably it found it here: