jq: C:/cygwin64/bin/jq.exe: error while loading shared libraries: ?: cannot open shared object

28 Views Asked by At

jq fails with:

$ jq
C:/cygwin64/bin/jq.exe: error while loading shared libraries: ?: cannot open shared object file: No such file or directory

How can I find out which libary was missing?

2

There are 2 best solutions below

0
Ole Tange On

Try strace jq:

$ strace jq
--- Process 15008 created
--- Process 15008 loaded C:\Windows\System32\ntdll.dll at 00007ffa97ab0000
--- Process 15008 loaded C:\Windows\System32\kernel32.dll at 00007ffa97990000
--- Process 15008 loaded C:\Windows\System32\KernelBase.dll at 00007ffa952c0000
--- Process 15008 thread 6216 created
--- Process 15008 thread 14800 created
--- Process 15008 loaded C:\cygwin64\bin\cygjq-1.dll at 00000005be860000
--- Process 15008 loaded C:\cygwin64\bin\cygwin1.dll at 00007ffa2b080000
--- Process 15008 thread 17460 created
--- Process 15008 thread 6216 exited with status 0xc0000135
--- Process 15008 thread 16484 exited with status 0xc0000135
--- Process 15008 thread 14800 exited with status 0xc0000135
--- Process 15008 exited with status 0xc0000135

Finally you get a dialog box that says:

cygonig-5.dll was not found

https://cygwin.com/cgi-bin2/package-grep.cgi?grep=cygoni tells you that this is probably in libonig5, so:

apt-cyg install libonig5

And now jq works.

2
matzeri On

While Ole answer is correct, a more fast solution is to use cygcheck.

$ cygcheck  jq |grep -iv system32
cygcheck: track_down: could not find cygonig-5.dll

Found: C:\cygwin64\bin\jq.exe
C:\cygwin64\bin\jq.exe
  C:\cygwin64\bin\cygjq-1.dll
    C:\cygwin64\bin\cygwin1.dll

Cygcheck will also help to find the proper package to install

$ cygcheck  -p cygonig-5.dll
Found 6 matches for cygonig-5.dll
libonig5-6.9.1-1 - libonig5: Oniguruma regular expressions library (runtime)
libonig5-6.9.4-1 - libonig5: Oniguruma regular expressions library (runtime)
libonig5-6.9.9-1 - libonig5: Regular expressions library (runtime)
...

My general recommendation is to install any Cygwin package using its own setup
https://cygwin.com/setup-x86_64.exe

in this way all the dependencies are properly managed.