Michael
Michael

Reputation: 1012

Cygwin 64 G++ -fuse-linker-plugin Error

I am receiving the following error when I try to compile a very basic C++ program.

$ g++ -fuse-linker-plugin test.cpp
g++: fatal error: -fuse-linker-plugin, but cyglto_plugin.dll not found
compilation terminated.

Code

int main() {
        return 0;
}

This is using G++ installed straight out of a fresh Cygwin installation.

If I search for the file there, it does exist and is located at:

/usr/libexec/gcc/x86_64-pc-cygwin/4.8.2/cyglto_plugin.dll

How do I make Cygwin 64 look at this correctly?

Upvotes: 12

Views: 10370

Answers (4)

Philip Dye
Philip Dye

Reputation: 51

More recently using apt-cyg, g++ 4.9.2 was installed but gcc-core 4.8.2 remained.

Resolved by:

    apt-cyg remove gcc-g++
    apt-cyg remove gcc-core
    apt-cyg install gcc-g++

Upvotes: 5

user4593924
user4593924

Reputation: 11

Two version of gcc was causing proble, check folder /usr/libexec/gcc/x86_64-pc-cygwin/ there would be two version of gcc. To solve remove one.

Upvotes: 1

hrtednrup
hrtednrup

Reputation: 133

The above answer worked for me, but I got caught by the installer automatically upgrading packages back to 4.8.2. So, I initially thought this didn't work; it actually did. You just need to be aware of that when using the installer to add packages later, it may try to upgrade back to 4.8.2 again and break things.

There is the option to turn off LTO with -fno-use-linker-plugin, but that doesn't do me any good becuase CPAN is what is launching g++. It might serve as a workaround.

(I know this isn't much of an answer, but I was unable to comment)

Upvotes: 0

xnor
xnor

Reputation: 353

I guess you only checked the gcc-g++ package at installation. Note that the version is 4.8.1-3 BUT on the next page you can see a lot of dependencies being installed, for example libgcc with version 4.8.2.

That mix of 4.8.1 and 4.8.2 seems to be the problem.

In the installer, copy all dependencies into an editor, search for 4.8.2 to find the problematic packages, go back in the installer and click those packages until 4.8.1-3 will be installed.

Double check you're not installing the latest version of those packages.

Upvotes: 10

Related Questions