Segmentation fault during linking phase of device code when -G flag is passed to the nvcc compiler

Hello, as the topic headline suggests I am trying to setup the CUDA Debugger (cuda-gdb). More specifically, I am trying to set it up with CLion.
First, some background information. We have recently updated our cuda version to 11.6, from 11.1. Before this update it was possible to compile and link device code with the -G flag. However, I was still unable to hit breakpoints in device code. I am also using a CLion version >= 2022.2, which should have cuda-gdb support. But now with the new cuda version, I am unable to link device code, when I compile with -G.

I have followed the guide here: CUDA projects | CLion

  1. Debugger set up:

  2. Device debug flag is set with:
    target_compile_options(${PROJECT_NAME} PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:-G>).\

Since I don’t own this project that I am working with, I am not sure what information I am allowed to share so I redacted some names and file paths. But hopefully I captured relevant information, my goal was to include mainly which flags etc was used.

Here is an example of flags used during compilation of a file, which is successful:

[  2%] Building CUDA object src/CMakeFiles/ProjectRepo.dir/SomeCudaFile.cu.o
cd /PathToRepo/ProjectRepo/cmake-build-debug/src && /usr/local/cuda-11.6/bin/nvcc -forward-unknown-to-host-compiler -DFORCE_ENABLE_VISA -I/PathToRepo/ProjectRepo/RedactedPath-i

.

. lots of included packages here

.

-g -DBOOST_USE_STATIC_LIBS -DLIBJPEG_STATIC -G --Werror all-warnings -use_fast_math -cudart=static -gencode=arch=compute_61,code=lto_61 -std=c++14 -x cu -dc /PathToRepo//ProjectRepo/RedactedPath/SomeCudaFile.cu -o CMakeFiles/ProjectRepo.dir/appl/RedactedPath/SomeCudaFile.cu.o

And here is the linking phase:

[100%] Linking CUDA device code CMakeFiles/ProjectRepo.dir/cmake_device_link.o
cd /PathToRepo/ProjectRepo/cmake-build-debug/src && /usr/bin/cmake -E cmake_link_script CMakeFiles/ProjectRepo.dir/dlink.txt --verbose=1
/usr/local/cuda-11.6/bin/nvcc -forward-unknown-to-host-compiler -g -v -dlto -gencode=arch=compute_61,code=sm_61 -Xcompiler=-fPIC -Wno-deprecated-gpu-targets -shared -dlink

.

. lots of files

.

-lcudadevrt -lcudart_static
#$ _NVVM_BRANCH_=nvvm
#$ _SPACE_=
#$ _CUDART_=cudart
#$ _HERE_=/usr/local/cuda-11.6/bin
#$ _THERE_=/usr/local/cuda-11.6/bin
#$ _TARGET_SIZE_=
#$ _TARGET_DIR_=
#$ _TARGET_DIR_=targets/x86_64-linux
#$ TOP=/usr/local/cuda-11.6/bin/..
#$ NVVMIR_LIBRARY_DIR=/usr/local/cuda-11.6/bin/../nvvm/libdevice
#$ LD_LIBRARY_PATH=/usr/local/cuda-11.6/bin/../lib:
#$ PATH=/usr/local/cuda-11.6/bin/../nvvm/bin:/usr/local/cuda-11.6/bin:/home/user/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/snap/bin:/opt/rti/rti_connext_dds-6.0.1/bin:/opt/redacted/scripts/redacted:/opt/ctclinux_v9.1.1/bin:/opt/redacted/scripts:/usr/sbin:/usr/local/cuda/bin
#$ INCLUDES="-I/usr/local/cuda-11.6/bin/../targets/x86_64-linux/include"  
#$ LIBRARIES=  "-L/usr/local/cuda-11.6/bin/../targets/x86_64-linux/lib/stubs" "-L/usr/local/cuda-11.6/bin/../targets/x86_64-linux/lib"
#$ CUDAFE_FLAGS=
#$ PTXAS_FLAGS=
#$ nvlink -m64  --shared --arch=sm_61 --register-link-binaries="/tmp/tmpxft_00004393_00000000-3_cmake_device_link.reg.c"  -

.

. lots of files

.

"CMakeFiles/ProjectRepo.dir/__/buildflags.cpp.o"  -lcudadevrt  -o "/tmp/tmpxft_00004393_00000000-5_cmake_device_link.cubin"
Segmentation fault
# --error 0x8b --
src/CMakeFiles/ProjectRepo.dir/build.make:1340: recipe for target 'src/CMakeFiles/ProjectRepo.dir/cmake_device_link.o' failed
make[3]: *** [src/CMakeFiles/ProjectRepo.dir/cmake_device_link.o] Error 139
make[3]: Leaving directory '/PathToRepo/ProjectRepo/cmake-build-debug'
CMakeFiles/Makefile2:195: recipe for target 'src/CMakeFiles/ProjectRepo.dir/all' failed
make[2]: *** [src/CMakeFiles/ProjectRepo.dir/all] Error 2
make[2]: Leaving directory '/PathToRepo/ProjectRepo/cmake-build-debug'
CMakeFiles/Makefile2:202: recipe for target 'src/CMakeFiles/ProjectRepo.dir/rule' failed
make[1]: *** [src/CMakeFiles/ProjectRepo.dir/rule] Error 2
make[1]: Leaving directory '/PathToRepo/ProjectRepo/cmake-build-debug'
Makefile:208: recipe for target 'ProjectRepo' failed
make: *** [ProjectRepo] Error 2