# Can't install rAMPL library on R

**URL:** <https://discuss.ampl.com/t/cant-install-rampl-library-on-r/1946>\
**Category:** Support\
**Tags:** errors-and-messages\
**Created:** [October 12, 2024, 2:37am UTC](https://discuss.ampl.com/t/cant-install-rampl-library-on-r/1946 "2024-10-12T02:37:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bastian22](https://avatars.discourse-cdn.com/v4/letter/b/9dc877/32.png) [@Bastian22](https://discuss.ampl.com/u/Bastian22)\
**Post date:** [October 12, 2024, 2:37am UTC](https://discuss.ampl.com/t/cant-install-rampl-library-on-r/1946/1 "2024-10-12T02:37:00Z")

</div>

Hello.

I tried to install the rAMPL library following the instructions from [the installation guide](https://rampl.ampl.com/en/latest/getting-started.html#installation) :

```auto
install.packages("Rcpp", type="source")
install.packages("https://ampl.com/dl/API/rAMPL.tar.gz", repos=NULL, INSTALL_opts=c("--no-multiarch", "--no-staged-install"))

```

but I got the error “Warning in install.packages :  
installation of package ‘/tmp/RtmpMKXIvG/downloaded\_packages/rAMPL.tar.gz’ had non-zero exit status”

```auto
install.packages("Rcpp", type="source")
Installing package into ‘/home/user/R/x86_64-pc-linux-gnu-library/4.4’
(as ‘lib’ is unspecified)
trying URL 'https://packagemanager.posit.co/cran/latest/src/contrib/Rcpp_1.0.13.tar.gz'
Content type 'binary/octet-stream' length 3438451 bytes (3.3 MB)
==================================================
downloaded 3.3 MB

* installing *source* package ‘Rcpp’ ...
** package ‘Rcpp’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
using C++ compiler: ‘g++ (GCC) 14.2.1 20240910’
g++ -std=gnu++17 -I"/usr/include/R/" -DNDEBUG -I../inst/include/ -I/usr/local/include -fpic -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Wp,-D_GLIBCXX_ASSERTIONS -g -ffile-prefix-map=/build/r/src=/usr/src/debug/r -flto=auto -ffat-lto-objects -c api.cpp -o api.o
g++ -std=gnu++17 -I"/usr/include/R/" -DNDEBUG -I../inst/include/ -I/usr/local/include -fpic -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Wp,-D_GLIBCXX_ASSERTIONS -g -ffile-prefix-map=/build/r/src=/usr/src/debug/r -flto=auto -ffat-lto-objects -c attributes.cpp -o attributes.o
g++ -std=gnu++17 -I"/usr/include/R/" -DNDEBUG -I../inst/include/ -I/usr/local/include -fpic -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Wp,-D_GLIBCXX_ASSERTIONS -g -ffile-prefix-map=/build/r/src=/usr/src/debug/r -flto=auto -ffat-lto-objects -c barrier.cpp -o barrier.o
g++ -std=gnu++17 -I"/usr/include/R/" -DNDEBUG -I../inst/include/ -I/usr/local/include -fpic -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Wp,-D_GLIBCXX_ASSERTIONS -g -ffile-prefix-map=/build/r/src=/usr/src/debug/r -flto=auto -ffat-lto-objects -c date.cpp -o date.o
g++ -std=gnu++17 -I"/usr/include/R/" -DNDEBUG -I../inst/include/ -I/usr/local/include -fpic -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Wp,-D_GLIBCXX_ASSERTIONS -g -ffile-prefix-map=/build/r/src=/usr/src/debug/r -flto=auto -ffat-lto-objects -c module.cpp -o module.o
g++ -std=gnu++17 -I"/usr/include/R/" -DNDEBUG -I../inst/include/ -I/usr/local/include -fpic -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Wp,-D_GLIBCXX_ASSERTIONS -g -ffile-prefix-map=/build/r/src=/usr/src/debug/r -flto=auto -ffat-lto-objects -c rcpp_init.cpp -o rcpp_init.o
g++ -std=gnu++17 -shared -L/usr/lib64/R/lib -Wl,-O1 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -Wl,-z,pack-relative-relocs -flto=auto -o Rcpp.so api.o attributes.o barrier.o date.o module.o rcpp_init.o -L/usr/lib64/R/lib -lR
installing to /home/user/R/x86_64-pc-linux-gnu-library/4.4/00LOCK-Rcpp/00new/Rcpp/libs
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (Rcpp)

The downloaded source packages are in
	‘/tmp/RtmpMKXIvG/downloaded_packages’
> install.packages("https://ampl.com/dl/API/rAMPL.tar.gz", repos=NULL, INSTALL_opts=c("--no-multiarch", "--no-staged-install"))
Installing package into ‘/home/user/R/x86_64-pc-linux-gnu-library/4.4’
(as ‘lib’ is unspecified)
trying URL 'https://ampl.com/dl/API/rAMPL.tar.gz'
Content type 'application/x-gzip' length 5937422 bytes (5.7 MB)
==================================================
downloaded 5.7 MB

* installing *source* package ‘rAMPL’ ...
** using non-staged installation
** libs
using C++ compiler: ‘g++ (GCC) 14.2.1 20240910’
g++ -std=gnu++17 -I"/usr/include/R/" -DNDEBUG -I../src/include -Wall -I'/home/user/R/x86_64-pc-linux-gnu-library/4.4/Rcpp/include' -I/usr/local/include -fpic -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Wp,-D_GLIBCXX_ASSERTIONS -g -ffile-prefix-map=/build/r/src=/usr/src/debug/r -flto=auto -ffat-lto-objects -c RcppExports.cpp -o RcppExports.o
g++ -std=gnu++17 -I"/usr/include/R/" -DNDEBUG -I../src/include -Wall -I'/home/user/R/x86_64-pc-linux-gnu-library/4.4/Rcpp/include' -I/usr/local/include -fpic -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Wp,-D_GLIBCXX_ASSERTIONS -g -ffile-prefix-map=/build/r/src=/usr/src/debug/r -flto=auto -ffat-lto-objects -c rampl.cpp -o rampl.o
In file included from rbasicentity.h:8,
                 from rvar_entity.h:7,
                 from rampl.h:7,
                 from rampl.cpp:1:
utils.h: In instantiation of ‘Rcpp::XPtr<Class> getObj(const std::string&, SEXP) [with T = REnvironment; std::string = std::__cxx11::basic_string<char>; SEXP = SEXPREC*]’:
rampl.cpp:73:81: required from here
   73 | RAMPL::RAMPL(SEXP s): OHandler(NULL), EHandler(NULL), _impl(getObj<REnvironment>("Environment", s)->_impl) {
      | ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
utils.h:13:13: error: format not a string literal and no format arguments [-Werror=format-security]
   13 | Rf_error( (std::string("object is not of the type ")+type).c_str() );
      | ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: some warnings being treated as errors
make: *** [/usr/lib64/R/etc/Makeconf:204: rampl.o] Error 1
ERROR: compilation failed for package ‘rAMPL’
* removing ‘/home/user/R/x86_64-pc-linux-gnu-library/4.4/rAMPL’
Warning in install.packages :
  installation of package ‘/tmp/RtmpMKXIvG/downloaded_packages/rAMPL.tar.gz’ had non-zero exit status

```

Some info about my R installation:

```auto
version
               _                           
platform x86_64-pc-linux-gnu         
arch x86_64                      
os linux-gnu                   
system x86_64, linux-gnu           
status                                     
major 4                           
minor 4.1                         
year 2024                        
month 06                          
day 14                          
svn rev 86737                       
language R                           
version.string R version 4.4.1 (2024-06-14)
nickname Race for Your Life  

```

Some info about my system:

```auto
inxi -zv8  ✔ 
System:
  Kernel: 6.10.13-3-MANJARO arch: x86_64 bits: 64 compiler: gcc v: 14.2.1
    clocksource: tsc avail: hpet,acpi_pm
Desktop: GNOME v: 46.5 tk: GTK v: 3.24.43 wm: gnome-shell with: ulauncher
    tools: gsd-screensaver-proxy dm: GDM v: 46.2 Distro: Manjaro
    base: Arch Linux

```

Thank you

---

<div class="post-metadata">

**Author:** ![Jurgen\_Lentz](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/jurgen_lentz/32/192_2.png) [@Jurgen\_Lentz](https://discuss.ampl.com/u/Jurgen_Lentz)\
**Post date:** [October 12, 2024, 3:00pm UTC](https://discuss.ampl.com/t/cant-install-rampl-library-on-r/1946/2 "2024-10-12T15:00:39Z")

</div>

Hello @Bastian22,

Indeed! Thank you for reporting this bug.

It seems that the new version of R (in particular using -std=gnu++17) caused a format-security warning which we handle as an error. We adjusted the source code and now it should work.

If you encounter further issues, please let us know.

Best wishes

---

<div class="post-metadata">

**Author:** ![Bastian22](https://avatars.discourse-cdn.com/v4/letter/b/9dc877/32.png) [@Bastian22](https://discuss.ampl.com/u/Bastian22)\
**Post date:** [October 14, 2024, 1:48am UTC](https://discuss.ampl.com/t/cant-install-rampl-library-on-r/1946/3 "2024-10-14T01:48:24Z")

</div>

Thank you so much, it worked!
