I'm trying to compile some source code from a makefile, but its not working. The error I get is

gfortran-9 -o sams43 sams43.o mvnorm.o isml_wrapper.o
/usr/bin/ld: sams43.o: relocation R_X86_64_32 against '.rodata' can not be used when making a PIE object; recompile with -fPIE
collect2: error: ld returned 1 exit status
make: *** [makefile:7: sams43] Error 1

Here's my makefile:

FC=gfortran-9
FCFLAGS= -g

all: sams43 normal_dataset

sams43: sams43.o mvnorm.o imsl_wrapper.o 
    ${FC} -o sams43 sams43.o mvnorm.o imsl_wrapper.o

imsl_wrapper.o: imsl_wrapper.f90
    ${FC} ${FCFLAGS} -c imsl_wrapper.f90

sams43.o: sams43.f90
    ${FC} ${FCFLAGS} -c sams43.f90

mvnorm.o: mvnorm.f90
    ${FC} ${FCFLAGS} -c mvnorm.f90

normal_dataset: normal_dataset.o mvnorm.o
    ${FC} -o normal_dataset normal_dataset.o mvnorm.o

normal_dataset.o: normal_dataset.f90
    ${FC} ${FCFLAGS} -c normal_dataset.f90

clean:
#   rm *.o sams43 normal_dataset

I am using Ubuntu 20.04. My collaborator is able to compile the make file on an older version of ubuntu with no problems. The only difference between her make file and mine is that I changed 'FC=gfortran' to 'FC=gfortran-9'. This is because gfortran no longer works on my version of Ubuntu, so I am using gfortran-9 as my compiler instead.

From reading other posts on here, it seems like it could be an issue with the flags that I'm using (i.e. the codes might have changed between the two fortran versions) but I've not been able to find any information on what flag to put in instead.

I am very new to programming, and any help would be appreciated!

0

There are 0 best solutions below