https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100160
Thomas Schwinge <tschwinge at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2023-05-19 Keywords| |openacc, openmp CC| |tschwinge at gcc dot gnu.org Ever confirmed|0 |1 Status|UNCONFIRMED |NEW --- Comment #3 from Thomas Schwinge <tschwinge at gcc dot gnu.org> --- (In reply to Brecht Sanders from comment #0) > Several issues when using GCC built against MinGW-w64 for Windows to compile > gomp test code (see attached minimal source code). > > Code compiles fine with: > g++ -c -o test.o test.cpp -fopenmp -foffload=nvptx-none > > Linking fails when done like this: > g++ -o test.exe test.o -lgomp > mkoffload: fatal error: either '-fopenacc' or '-fopenmp' must be set > compilation terminated. > lto-wrapper.exe: fatal error: > d:/prog/winlibs64-10.3.0/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/10.3. > 0//accel/nvptx-none/mkoffload.exe returned 1 exit status > compilation terminated. > d:/prog/winlibs64-10.3.0/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../ > ../../../x86_64-w64-mingw32/bin/ld.exe: error: lto-wrapper failed > collect2.exe: error: ld returned 1 exit status Link with '-fopenacc' or '-fopenmp' instead of '-lgomp'. > Avoiding LTO seems to work around this and the following links fine: > g++ -o test.exe test.o -fno-lto -lgomp That's because "-fno-lto effectively disables offloading" (PR109819). > When executing test.exe the output starts with: > libgomp: while loading libgomp-plugin-nvptx.so.1: > "libgomp-plugin-nvptx.so.1": The specified module could not be found. > > The correct file on Windows is libgomp-plugin-nvptx-1.dll, not > libgomp-plugin-nvptx.so.1 ACK. GCC's OpenACC/OpenMP code offloading has only been implemented for/tested on GNU/Linux systems. Windows support can certainly be added, but it needs someone to do it.