undefined reference cross compiling static libraries with LTO under GCC

后端 未结 1 787
失恋的感觉
失恋的感觉 2021-01-17 15:16

I am attempting to use GCC 4.9.2 to cross compile an application from Linux (x86_64-pc-linux-gnu) for Windows (x86_64-w64-mingw32).

When building targets that link a

相关标签:
1条回答
  • 2021-01-17 16:16

    I'm able to reproduce this linking problem on Mingw32-gcc 4.9.2 under Win7 64-bit. However, I did get it to link successfully by adding -ffat-lto-objects as a workaround:

    g++ -flto -o foo.o -c foo.cpp
    g++ -flto -ffat-lto-objects -o bar.o -c bar.cpp
    ar rc bar.a bar.o
    g++ -flto -o foo.exe foo.o bar.a
    
    0 讨论(0)
提交回复
热议问题