Skip to content

Commit 271fd64

Browse files
committed
[GR-16559] Script install_r_native_image supports --verbose flag.
PullRequest: fastr/2058
2 parents 4dac084 + c2ffa34 commit 271fd64

File tree

3 files changed

+23
-3
lines changed

3 files changed

+23
-3
lines changed

ci.hocon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ include "ci_common/common.hocon"
88
# The standard set of gate builds. N.B. the style/builtin checks are only run on Linux as they are not OS-dependent.
99

1010
# in case you do not want to enforce a specific overlay commit, comment:
11-
overlay = "9fd1ed7dac318a520ffe30b28bde900553950658"
11+
overlay = "6f60c2cc12f2c909405d0b0668a1c78f9796b3d8"
1212
builds = [
1313
${gateTestLinux} {capabilities : [linux, amd64, fast], targets : [gate], name: "gate-test-linux-amd64"}
1414
${gateTestNoDSLCacheLinux} {capabilities : [linux, amd64, fast], targets : [gate], name: "gate-test-linux-amd64-no-dsl-cache"}

ci_common/common.hocon

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ logfiles : [
5656
environmentLinux: {
5757
environment : {
5858
PKG_INCLUDE_FLAGS_OVERRIDE : "-I/cm/shared/apps/zlib/1.2.11/include -I/cm/shared/apps/bzip2/1.0.6/include -I/cm/shared/apps/xz/5.2.2/include -I/cm/shared/apps/pcre/8.42/include -I/cm/shared/apps/curl/7.50.1/include"
59-
PKG_LDFLAGS_OVERRIDE : "-L/cm/shared/apps/zlib/1.2.11/lib -L/cm/shared/apps/bzip2/1.0.6/lib -L/cm/shared/apps/xz/5.2.2/lib -L/cm/shared/apps/pcre/8.42/lib -L/cm/shared/apps/curl/7.50.1/lib -L/cm/shared/apps/gcc/4.9.1/lib64"
59+
PKG_LDFLAGS_OVERRIDE : "-L/cm/shared/apps/zlib/1.2.11/lib -L/cm/shared/apps/bzip2/1.0.6/lib -L/cm/shared/apps/xz/5.2.2/lib -L/cm/shared/apps/pcre/8.42/lib -L/cm/shared/apps/curl/7.50.1/lib -L/cm/shared/apps/gcc/4.9.2/lib64"
6060
TZDIR: "/usr/share/zoneinfo"
6161
}
6262
}
@@ -78,7 +78,8 @@ packagesLinux : {
7878
"pip:pylint" : "==1.1.0"
7979
"pip:ninja_syntax" : "==1.7.2"
8080
make : ">=3.83"
81-
gcc-build-essentials : "==4.9.1" # TODO: upgrade to 4.9.2
81+
gcc-build-essentials : "==4.9.2"
82+
binutils: ">=2.30"
8283
pcre : "==8.42"
8384
zlib : "==1.2.11"
8485
# these are needed to build GNU-R

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

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,19 +40,29 @@ fastr_home="$(dirname "$source")/.."
4040

4141
silent=0
4242
uninstall=0
43+
verbose=0
4344
for arg in "$@"; do
4445
if [[ $arg == "--silent" ]]; then
4546
silent=1
47+
elif [[ $arg == "--verbose" ]]; then
48+
verbose=1
4649
elif [[ $arg == "uninstall" ]]; then
4750
uninstall=1
4851
elif [[ $arg == "--help" ]]; then
4952
echo "Usage: install_r_native_image [uninstall] [--silent]"
5053
echo "When 'uninstall' argument is not present: builds and installs native image of the R runtime."
5154
echo "When 'uninstall' argument is present: uninstalls previously installed native image of the R runtime."
5255
echo "Use the --silent option to turn off the confirmation when installing."
56+
echo "Use the --verbose option to turn on detailed logging."
5357
fi
5458
done
5559

60+
function log {
61+
if [[ $verbose -eq 1 ]]; then
62+
echo $@
63+
fi
64+
}
65+
5666
if [[ $uninstall -eq 1 ]]; then
5767
echo "Uninstalling native image of R runtime..."
5868
mv "$fastr_home/bin/exec_R.backup" "$fastr_home/bin/exec/R"
@@ -73,6 +83,7 @@ if [[ $silent -eq 0 ]]; then
7383
fi
7484
fi
7585

86+
log "Changing directory to: $fastr_home/bin"
7687
cd "$fastr_home/bin"
7788

7889
fastr_launcher_ni_args=(
@@ -89,10 +100,18 @@ fastr_launcher_ni_args=(
89100
-Dorg.graalvm.launcher.classpath=jre/lib/graalvm/launcher-common.jar:jre/languages/R/fastr-launcher.jar
90101
-H:Class=com.oracle.truffle.r.launcher.RMain
91102
)
103+
if [[ $verbose -eq 1 ]]; then
104+
fastr_launcher_ni_args+=('--verbose')
105+
fi
92106

107+
log "Running: ../../../../bin/native-image" "${fastr_launcher_ni_args[@]}" -H:Name=RMain
93108
../../../../bin/native-image "${fastr_launcher_ni_args[@]}" -H:Name=RMain
109+
110+
log "Creating backup of the R and Rscript launchers"
94111
cp "exec/R" "exec_R.backup"
95112
cp "Rscript" "Rscript.backup"
113+
114+
log "Patching the R and Rscript launchers to dispatch to the generated native image"
96115
sed -e '/^## REMOVE FOR NATIVE IMAGE: BEGIN/,/^## REMOVE FOR NATIVE IMAGE: END/d;' "exec_R.backup" | \
97116
sed -e 's|^exec "$JAVA_HOME/bin/java" .*|exec "$R_HOME/bin/RMain" R ${FASTR_INTERNAL_ARGS[@]} "$@"|' > "exec/R"
98117
sed -e '/^## REMOVE FOR NATIVE IMAGE: BEGIN/,/^## REMOVE FOR NATIVE IMAGE: END/d;' "Rscript.backup" | \

0 commit comments

Comments
 (0)