unable to install R ggmap package: compilation failed for package ‘jpeg’
Asked Answered
Q

1

8

When I am trying to install "ggmap" package in my R server(installed on Redhat linux) I am geeting the error message.. Please help me.. it is very important for me to install "ggmap" or else please suggest an alternative.

`> install.packages("ggmap", dependencies = T)
Installing package into ‘/home/rk/R/x86_64-redhat-linux-gnu-library/3.1’
(as ‘lib’ is unspecified)
also installing the dependency ‘jpeg’

trying URL 'http://cran.rstudio.com/src/contrib/jpeg_0.1-8.tar.gz'
Content type 'application/x-gzip' length 18046 bytes (17 KB)
opened URL
==================================================
downloaded 17 KB

trying URL 'http://cran.rstudio.com/src/contrib/ggmap_2.5.2.tar.gz'
Content type 'application/x-gzip' length 2948233 bytes (2.8 MB)
opened URL
==================================================
downloaded 2.8 MB

* installing *source* package ‘jpeg’ ...
** package ‘jpeg’ successfully unpacked and MD5 sums checked
** libs
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG  -I/usr/local/include    -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic  -c read.c -o read.o
In file included from read.c:1:
rjcommon.h:11:21: error: jpeglib.h: No such file or directory
rjcommon.h:29:2: error: #error "Sorry, only 8-bit libjpeg is supported"
In file included from read.c:1:
rjcommon.h:33: warning: return type defaults to ‘int’
rjcommon.h: In function ‘METHODDEF’:
rjcommon.h:33: error: expected declaration specifiers before ‘Rjpeg_error_exit’
rjcommon.h:41: error: expected declaration specifiers before ‘METHODDEF’
rjcommon.h:51: error: field ‘api’ has incomplete type
rjcommon.h:50: warning: empty declaration
rjcommon.h:59: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
rjcommon.h:75: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
In file included from read.c:3:
jcompat.h:7:20: error: jerror.h: No such file or directory
In file included from read.c:3:
jcompat.h:13: error: expected declaration specifiers before ‘METHODDEF’
jcompat.h:15: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘eoi_buf’
jcompat.h:15: error: expected declaration specifiers before ‘;’ token
jcompat.h:17: error: expected declaration specifiers before ‘METHODDEF’
jcompat.h:26: error: expected declaration specifiers before ‘METHODDEF’
jcompat.h:53: warning: ‘struct jpeg_decompress_struct’ declared inside parameter list
jcompat.h:53: warning: its scope is only this definition or declaration, which is probably not what you want
jcompat.h:53: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
read.c:7: warning: ‘struct jpeg_decompress_struct’ declared inside parameter list
read.c:7: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
read.c:29: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
rjcommon.h:32: error: old-style parameter declarations in prototyped function definition
read.c:176: error: expected ‘{’ at end of input
make: *** [read.o] Error 1
ERROR: compilation failed for package ‘jpeg’
* removing ‘/home/rk/R/x86_64-redhat-linux-gnu-library/3.1/jpeg’
Warning in install.packages :
  installation of package ‘jpeg’ had non-zero exit status
ERROR: dependency ‘jpeg’ is not available for package ‘ggmap’
* removing ‘/home/rk/R/x86_64-redhat-linux-gnu-library/3.1/ggmap’
Warning in install.packages :
  installation of package ‘ggmap’ had non-zero exit status

The downloaded source packages are in
    ‘/tmp/RtmpnFyWnM/downloaded_packages’
`
Qianaqibla answered 29/8, 2015 at 9:36 Comment(5)
In error message: jpeglib.h: No such file or directory. Install the headers for jpeg. On Unbuntu, it is sudo apt-get install libjpeg-dev.Convertite
I don't have Sudo access for my linux.. Please suggest an alternate that can be done from R console..Qianaqibla
I think you need to talk with the admin, ask him or her to install the library as suggested by @Pascal and update the version of R. You are using R v3.1, which is about two years old. Most recent packages require a newer version of R.Besides
Thank you Pascal for the help.. it worked.Qianaqibla
Some version of linux have jpeg.h in libjpeg-turbo-develAam
J
13

Ok, on CentOs 7 (3.10.0-514.el7.x86_64)

I use:

sudo yum install libjpeg-turbo-devel

to fix the installation of ggmap for use it on RStudio.

Juggins answered 14/3, 2017 at 11:54 Comment(2)
This also works if you're having difficulty installing the jpeg R package.Emmanuel
This helped me in publishing app on Rstudio-connect server on RHEL 7.7Vacuum

© 2022 - 2024 — McMap. All rights reserved.