From c@@rd|@g@bor @end|ng |rom gm@||@com  Wed Feb  8 14:03:58 2023
From: c@@rd|@g@bor @end|ng |rom gm@||@com (=?UTF-8?B?R8OhYm9yIENzw6FyZGk=?=)
Date: Wed, 8 Feb 2023 14:03:58 +0100
Subject: [Rd] R-devel does not compile on OpenSUSE 15.4
Message-ID: <CABtg=KnTn+QUei+4oxPBL=So2x2i7PEXTPfdrH17AqWv6K5BGg@mail.gmail.com>

More precisely the built-in Lapack module. AFAICT this is because the
f90 files are not compiled with -fpic. My output:

make[4]: Entering directory '/tmp/R-devel/src/modules/lapack'
gfortran -fpic  -g -O2 -msse2 -mfpmath=sse  -c dlamch.f -o dlamch.o
gfortran  -fpic  -g -O2  -c dlapack.f -o dlapack.o
gfortran  -fpic  -g -O2  -c cmplx.f -o cmplx.o
gfortran  -c  la_constants.f90 -o la_constants.o
gfortran  -c  dlartg.f90 -o dlartg.o
gfortran  -c  la_xisnan.f90 -o la_xisnan.o
gfortran  -c  dlassq.f90 -o dlassq.o
gfortran  -c  zlartg.f90 -o zlartg.o
gfortran  -c  zlassq.f90 -o zlassq.o
gcc -shared -fopenmp -L/usr/local/lib64 -o libRlapack.so dlamch.o
dlapack.o cmplx.o dlartg.o dlassq.o la_constants.o la_xisnan.o
zlartg.o zlassq.o   -L"../../../lib" -lRblas -lgfortran -lm -lquadmath
/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld:
zlassq.o: warning: relocation against `__la_xisnan_MOD_disnan' in
read-only section `.text'
/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld:
dlassq.o: relocation R_X86_64_PC32 against symbol
`__la_xisnan_MOD_disnan' can not be used when making a shared object;
recompile with -fPIC
/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld:
final link failed: bad value
collect2: error: ld returned 1 exit status

If I update src/modules/lapack/Makefile.in to add $(FPICFLAGS) to the
.f90 compilation, then all is good. I assume you would also want to
add -g and -O2 here, so probably some other variable is better than
$(FPICFLAGS).

FYI,
Gabor



[Rd] R-devel does not compile on OpenSUSE 15.4
=?UTF-8?B?R8OhYm9yIENzw6FyZGk=?=