Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cygwin Gcc error while loading shared libraries?

Tags:

cygwin

I have instaled Cygwin after running MinGW for a while now. But when I try to compile the console gives me:

/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/cc1.exe: error while loading shared libraries: ?: cannot open shared object file: No such file or directory

What does this mean?

like image 593
BRHSM Avatar asked May 08 '15 16:05

BRHSM


4 Answers

I have the same problem and I found the solution.

According to the FAQ of Cygwin

Q: Why is C:\cygwin\usr\bin invisible from windows?

A: Because it does not really exist. In cygwin, /usr/bin is just a link to /bin.

So trying to add "C:\cygwin\usr\bin" to PATH will be in vain.

Add "C:\cygwin64\bin" to PATH instead. Hope this helps :)

like image 144
Raku Escape Avatar answered Nov 19 '22 20:11

Raku Escape


You are missing a library, please run cygcheck /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/cc1.exe or ldd /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/cc1.exe to see what is the missing library.

like image 36
Thronghar Avatar answered Nov 19 '22 21:11

Thronghar


(I'd rather ask a question in the comments first, but I don't have enough reputation yet.)

Your cc1 is unable to load some DLLs it needs to start. Looking at the Cygwin source code, this can be either a library specified in LD_PRELOAD, or -- more probably -- a library the executable depends on. The ? in the error message seems to be the default return value of find_first_notloaded_dll (hookapi.cc), in case the function can't determine what library is missing.

To diagnose the issue, I suggest checking your PATH variable (or even clearing it of any non-Cygwin paths and trying the compilation again) and/or using Dependency Walker to find the missing DLLs (start it from a Cygwin shell, so it can see the same PATH). ldd (included with Cygwin) may also give some clues, but I wouldn't bet on it.

It's possible a clean re-install of Cygwin will be necessary to solve the issue.

like image 1
David Macek Avatar answered Nov 19 '22 19:11

David Macek


Most likely, you are simply missing /usr/bin in the PATH variable. Adding 'export PATH=/usr/bin:$PATH' to your .bashrc file will solve the issue.

like image 1
Frank-Rene Schäfer Avatar answered Nov 19 '22 21:11

Frank-Rene Schäfer