This is kind of a convoluted issue that people seem to stumble upon in different ways, so here's the context I found myself in, and the different solutions I know worked for others, that should be tried before the one I found.

Context:

I was installing luarocks for the first time, using luarocks install luacheck, I then ran into an issue:

sh: line 1: 42931 Abort trap: 6           wget --no-check-certificate --no-cache --user-agent="LuaRocks/3.9.2 macosx-x86_64 via wget" --quiet --timeout=30 --tries=1 --timestamping 'https://luarocks.org/manifest-5.4.zip' > /dev/null 2> /dev/null
...
Warning: Failed searching manifest: Failed downloading https://raw.githubusercontent.com/rocks-moonscript-org/moonrocks-mirror/master/manifest-5.4
...
Error: No results matching query were found for Lua 5.4.
To check if it is available for other Lua versions, use --check-lua-versions.

When in fact, the package was available. I knew this because clicking the link in the console output returns a file. (You can verify this by seeing if the linked https://raw.githubusercontent.com/... url in the console output returns a file.)

The Problem:

From the advice I found online, I knew I had a problem with wget. When I would run the command wget --version, I would get the following output:

dyld[42978]: Library not loaded: /usr/local/opt/libunistring/lib/libunistring.2.dylib

Since I'm on MacOS, I used brew to reinstall the following packages:

wget: brew reinstall wget gettext: brew reinstall gettext

This seemed to have worked for a lot of people. But for me, the issue persisted.

The specific problem:

One post recommended using the command brew linkage wget to check the package dependencies. I could see:

System libraries:
  /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
  /usr/lib/libSystem.B.dylib
  /usr/lib/libiconv.2.dylib
  /usr/lib/libz.1.dylib
Homebrew libraries:
  /usr/local/opt/gettext/lib/libintl.8.dylib (gettext)
  /usr/local/opt/libidn2/lib/libidn2.0.dylib (libidn2)
> /usr/local/opt/libunistring/lib/libunistring.5.dylib (libunistring) <<< installed
  /usr/local/opt/openssl@3/lib/libcrypto.3.dylib (openssl@3)
  /usr/local/opt/openssl@3/lib/libssl.3.dylib (openssl@3)
Indirect dependencies with linkage:
  gettext
  libunistring

As indicated above, the package that was reported "missing" from the wget commands was clearly installed and marked as a dependency. This meant that wget was not finding the right version of libunistring, since it was looking for libunistring.2.dylib and libunistring.5.dylib was installed and linked.

1

There are 1 answers

0
Maxime Franchot On

SOLUTION:

Based on another post, I decided to create a symlink for version 2 to version 5. I ran this command:

ln -s /usr/local/opt/libunistring/lib/libunistring.5.dylib /usr/local/opt/libunistring/lib/libunistring.2.dylib

And from there, wget --version returned a normal output.

I could then run the original luarocks install luacheck without any issues.