Summary: | MinGW-w64 of nvptx offload engine fails | ||
---|---|---|---|
Product: | gcc | Reporter: | Brecht Sanders <brechtsanders> |
Component: | target | Assignee: | Not yet assigned to anyone <unassigned> |
Status: | UNCONFIRMED --- | ||
Severity: | normal | CC: | jakub, vries |
Priority: | P3 | Keywords: | openmp |
Version: | 11.2.1 | ||
Target Milestone: | --- | ||
Host: | MinGW-w64 | Target: | nvptx |
Build: | Known to work: | ||
Known to fail: | Last reconfirmed: | ||
Attachments: | libatomic/config.log |
Description
Brecht Sanders
2021-04-27 17:52:35 UTC
Also tried with unpatched binutils 2.36.1, same outcome. Building GCC targetting nvptx (--target=nvptx-none) also stops with the same error. libatomic/config.log reports: configure:3756: checking whether the C compiler works configure:3778: /R/winlibs64_stage/nvptx-gcc-11.1.0/gcc-11.1.0/build_nvptx_gcc/./gcc/xgcc -B/R/winlibs64_stage/nvptx-gcc-11.1.0/gcc-11.1.0/build_nvptx_gcc/./gcc/ -nostdinc -B/R/winlibs64_stage/nvptx-gcc-11.1.0/gcc-11.1.0/build_nvptx_gcc/nvptx-none/newlib/ -isystem /R/winlibs64_stage/nvptx-gcc-11.1.0/gcc-11.1.0/build_nvptx_gcc/nvptx-none/newlib/targ-include -isystem /R/winlibs64_stage/nvptx-gcc-11.1.0/gcc-11.1.0/newlib/libc/include -B/R/winlibs64_stage/inst_nvptx-gcc-11.1.0/share/nvptx-gcc/nvptx-none/bin/ -B/R/winlibs64_stage/inst_nvptx-gcc-11.1.0/share/nvptx-gcc/nvptx-none/lib/ -isystem /R/winlibs64_stage/inst_nvptx-gcc-11.1.0/share/nvptx-gcc/nvptx-none/include -isystem /R/winlibs64_stage/inst_nvptx-gcc-11.1.0/share/nvptx-gcc/nvptx-none/sys-include -g -O2 conftest.c >&5 error reading R:\winlibs64_stage\_TMP_\ccKq7IbV.o collect2.exe: error: ld returned 1 exit status Did you follow https://gcc.gnu.org/wiki/Offloading in particular have you installed nvptx-tools, linked in the right nvptx newlib, added --disable-sjlj-exceptions --enable-newlib-io-long-long ? PTX doesn't use binutils, but uses nvptx-tools instead. My bad, yes I was using nvptx-tools (master from https://github.com/MentorEmbedded/nvptx-tools). my configure command for nvptx offload engine looks like this ./configure --prefix=/R/winlibs64_stage/inst_gcc-offload-nvptx-11.1.0/share/gcc --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --target=nvptx-none --enable-as-accelerator-for=x86_64-w64-mingw32 --with-build-time-tools=/d/Prog/winlibs64_stage/custombuilt/share/nvptx-tools/nvptx-none/bin --with-gnu-as --with-gnu-ld --disable-serial-configure --enable-checking=release --without-libbacktrace --without-included-gettext --without-cuda-driver --enable-multiarch --enable-newlib-io-long-long --enable-linker-build-id --enable-multilib --disable-sjlj-exceptions --disable-libunwind-exceptions --disable-libgomp --enable-languages=c,c++,lto,objc,obj-c++,d So yes, --disable-sjlj-exceptions --enable-newlib-io-long-long is there. Note that the same build scripts worked fine with GCC 10.3.0 and older. If I do: ... $ cat conftest.c int main () { return 0; } ... and copy the corresponding command from libatomic/config.log, and add -v -Wl,-v, I get: ... /home/vries/oacc/trunk/build-gcc-offload-nvptx-none/./gcc/collect2 -L/home/vries/oacc/trunk/build-gcc-offload-nvptx-none/./gcc -L/home/vries/oacc/trunk/build-gcc-offload-nvptx-none/nvptx-none/newlib -L/home/vries/oacc/trunk/install/offload-nvptx-none/nvptx-none/lib -L/home/vries/oacc/trunk/install/offload-nvptx-none/nvptx-none/usr/lib /tmp/ccQ2YOg0.o -v -lgcc -lg -lc -lgcc collect2 version 12.0.0 20210420 (experimental) /home/vries/oacc/trunk/build-gcc-offload-nvptx-none/./gcc/collect-ld -L/home/vries/oacc/trunk/build-gcc-offload-nvptx-none/./gcc -L/home/vries/oacc/trunk/build-gcc-offload-nvptx-none/nvptx-none/newlib -L/home/vries/oacc/trunk/install/offload-nvptx-none/nvptx-none/lib -L/home/vries/oacc/trunk/install/offload-nvptx-none/nvptx-none/usr/lib /tmp/ccQ2YOg0.o -v -lgcc -lg -lc -lgcc Linking /tmp/ccQ2YOg0.o as 0 trying lib libc.a trying lib libg.a trying lib libgcc.a ... Looking into collect-ld, it has: ... ORIGINAL_LD_FOR_TARGET="/home/vries/oacc/trunk/install/offload-nvptx-none/nvptx-none/bin/ld" ... which is a link to nvptx-none-ld: ... $ /home/vries/oacc/trunk/install/offload-nvptx-none/nvptx-none/bin/ld --help Usage: nvptx-none-ld [option...] [files] Options: -o FILE Write output to FILE -v Be verbose -l LIBRARY Link with LIBRARY -L DIR Search for libraries in DIR --help Print this help and exit --version Print version number and exit Report bugs to <https://github.com/MentorEmbedded/nvptx-tools/issues>. ... Can you do the same: create conftest.c, copy command from config.log, add -Wl,-v -v. Then do you see collect-ld being called? If so, does collect-ld have the correct linker hardcoded in there? The log file contains: error reading R:\winlibs64_stage\_TMP_\ccYEwkZW.o collect2.exe: error: ld returned 1 exit status which I bet is the problem, but it is unclear if the _TMP_ subdir exists... Yes, that folder exists and that's where my TMP and TEMP environment variables point to. I also tried to point them to a folder on the C: drive, as R: is a RAM drive and I wanted to exclude that that was the issue, but the result was the same: build fails in the same place when configuring libatomic. I ran the following commands based on what was in config.log cat > conftest.c << EOF /* confdefs.h */ #define PACKAGE_NAME "GNU Atomic Library" #define PACKAGE_TARNAME "libatomic" #define PACKAGE_VERSION "1.0" #define PACKAGE_STRING "GNU Atomic Library 1.0" #define PACKAGE_BUGREPORT "" #define PACKAGE_URL "http://www.gnu.org/software/libatomic/" #define PACKAGE "libatomic" #define VERSION "1.0" /* end confdefs.h. */ int main () { ; return 0; } EOF /R/winlibs32_stage/gcc-offload-nvptx-11.1.0/gcc-11.1.0/build_win_offload-nvptx/./gcc/xgcc -B/R/winlibs32_stage/gcc-offload-nvptx-11.1.0/gcc-11.1.0/build_win_offload-nvptx/./gcc/ -B/R/winlibs32_stage/inst_gcc-offload-nvptx-11.1.0/share/gcc/nvptx-none/bin/ -B/R/winlibs32_stage/inst_gcc-offload-nvptx-11.1.0/share/gcc/nvptx-none/lib/ -isystem /R/winlibs32_stage/inst_gcc-offload-nvptx-11.1.0/share/gcc/nvptx-none/include -isystem /R/winlibs32_stage/inst_gcc-offload-nvptx-11.1.0/share/gcc/nvptx-none/sys-include -g -O2 conftest.c -v and the result was: Reading specs from R:/winlibs32_stage/gcc-offload-nvptx-11.1.0/gcc-11.1.0/build_win_offload-nvptx/gcc/specs COLLECT_GCC=R:\winlibs32_stage\gcc-offload-nvptx-11.1.0\gcc-11.1.0\build_win_offload-nvptx\gcc\xgcc.exe COLLECT_LTO_WRAPPER=R:/winlibs32_stage/gcc-offload-nvptx-11.1.0/gcc-11.1.0/build_win_offload-nvptx/gcc/lto-wrapper.exe Target: nvptx-none Configured with: ../configure --prefix=/R/winlibs32_stage/inst_gcc-offload-nvptx-11.1.0/share/gcc --build=i686-w64-mingw32 --host=i686-w64-mingw32 --target=nvptx-none --enable-as-accelerator-for=i686-w64-mingw32 --with-pkgversion='built by Brecht Sanders' --with-build-time-tools=/d/Prog/winlibs32_stage/custombuilt/share/nvptx-tools/nvptx-none/bin --with-gnu-as --with-gnu-ld --disable-serial-configure --enable-checking=release --without-libbacktrace --without-included-gettext --without-cuda-driver --enable-multiarch --enable-newlib-io-long-long --enable-linker-build-id --enable-multilib --disable-sjlj-exceptions --disable-libunwind-exceptions --disable-libgomp --enable-languages=c,c++,lto,objc,obj-c++,d Thread model: single Supported LTO compression algorithms: zlib zstd gcc version 11.1.0 (built by Brecht Sanders) COLLECT_GCC_OPTIONS='-B' 'R:/winlibs32_stage/gcc-offload-nvptx-11.1.0/gcc-11.1.0/build_win_offload-nvptx/gcc/' '-B' 'R:/winlibs32_stage/inst_gcc-offload-nvptx-11.1.0/share/gcc/nvptx-none/bin/' '-B' 'R:/winlibs32_stage/inst_gcc-offload-nvptx-11.1.0/share/gcc/nvptx-none/lib/' '-isystem' 'R:/winlibs32_stage/inst_gcc-offload-nvptx-11.1.0/share/gcc/nvptx-none/include' '-isystem' 'R:/winlibs32_stage/inst_gcc-offload-nvptx-11.1.0/share/gcc/nvptx-none/sys-include' '-g' '-O2' '-v' '-dumpdir' 'a-' R:/winlibs32_stage/gcc-offload-nvptx-11.1.0/gcc-11.1.0/build_win_offload-nvptx/gcc/cc1.exe -quiet -v -iprefix r:\winlibs32_stage\gcc-offload-nvptx-11.1.0\gcc-11.1.0\build_win_offload-nvptx\gcc\../lib/gcc/i686-w64-mingw32/11.1.0D:/Prog/msys64/accel/nvptx-none/ -isystem R:/winlibs32_stage/gcc-offload-nvptx-11.1.0/gcc-11.1.0/build_win_offload-nvptx/gcc/include -isystem R:/winlibs32_stage/gcc-offload-nvptx-11.1.0/gcc-11.1.0/build_win_offload-nvptx/gcc/include-fixed -isystem R:/winlibs32_stage/inst_gcc-offload-nvptx-11.1.0/share/gcc/nvptx-none/include -isystem R:/winlibs32_stage/inst_gcc-offload-nvptx-11.1.0/share/gcc/nvptx-none/sys-include conftest.c -quiet -dumpdir a- -dumpbase conftest.c -dumpbase-ext .c -g -O2 -version -o R:\winlibs32_stage\_TMP_\ccu9TSoP.s GNU C17 (built by Brecht Sanders) version 11.1.0 (nvptx-none) compiled by GNU C version 11.1.0, GMP version 6.2.1, MPFR version 4.1.0, MPC version 1.2.1, isl version isl-0.23-GMP GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 ignoring nonexistent directory "R:/winlibs32_stage/inst_gcc-offload-nvptx-11.1.0/share/gcc/nvptx-none/include" ignoring nonexistent directory "R:/winlibs32_stage/inst_gcc-offload-nvptx-11.1.0/share/gcc/nvptx-none/sys-include" ignoring nonexistent directory "r:\winlibs32_stage\gcc-offload-nvptx-11.1.0\gcc-11.1.0\build_win_offload-nvptx\gcc\../lib/gcc/i686-w64-mingw32/11.1.0D:/Prog/msys64/accel/nvptx-none/include" ignoring nonexistent directory "r:\winlibs32_stage\gcc-offload-nvptx-11.1.0\gcc-11.1.0\build_win_offload-nvptx\gcc\../lib/gcc/i686-w64-mingw32/11.1.0D:/Prog/msys64/accel/nvptx-none/include-fixed" ignoring nonexistent directory "r:\winlibs32_stage\gcc-offload-nvptx-11.1.0\gcc-11.1.0\build_win_offload-nvptx\gcc\../lib/gcc/i686-w64-mingw32/11.1.0D:/Prog/msys64/accel/nvptx-none/../../../../../../nvptx-none/sys-include" ignoring nonexistent directory "r:\winlibs32_stage\gcc-offload-nvptx-11.1.0\gcc-11.1.0\build_win_offload-nvptx\gcc\../lib/gcc/i686-w64-mingw32/11.1.0D:/Prog/msys64/accel/nvptx-none/../../../../../../nvptx-none/include" ignoring nonexistent directory "r:/winlibs32_stage/gcc-offload-nvptx-11.1.0/gcc-11.1.0/build_win_offload-nvptx/lib/gcc/i686-w64-mingw32/11.1.0/accel/nvptx-none/include" ignoring nonexistent directory "r:/winlibs32_stage/gcc-offload-nvptx-11.1.0/gcc-11.1.0/build_win_offload-nvptx/lib/gcc/i686-w64-mingw32/11.1.0/accel/nvptx-none/include-fixed" ignoring nonexistent directory "r:/winlibs32_stage/gcc-offload-nvptx-11.1.0/gcc-11.1.0/build_win_offload-nvptx/nvptx-none/sys-include" ignoring nonexistent directory "r:/winlibs32_stage/gcc-offload-nvptx-11.1.0/gcc-11.1.0/build_win_offload-nvptx/nvptx-none/include" #include "..." search starts here: #include <...> search starts here: R:/winlibs32_stage/gcc-offload-nvptx-11.1.0/gcc-11.1.0/build_win_offload-nvptx/gcc/include R:/winlibs32_stage/gcc-offload-nvptx-11.1.0/gcc-11.1.0/build_win_offload-nvptx/gcc/include-fixed D:\Prog\winlibs32_stage\custombuilt\include D:\Prog\winlibs32_stage\mingw32\include End of search list. GNU C17 (built by Brecht Sanders) version 11.1.0 (nvptx-none) compiled by GNU C version 11.1.0, GMP version 6.2.1, MPFR version 4.1.0, MPC version 1.2.1, isl version isl-0.23-GMP GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Compiler executable checksum: 8ee8c6ba1ff9d5a1ffe98751099bf036 COLLECT_GCC_OPTIONS='-B' 'R:/winlibs32_stage/gcc-offload-nvptx-11.1.0/gcc-11.1.0/build_win_offload-nvptx/gcc/' '-B' 'R:/winlibs32_stage/inst_gcc-offload-nvptx-11.1.0/share/gcc/nvptx-none/bin/' '-B' 'R:/winlibs32_stage/inst_gcc-offload-nvptx-11.1.0/share/gcc/nvptx-none/lib/' '-isystem' 'R:/winlibs32_stage/inst_gcc-offload-nvptx-11.1.0/share/gcc/nvptx-none/include' '-isystem' 'R:/winlibs32_stage/inst_gcc-offload-nvptx-11.1.0/share/gcc/nvptx-none/sys-include' '-g' '-O2' '-v' '-dumpdir' 'a-' R:/winlibs32_stage/gcc-offload-nvptx-11.1.0/gcc-11.1.0/build_win_offload-nvptx/gcc/as -v -m sm_35 -o R:\winlibs32_stage\_TMP_\ccYJWYIt.o R:\winlibs32_stage\_TMP_\ccu9TSoP.s COMPILER_PATH=R:/winlibs32_stage/gcc-offload-nvptx-11.1.0/gcc-11.1.0/build_win_offload-nvptx/gcc/ LIBRARY_PATH=R:/winlibs32_stage/gcc-offload-nvptx-11.1.0/gcc-11.1.0/build_win_offload-nvptx/gcc/ COLLECT_GCC_OPTIONS='-B' 'R:/winlibs32_stage/gcc-offload-nvptx-11.1.0/gcc-11.1.0/build_win_offload-nvptx/gcc/' '-B' 'R:/winlibs32_stage/inst_gcc-offload-nvptx-11.1.0/share/gcc/nvptx-none/bin/' '-B' 'R:/winlibs32_stage/inst_gcc-offload-nvptx-11.1.0/share/gcc/nvptx-none/lib/' '-isystem' 'R:/winlibs32_stage/inst_gcc-offload-nvptx-11.1.0/share/gcc/nvptx-none/include' '-isystem' 'R:/winlibs32_stage/inst_gcc-offload-nvptx-11.1.0/share/gcc/nvptx-none/sys-include' '-g' '-O2' '-v' '-dumpdir' 'a.' R:/winlibs32_stage/gcc-offload-nvptx-11.1.0/gcc-11.1.0/build_win_offload-nvptx/gcc/collect2.exe -LR:/winlibs32_stage/gcc-offload-nvptx-11.1.0/gcc-11.1.0/build_win_offload-nvptx/gcc R:\winlibs32_stage\_TMP_\ccYJWYIt.o -lgcc -lg -lc -lgcc error reading R:\winlibs32_stage\_TMP_\ccYJWYIt.o collect2.exe: error: ld returned 1 exit status So the missing file should have been geenrated by gcc/as I was expecting to find gcc/as.exe in my build folder, but instead gcc/as is a shell script. I very much doubt this can be executed as-is on Windows, even in MSYS2 shell, as the code executing it would need to know about the shebang header and that that needs to be executed by running sh.exe Additional test: Running this manually (in MSYS2 shell) also fails: R:/winlibs32_stage/gcc-offload-nvptx-11.1.0/gcc-11.1.0/build_win_offload-nvptx/gcc/as -v -m sm_35 -o 'R:\winlibs32_stage\_TMP_\ccYJWYIt.o' 'R:\winlibs32_stage\_TMP_\ccu9TSoP.s' nvptx-as: cannot open input ptx file Any update on this? Issue still exists today (in GCC 11.2.0 and in latest snapshot 11.2.1-20210814). Both when building gcc on Windows for nvptx as well as the offload engine for nvptx there is an error like this in nvptx-none/libatomic/config.log: configure:3736: $? = 1 configure:3756: checking whether the C compiler works configure:3778: /R/winlibs64_stage/nvptx-gcc-11-20210814/gcc-11-20210814/build_nvptx_gcc/./gcc/xgcc -B/R/winlibs64_stage/nvptx-gcc-11-20210814/gcc-11-20210814/build_nvptx_gcc/./gcc/ -nostdinc -B/R/winlibs64_stage/nvptx-gcc-11-20210814/gcc-11-20210814/build_nvptx_gcc/nvptx-none/newlib/ -isystem /R/winlibs64_stage/nvptx-gcc-11-20210814/gcc-11-20210814/build_nvptx_gcc/nvptx-none/newlib/targ-include -isystem /R/winlibs64_stage/nvptx-gcc-11-20210814/gcc-11-20210814/newlib/libc/include -B/R/winlibs64_stage/inst_nvptx-gcc-11-20210814/share/nvptx-gcc/nvptx-none/bin/ -B/R/winlibs64_stage/inst_nvptx-gcc-11-20210814/share/nvptx-gcc/nvptx-none/lib/ -isystem /R/winlibs64_stage/inst_nvptx-gcc-11-20210814/share/nvptx-gcc/nvptx-none/include -isystem /R/winlibs64_stage/inst_nvptx-gcc-11-20210814/share/nvptx-gcc/nvptx-none/sys-include -g -O2 conftest.c >&5 error reading C:\Temp\ccqpNwjZ.o collect2.exe: error: ld returned 1 exit status |