BRHSM
BRHSM

Reputation: 884

Cygwin Gcc error while loading shared libraries?

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?

Upvotes: 17

Views: 47332

Answers (10)

uldics
uldics

Reputation: 134

Got same issue with some months old installation of Cygwin. Needed to get an IP address to servername and installed dig (apt-cyg install bind-utils), but the dig command did not work, threw a similar error. Solution that worked for me - just download a new Cygwin installer and run it with Next, Next, Next. It removed some packages old versions and installed newer versions. After that all worked for me. No need to fiddle with PATH or symlinks between weird places or hunting down what is missing. Apparently as Cygwin has no real update or package management system, it drifts away with time to what is expected in dependencies. Luckily fresh install does the same as a typical "sudo apt update" would.

Upvotes: 0

if you have both mingw and cygwin in your system,In the environment variable remove all mingW and just add C:\cygwin64\bin in both system varaible and user variable

Upvotes: 0

Pysis
Pysis

Reputation: 1586

Just had this problem trying to compile a package with make and it wanted some cygguile dll file that was just installed along with make.

My solution was I had not only migrated my cygwin64 directory across drives because the sector sizes were mismatched for some reason even though the drivers were both under 2TB and should have been using 512 byte sector sizes.. So I had to install a new system and move files over there, might have had weird permissions on them.

Also had to patch cygwin1.dll end of Jan 2020 because of a recent input problem in ConEmu with Windows 10 1903 build, but just did it again with this working so that doesn't seem to be the issue.

Reinstalling cygwin by deleting that entire directory, taking ownership of it first.., seemed to work now...

Upvotes: 0

Wim Yedema
Wim Yedema

Reputation: 41

Adding some background info. I had the same problem when building my own program and linking it against graphviz cgraph.dll. Turns out this is related to where windows searches for DLLs (see here: https://msdn.microsoft.com/en-us/library/7d83bc18.aspx) So adding the path of your missing library to PATH should fix the problem.

It is unfortunate that the message doesn't include the name of the library. Luckily cmd.exe DOES give you this name (so it's good for something after all;)

Upvotes: 1

Mushir
Mushir

Reputation: 1349

I also came this error on windows machine while executing .exe file generated by scilab2C i.e toolbox for Scilab

For Windows 32 bit Add the environment variable path as follow :

C:\cygwin\usr\i686-pc-cygwin\bin

Hope so this will solve your issue.

Upvotes: 1

Raku Escape
Raku Escape

Reputation: 266

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 :)

Upvotes: 16

Frank-Rene Schäfer
Frank-Rene Schäfer

Reputation: 3352

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.

Upvotes: 0

Thronghar
Thronghar

Reputation: 467

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.

Upvotes: 9

David Macek
David Macek

Reputation: 917

(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.

Upvotes: 1

Imanol Fotia
Imanol Fotia

Reputation: 47

Are you including the path to your lib directory? Looks like you are not

I'm not very familiar with Cygwin, I mainly use MinGW, but I think the error message speaks for itself

Upvotes: 0

Related Questions