Mingw x64 Windows: plugin needed to handle lto object
Asked Answered
A

1

14

When I'm trying to compile my project with 64-bit mingw (x86_64-5.1.0-posix-seh-rt_v4-rev0) I got messages:

BFD: my/project/dir/filename.cpp.obj: plugin needed to handle lto object

for each source file. Yet when I compile with 32-bit mingw(i686-5.1.0-posix-dwarf-rt_v4-rev0), everething is OK.

My flags are:

CXX_FLAGS "-fno-exceptions -fno-rtti -std=c++14 -O3 -fstrict-aliasing -flto -fomit-frame-pointer -march=native -ffast-math -funroll-loops"
LINKER_FLAGS "-O1 -s"

I tried to add -fuse-linker-plugin and -fno-use-linker-plugin, but it didn't help. My OS is 64-bit Windows 10. I use CLion and CMake if it matters, though it shouldn't. How can I fix it?

Amman answered 26/8, 2015 at 8:10 Comment(0)
P
15

Put the LTO plugin into the bfd-plugins directory:

mkdir mingw64\lib\bfd-plugins
cp mingw64\libexec\gcc\x86_64-w64-mingw32\5.1.0\liblto_plugin-0.dll mingw64\lib\bfd-plugins\liblto_plugin-0.dll
Phalange answered 8/9, 2015 at 15:32 Comment(4)
Do you know why this isn't done during installation?Amman
I think that's because there exist multiple plugins (gcc/llvm), but only one can be loaded automatically so far.Phalange
That seems to not work anymore (as of version 7.1.0 of MinGW64).Urbanite
That doesn't work when the -Wa,-mbig-obj assembler flag is enabled. It seems to be a bug: bugs.archlinux.org/task/53859 .Urbanite

© 2022 - 2024 — McMap. All rights reserved.