gamlss-dev / gamlss

gamlss: Generalized Additive Models for Location Scale and Shape
https://CRAN.R-project.org/package=gamlss
10 stars 4 forks source link

Remove compiled files from version control and add to .gitignore #8

Open BerriJ opened 2 months ago

BerriJ commented 2 months ago

This PR removes some .o, .so, and ,dll files from git version control and adds them to the .gitignore file.

Almost certainly, these need to be compiled locally during package install or other functions that start compilation of the respective C code.

At the moment:

  1. Cloning the repository
  2. Executing devtools::load_all()

Leads to an error message due to the presence of these files (devtools assumes that it does not need to compile again):

[R] devtools::load_all()
ℹ Loading gamlss
Loading required package: splines
Loading required package: gamlss.data

Attaching package: ‘gamlss.data’

The following object is masked from ‘package:datasets’:

    sleep

Loading required package: gamlss.dist
Loading required package: nlme
Loading required package: parallel
Error in dyn.load(dll_copy_file) : 
  unable to load shared object '/tmp/RtmpyAVSHy/pkgloadef057eaaa2/gamlss.so':
  /tmp/RtmpyAVSHy/pkgloadef057eaaa2/gamlss.so: invalid ELF header

Merging this PR solves this. A call to devtools::load_all() will trigger compilation as it should:

[R] devtools::load_all()
ℹ Loading gamlss
ℹ Re-compiling gamlss (debug build)
── R CMD INSTALL ──────────────────────────────────────────────────────────────────
─  installing *source* package ‘gamlss’ ...
   ** using staged installation
   ** libs
   using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’
   ccache gcc -I"/usr/share/R/include" -DNDEBUG       -fpic  -g -O2 -ffile-prefix-map=/build/r-base-H0vbME/r-base-4.3.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -UNDEBUG -Wall -pedantic -g -O0 -fdiagnostics-color=always -c gamlss_init.c -o gamlss_init.o
   ccache gcc -I"/usr/share/R/include" -DNDEBUG       -fpic  -g -O2 -ffile-prefix-map=/build/r-base-H0vbME/r-base-4.3.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -UNDEBUG -Wall -pedantic -g -O0 -fdiagnostics-color=always -c genD.c -o genD.o
   ccache gcc -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -flto=auto -ffat-lto-objects -flto=auto -Wl,-z,relro -o gamlss.so gamlss_init.o genD.o -L/usr/lib/R/lib -lR
   installing to /tmp/RtmpyAVSHy/devtools_install_ef07715f8e/00LOCK-gamlss/00new/gamlss/libs
   ** checking absolute paths in shared objects and dynamic libraries
─  DONE (gamlss)
 **********   GAMLSS Version 5.4-22  ********** 
For more on GAMLSS look at https://www.gamlss.com/
Type gamlssNews() to see new features/changes/bug fixes

Best Regards, BerriJ

zeileis commented 2 months ago

Thanks for the PR. I agree that the targets should not be in the git repository and adding them to the .gitignore is a good idea. Mikis @mstasinopoulos, is there a particular reason for adding these files?