A link problem occurred when compiling TorchScript demo with PGI compiler

Hi, guys. I was trying to play with the TorchScript C++ demo and have got some issues when switching the compiler from gcc to pgi.

When compiling with gcc compiler, everything was fine.

However when I switch to pgi with this cmake command cmake -DCMAKE_PREFIX_PATH=/lib/libtorch11/ -DCMAKE_MODULE_PATH=/lib/libtorch11/share/cmake/Torch -DCMAKE_CXX_COMPILER=mpiCC .. (everything else is the same)

the configure phase also went well, but I got a link error like this while building

I don’t know it’s just the PGI compiler is incompatible with the downloaded libtorch library, or there are some extra settings missing here.

BTW, the libtorch version I used was libtorch-cxx11-abi-shared-with-deps-1.9.0+cu111.zip.

FYI, the output of the cmake configure phase is here.