Skip to content

Commit 2aa2fda

Browse files
committed
configure_fastr: overhaul of the GCC runtime libs check on Linux
(cherry picked from commit fe65ff2)
1 parent 32ea48d commit 2aa2fda

File tree

1 file changed

+37
-8
lines changed

1 file changed

+37
-8
lines changed

com.oracle.truffle.r.native/run/configure_fastr

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -108,16 +108,45 @@ fi
108108

109109
(
110110
if [[ "$OSTYPE" == "linux-gnu" ]]; then
111-
echo "int main(){}" | gcc -x c -Wl,--no-as-needed -lgfortran -lgcc_s -lquadmath -o /dev/null - > /dev/null 2>/dev/null
112-
res=$?
111+
res=0
112+
for lib in libgfortran.so.3 libm.so.6 libquadmath.so.0 libgcc_s.so.1; do
113+
if ! ldconfig -p | grep --quiet $lib; then
114+
echo "Error: could not find gfortran3 runtime library: $lib"
115+
echo "Please install the gfortran3 runtime libraries:"
116+
echo " On Debian based systems: apt-get install libgfortran3"
117+
echo " On Oracle Linux 7: yum install libgfortran"
118+
echo " On Oracle Linux 8: yum install compat-libgfortran-48"
119+
res=1
120+
break
121+
fi
122+
done
123+
if ! ldconfig -p | grep --quiet "libgomp.so.1"; then
124+
echo "Error: could not find OpenMP runtime library: libgomp.so.1"
125+
echo "Please install the OpenMP runtime library runtime libraries:"
126+
echo " On Debian based systems: apt-get install libgomp1"
127+
echo " On Oracle Linux 7 and 8: yum install libgomp"
128+
echo " Note: Oracle Linux 8 should contain libgomp by default"
129+
res=1
130+
fi
131+
if which gfortran > /dev/null 2> /dev/null; then
132+
echo "Note: if you intend to install R packages with Fortran 90 and newer code, you need to install gfortran compiler."
133+
echo "Fortran 77 or any Fortran code that is compilable by the 'f2c' tool does not require gfortran compiler."
134+
echo "You can install the gfortran compiler with:"
135+
echo " On Debian based systems: apt-get install build-essential"
136+
echo " On Oracle Linux 7: yum groupinstall 'Development Tools'"
137+
echo " On Oracle Linux 8: yum groupinstall 'Development Tools'"
138+
if [[ $res != 0 ]]; then
139+
echo "Caution: you still need to install gfortran3 runtime libraries on all systems where this version is not the default (Ubuntu 18 or higher, Oracle Linux 8 or higher)."
140+
fi
141+
fi
113142
if [[ $res != 0 ]]; then
114-
echo "Cannot build a simple C program linking with libgfortran, libgcc_s, and libquadmath."
115-
echo "Please install GCC and gfortran using:"
116-
echo " On Debian based systems: sudo apt-get install build-essential gfortran"
117-
echo " On CentOS/RHEL/Oracle Linux: sudo yum groupinstall \"Developent Tools\"; yum install gcc-gfortran"
118-
echo ""
119-
printHelp
143+
echo "The basic configuration of FastR failed."
144+
echo "To learn more:"
145+
echo " run this script with '--help'"
146+
echo " visit https://www.graalvm.org/docs/reference-manual/languages/r"
120147
exit 1
148+
else
149+
echo "The basic configuration of FastR was successfull."
121150
fi
122151
elif [[ "$OSTYPE" == "darwin"* ]]; then
123152
cd -P "$( dirname "$source" )/../lib"

0 commit comments

Comments
 (0)