ld cannot find /usr/lib64/crt1.o /usr/lib64/crti.o


I’m facing some problems in getting the pgi compiler suite (19.10) to work on an x86_64 system with ubuntu 16.04.12 and gcc 5.4.0.

The installation script runs until completion without problem however whenever I try to use the compilers I have the following linker problem:

/usr/bin/ld: cannot find /usr/lib64/crt1.o: No such file or directory
/usr/bin/ld: cannot find /usr/lib64/crti.o: No such file or directory

The compiler is instructing the linker with the absolute path to those object files which instead are located under /usr/lib/x86_64-linux-gnu/.

I can solve the problem creating two symlinks in /usr/lib64, however this seems an ugly solution to me, I would rather been able to have the compilers working out of the box. I cannot understand whether I somehow broke my ubuntu installation and /usr/lib64 should be a symlink to /usr/lib/x86_64-linux-gnu/ or whether it is a PGI issue. What do you guys think?



Hi Marco,

During installation, the script “makelocalrc” is run to create the local configuration file “localrc”. The makelocalrc script will query the system gcc to see which directory the system’s objects (crt1.o) are located. This directory is then stored as the “DEFSTDOBJDIR” variable in “localrc”. Hence another work around is to edit your “localrc” file (found in the same bin directory as the compilers) with the correct path.

It’s unclear as why “makelocalrc” is finding the incorrect path but it’s possible you may need to set the environment variable “LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/” which is the variable the linker (ld) uses to find these objects. I’ll often need to set this when creating a localrc file using a non-default GNU installation.

Note you can also re-run “makelocalrc” using the flags “makelocalrc -d . -x -gcc /gnupath/bin/gcc -gpp /gnupath/bin/g++ -g77 /gnupath/bin/gfortran”. Replace “gnupath” with the actual fully qualified path to you GNU install.

The “-d .” flag will cause the localrc file to be generated in the current directory. If it looks correct, you can then copy it over to the PGI install bin directory so it’s used by the compilers.

Hope this helps,