Is there a way to link PGI Compiler binaries to existing GNU binaries? When I try to link I get following error:
oacc.c.o:(.init+0x8): undefined reference to `__pgio_ini'
collect2: ld returned 1 exit status
Details:
I have compiled a few files with gcc and g++. The C main
function is included in these files. Now I should add a OpenACC function to project which must be compiled by PGI C Compiler (pgcc
). After compile, I get the above link error (the error is the same for both pgCC
or g++
as linker).
Maybe I need to integrate the OpenACC function into a dummy library and include/link it to the project. But I have no idea how to do that.
Unfortunately, entire project cannot be compiled with PGI Compiler, since some functions depend on GNU Compiler.
Thanks in advance.
Newer versions of the GCC-based GNU toolchain require that the files to be linked (object files and static and dynamic libraries) be specified in the order in which symbols depend on one another. Consequentially, you have to put external libraries' linker flags as the last parameters:
is correct, whereas
will result in a linker error.