r-devel / rdevguide

A guide for contributing to R core development
https://contributor.r-project.org/rdevguide/
Other
60 stars 19 forks source link

Install trouble-shooting in scope? #163

Open MichaelChirico opened 10 months ago

MichaelChirico commented 10 months ago

I came across two failures running make today that interrupted my usual workflow for building r-devel.

I wondered if keeping something like an FAQ for troubleshooting R builds would make sense for the guide. Or perhaps it could just be a Wiki document on this repo that's pointed to by the guide, to make contribution less intensive?

To get things started here were the two fixes I needed today:

Run make clean to reset state

Sometimes the compiled .o/.so files from previous make runs get stale without make realizing it and re-compiling on its own.

In such cases, running make clean before re-trying make may be the only way to proceed. Here's the error I encountered today:

/home/michael/svn/R-devel/bin/exec/R: error while loading shared libraries: libicuuc.so.66: cannot open shared object file: No such file or directory
make[4]: *** [../../../share/make/basepkg.mk:151: sysdata] Error 127
make[4]: Leaving directory '/home/michael/svn/R-devel/src/library/tools'
make[3]: *** [Makefile:36: all] Error 2
make[3]: Leaving directory '/home/michael/svn/R-devel/src/library/tools'
make[2]: *** [Makefile:37: R] Error 1
make[2]: Leaving directory '/home/michael/svn/R-devel/src/library'
make[1]: *** [Makefile:28: R] Error 1
make[1]: Leaving directory '/home/michael/svn/R-devel/src'
make: *** [Makefile:62: R] Error 1

I first checked around for where libicuuc is coming from (ICU library, mentioned in R-admin, installed as e.g. apt-get install libicu-dev on Ubuntu), and made sure I have it installed, which I do, meaning something "funny" is going on and hinting at the need for a make clean.

Needed to update my copies of the Recommended packages

I only ran the required ./tools/rsync-recommended once, long ago when I first set up my local copy of the SVN repo -- looks like circa 2021.

I turns out my old copies of these packages have drifted far enough from the current versions that they now fail to compile. Here's the error I encountered during make:

make[3]: Entering directory '/tmp/Rtmpsof5N5/R.INSTALL19cad6efa1634/MASS/src'
gcc -I"/home/michael/svn/R-devel/include" -DNDEBUG   -I/usr/local/include    -fpic  -g -O2  -c MASS.c -o MASS.o
MASS.c:37:23: error: unknown type name ‘Sint’; did you mean ‘uint’?
   37 | VR_sammon(double *dd, Sint *nn, Sint *kd, double *Y, Sint *niter,
      |                       ^~~~
      |                       uint
MASS.c:37:33: error: unknown type name ‘Sint’; did you mean ‘uint’?

(and dozens more compiler errors like that).

I was trying to find where the Sint type is defined and happened to look at the current CRAN version of MASS:

https://github.com/cran/MASS/blob/ba503858f613cfb21fae8e539e4c5bd81da1c10e/src/MASS.c#L38-L39

That Sint type is no longer used. That clued me in to "maybe my version of MASS is too old" and discovered I needed to run ./tools/rsync-recommended again.


Overall, it would be nice to have a "canonical" place to refer to for troubleshooting builds with common (or not-so-common!) issues recorded.

willingc commented 10 months ago

@MichaelChirico These are good suggestions esp. make clean. A FAQ page for troubleshooting in the guides would make good sense.

llrs commented 1 month ago

The recent R dev day resulted on a couple of issues, feedback #175 and #174. There is also some more feedback at #173 .

Now that the guide is getting more usage maybe it is time to add this?

Also it is worth mentioning svn cleanup --vacuum-pristines --remove-ignored --remove-unversioned to remove everything from the source repository (in case there are some other files or old files). This will require to download packages again via ./tools/rsync-recommended which would have fixed the original issue.