Skip to content

Commit 0f93b02

Browse files
committed
updated building r documentation to include the cflags step into the configure command
1 parent bccf15b commit 0f93b02

File tree

1 file changed

+9
-22
lines changed

1 file changed

+9
-22
lines changed

docs/tutorials/building_r.md

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -55,29 +55,13 @@ mkdir -p $BUILDDIR
5555
cd $BUILDDIR
5656
```
5757

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-
- These flags modify the configuration defined in the next step,
68-
so that when R is built, C code will be compiled with debugging
69-
symbols (`-g`) and compiler optimizations will be disabled
70-
(`-O0`) so that the structure of the code closely matches the
71-
original source.
72-
73-
**6) Configure the build**
58+
**5) Configure the build**
7459

7560
- After we change directory, we must run the configure script from the source
7661
directory. This step takes ~1 minute on the codespace.
7762

7863
```bash
79-
$TOP_SRCDIR/configure --with-valgrind-instrumentation=1
80-
64+
$TOP_SRCDIR/configure --with-valgrind-instrumentation=1 CFLAGS="-g -O0"
8165
```
8266

8367
<!-- markdownlint-disable MD046 -->
@@ -86,6 +70,9 @@ $TOP_SRCDIR/configure --with-valgrind-instrumentation=1
8670
of valgrind. See the [Using
8771
valgrind](https://cran.r-project.org/doc/manuals/R-exts.html#Using-valgrind)
8872
section of the R-admin manual for more information.
73+
The `CFLAGS="-g -O0"` setting compiles C code with debugging symbols
74+
(`-g`) and disables optimization (`-O0`) so the compiled code closely
75+
matches the original source, which aids debugging.
8976
<!-- markdownlint-enable MD046 -->
9077

9178
- The configure cmd prepares for building R, creating files and folders inside
@@ -95,7 +82,7 @@ $TOP_SRCDIR/configure --with-valgrind-instrumentation=1
9582

9683
![alt text](../assets/rdev7.png)
9784

98-
**7) Build R**
85+
**6) Build R**
9986

10087
Having configured R, we run `make` to build R. This take 5-10 minutes on the
10188
codespace.
@@ -104,7 +91,7 @@ codespace.
10491
make
10592
```
10693

107-
**8) Check R**
94+
**7) Check R**
10895

10996
Check that the build of R passes R's standard checks:
11097
@@ -116,7 +103,7 @@ This takes a couple of minutes in the codespace. The check will stop with a
116103
error message if any of the tests fail. If this happens, see [SVN
117104
Help](./svn_help.md) for how to revert to a version that passes check.
118105
119-
**9) Make R terminals use the built R**
106+
**8) Make R terminals use the built R**
120107
121108
Run the `which_r` script to set which R to use for R terminals in VSCode. When
122109
prompted, enter the number corresponding to `r-devel`
@@ -140,7 +127,7 @@ built![^1]
140127
selected version is saved in the VSCode settings, so will be saved when you stop
141128
and restart the codespace.
142129
143-
**10) Make contributions**
130+
**9) Make contributions**
144131
145132
- After having built the current development version of R, we can now make
146133
changes to the source code and contribute to the project.

0 commit comments

Comments
 (0)