Skip to content

Commit 0945318

Browse files
committed
Added step in building R for setting flags
1 parent 352b218 commit 0945318

File tree

5 files changed

+21
-11
lines changed

5 files changed

+21
-11
lines changed

.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,5 @@
3434
]
3535
}
3636
},
37-
"postCreateCommand": "find . -wholename '.git*' -type d -prune -o -type f -exec chown vscode:vscode {} \; && gcc -shared -fPIC -o /workspaces/r-dev-env/scripts/allow_ptrace.so /workspaces/r-dev-env/scripts/allow_ptrace.c && chmod +x /workspaces/r-dev-env/scripts/launch_r.sh && sh /workspaces/r-dev-env/scripts/localscript.sh"
37+
"postCreateCommand": "find . -wholename '.git*' -type d -prune -o -type f -exec chown vscode:vscode {} \\; && gcc -shared -fPIC -o /workspaces/r-dev-env/scripts/allow_ptrace.so /workspaces/r-dev-env/scripts/allow_ptrace.c && chmod +x /workspaces/r-dev-env/scripts/launch_r.sh && sh /workspaces/r-dev-env/scripts/localscript.sh"
3838
}

.devcontainer/launch.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@
1515
"stopOnEntry": false
1616
}
1717
]
18-
}
18+
}

Dockerfile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@ RUN Rscript -e "runiverse <- sprintf('r-universe.dev/bin/linux/%s-%s/%s/', \
2727
nx10 = paste0('https://nx10.', runiverse))); \
2828
print('Packages installed.')"
2929

30-
#Set the CFLAGS environment variable to include debugging symbols for better debugging
31-
ENV CFLAGS="-g -O0"
32-
30+
3331
# Define env var used in GitHub Actions that build and deploy container
3432
ARG CONTAINER_VERSION
3533
ENV CONTAINER_VERSION=${CONTAINER_VERSION}

docs/tutorials/building_r.md

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,19 @@ mkdir -p $BUILDDIR
5555
cd $BUILDDIR
5656
```
5757

58-
**5) Configure the build**
58+
**5) Set CFLAGS (Optional—For Debugging C Code)**
59+
60+
- **This step is optional and recommended for those who want to debug C code.**
61+
- Set the `CFLAGS` environment variable before running configure:
62+
63+
```bash
64+
CFLAGS="-g -O0"
65+
```
66+
67+
- After running this command, the CFLAGS setting will apply only to the
68+
current terminal session.
69+
70+
**6) Configure the build**
5971

6072
- After we change directory, we must run the configure script from the source
6173
directory. This step takes ~1 minute on the codespace.
@@ -80,7 +92,7 @@ $TOP_SRCDIR/configure --with-valgrind-instrumentation=1
8092

8193
![alt text](../assets/rdev7.png)
8294

83-
**6) Build R**
95+
**7) Build R**
8496

8597
Having configured R, we run `make` to build R. This take 5-10 minutes on the
8698
codespace.
@@ -89,7 +101,7 @@ codespace.
89101
make
90102
```
91103

92-
**7) Check R**
104+
**8) Check R**
93105

94106
Check that the build of R passes R's standard checks:
95107
@@ -101,7 +113,7 @@ This takes a couple of minutes in the codespace. The check will stop with a
101113
error message if any of the tests fail. If this happens, see [SVN
102114
Help](./svn_help.md) for how to revert to a version that passes check.
103115
104-
**8) Make R terminals use the built R**
116+
**9) Make R terminals use the built R**
105117
106118
Run the `which_r` script to set which R to use for R terminals in VSCode. When
107119
prompted, enter the number corresponding to `r-devel`
@@ -125,7 +137,7 @@ built![^1]
125137
selected version is saved in the VSCode settings, so will be saved when you stop
126138
and restart the codespace.
127139
128-
**9) Make contributions**
140+
**10) Make contributions**
129141
130142
- After having built the current development version of R, we can now make
131143
changes to the source code and contribute to the project.

scripts/launch_r.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ export LD_PRELOAD=/workspaces/r-dev-env/scripts/allow_ptrace.so
33
if [ -z "$R_BINARY" ]; then
44
R_BINARY="/usr/bin/R"
55
fi
6-
exec $R_BINARY "$@"
6+
exec $R_BINARY "$@"

0 commit comments

Comments
 (0)