An compiling error regarding "crtbegin.o"

Discussion on computers, ROMS installation and compiling

Moderators: arango, robertson

Post Reply
Message
Author
hjsong
Posts: 32
Joined: Wed Sep 27, 2006 7:23 pm
Location: University of California, Santa Cruz

An compiling error regarding "crtbegin.o"

#1 Post by hjsong » Sat Mar 03, 2018 6:33 am

Hi,

I was trying to compile the code with IS4DVAR, and encountered the following error.

Code: Select all

cd Build; /home/software/pgi/17.3/linux86-64/17.3/bin/pgf90 -c  -O3 master.f90
/home/software/pgi/17.3/linux86-64/17.3/bin/pgf90  -O3  Build/roms_import.o Build/propagator.o Build/master.o Build/roms_export.o Build/ocean_coupler.o Build/esmf_roms.o Build/ocean_control.o -o oceanS Build/libUTIL.a Build/libNLM.a Build/libNLM_bio.a Build/libNLM_sed.a Build/libANA.a Build/libUTIL.a Build/libMODS.a -L/home/pkg/pgi/pgi-packages/pgi-9/netcdf/netcdf-3.6.3/x86_64/lib -lnetcdf
/usr/bin/ld: cannot find /usr/lib/gcc/x86_64-redhat-linux/6.3.1/crtbegin.o: No such file or directory
This system has the following file.

Code: Select all

/usr/lib/gcc/x86_64-redhat-linux/7/crtbegin.o
So I thought that I simply needed to specify the path to crtbegin.o, but I haven't found the place to do it yet.
Could you help me to find the file where I can make change?

Thank you.
Hajoon

User avatar
kate
Posts: 3796
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: An compiling error regarding "crtbegin.o"

#2 Post by kate » Sat Mar 03, 2018 6:42 am

cd Build; /home/software/pgi/17.3/linux86-64/17.3/bin/pgf90 -c -O3 master.f90
/home/software/pgi/17.3/linux86-64/17.3/bin/pgf90 -O3 Build/roms_import.o Build/propagator.o Build/master.o Build/roms_export.o Build/ocean_coupler.o Build/esmf_roms.o Build/ocean_control.o -o oceanS Build/libUTIL.a Build/libNLM.a Build/libNLM_bio.a Build/libNLM_sed.a Build/libANA.a Build/libUTIL.a Build/libMODS.a -L/home/pkg/pgi/pgi-packages/pgi-9/netcdf/netcdf-3.6.3/x86_64/lib -lnetcdf
/usr/bin/ld: cannot find /usr/lib/gcc/x86_64-redhat-linux/6.3.1/crtbegin.o: No such file or directory
Odd that pgi is looking for a gcc object. Did anything at all get compiled with gfortran or gcc first? I would do a "make clean" then try again. Have you managed to compile the forward model?

hjsong
Posts: 32
Joined: Wed Sep 27, 2006 7:23 pm
Location: University of California, Santa Cruz

Re: An compiling error regarding "crtbegin.o"

#3 Post by hjsong » Sun Mar 04, 2018 11:57 am

Thank you, Kate, for taking a look at this problem.

I use the "build.bash" script, so it implicitly does "make clean".

I tried gfortran but got the following error.

Code: Select all

 -lnetcdff -L/home/hajsong/ROMS_564/Lib/ARPACK -lparpack-mpif90 -L/home/hajsong/ROMS_564/Lib/ARPACK -larpack-mpif90
/usr/bin/ld: warning: libgfortran.so.3, needed by /home/software/gcc/6.3.1/pkg/openmpi/2.1.0/lib/libmpi_usempif08.so, not found (try using -rpath or -rpath-link)
/home/hajsong/ROMS_564/Lib/ARPACK/libarpack-mpif90.a(dsteqr.o): In function `.C1_291':
dsteqr.f:(.data+0x50): undefined reference to `pgf90_compiled'
/home/hajsong/ROMS_564/Lib/ARPACK/libarpack-mpif90.a(dswap.o):(.data+0x0): undefined reference to `pgf90_compiled'
/home/hajsong/ROMS_564/Lib/ARPACK/libarpack-mpif90.a(lsame.o):(.data+0x0): undefined reference to `pgf90_compiled'
.
.
.
collect2: error: ld returned 1 exit status
make: *** [Master/Module.mk:22: /home/hajsong/LTERCCE/4dvar/oceanM] Error 1
I can find the following files instead.

Code: Select all

/usr/lib/gcc/x86_64-redhat-linux/7/libgfortran.so
/usr/lib64/libgfortran.so.4
I used to be able to compile the code with the pgi compiler...
Probably this system lost files associated with gcc/6.3.1 after the update...
Is there any way to specify the version of gcc in ROMS?

Thank you.
Hajoon

User avatar
kate
Posts: 3796
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: An compiling error regarding "crtbegin.o"

#4 Post by kate » Sun Mar 04, 2018 4:56 pm

I use the "build.bash" script, so it implicitly does "make clean".
If I were to use build.bash, I would change its default behavior to let "make" work as intended. :roll:
/home/hajsong/ROMS_564/Lib/ARPACK/libarpack-mpif90.a(lsame.o):(.data+0x0): undefined reference to `pgf90_compiled'
Well, obviously not everything got cleaned out. Try recompiling arpack with gfortran. Everything, including netcdf-fortran, has to be compiled with the same compiler.

hjsong
Posts: 32
Joined: Wed Sep 27, 2006 7:23 pm
Location: University of California, Santa Cruz

Re: An compiling error regarding "crtbegin.o"

#5 Post by hjsong » Sun Mar 04, 2018 8:22 pm

Thank you, Kate.
Well, obviously not everything got cleaned out. Try recompiling arpack with gfortran. Everything, including netcdf-fortran, has to be compiled with the same compiler.
I will discuss with the system manager!

User avatar
robertson
Site Admin
Posts: 134
Joined: Wed Feb 26, 2003 3:12 pm
Location: IMCS, Rutgers University

Re: An compiling error regarding "crtbegin.o"

#6 Post by robertson » Mon Mar 05, 2018 2:13 pm

I'm not positive with newer versions of PGI but with older versions you have to run the makelocalrc script (as root so you'll still need to ask the system manager) every time gcc is upgraded. In your case the system manager logged in as root should be able to run the following:

cd /home/software/pgi/17.3/linux86-64/17.3/bin/
./makelocalrc /home/software/pgi/17.3/linux86-64/17.3

This is almost certainly your problem given that PGI is looking for:

/usr/lib/gcc/x86_64-redhat-linux/6.3.1/crtbegin.o

but you have:

/usr/lib/gcc/x86_64-redhat-linux/7/crtbegin.o

hjsong
Posts: 32
Joined: Wed Sep 27, 2006 7:23 pm
Location: University of California, Santa Cruz

Re: An compiling error regarding "crtbegin.o"

#7 Post by hjsong » Tue Mar 06, 2018 7:25 am

Thank you, David!

I will ask the system manager to do what you suggested.

Best,
Hajoon

Post Reply