jeroen / protolite

Fast and Simple Object Serialization to Protocol Buffers
Other
48 stars 9 forks source link

protolite is not installing #11

Closed diwashrestha closed 5 years ago

diwashrestha commented 5 years ago

I installed libprotobuf-dev but still get this error.

install.packages("protolite")

Installing package into ‘/home/diwash/R/x86_64-pc-linux-gnu-library/3.5’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/protolite_1.8.tar.gz'
Content type 'application/x-gzip' length 16931 bytes (16 KB)
==================================================
downloaded 16 KB

* installing *source* package ‘protolite’ ...
** package ‘protolite’ successfully unpacked and MD5 sums checked
Found pkg-config cflags and libs!
Using PKG_CFLAGS=-pthread
Using PKG_LIBS=-lprotobuf -pthread -lpthread
------------------------- ANTICONF ERROR ---------------------------
Configuration failed because protobuf was not found. Try installing:
 * deb: libprotobuf-dev (Debian, Ubuntu, etc)
 * rpm: protobuf-devel (Fedora, EPEL)
 * csw: protobuf_dev (Solaris)
 * brew: protobuf (OSX)
If protobuf is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a protobuf.pc file. If pkg-config
is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:
R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
--------------------------------------------------------------------
ERROR: configuration failed for package ‘protolite’
* removing ‘/home/diwash/R/x86_64-pc-linux-gnu-library/3.5/protolite’
Warning in install.packages :
  installation of package ‘protolite’ had non-zero exit status

The downloaded source packages are in
    ‘/tmp/RtmphthaXf/downloaded_packages’
jeroen commented 5 years ago

Which OS is this? Please include sessionInfo()

diwashrestha commented 5 years ago

OS : ubuntu 18.04 sessionInfo()

R version 3.5.1 (2018-07-02) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 18.04.2 LTS

Matrix products: default BLAS: /opt/microsoft/ropen/3.5.1/lib64/R/lib/libRblas.so LAPACK: /opt/microsoft/ropen/3.5.1/lib64/R/lib/libRlapack.so

locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=bho_NP
[4] LC_COLLATE=en_US.UTF-8 LC_MONETARY=bho_NP LC_MESSAGES=en_US.UTF-8 [7] LC_PAPER=bho_NP LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=bho_NP LC_IDENTIFICATION=C

attached base packages: [1] stats graphics grDevices utils datasets methods base

other attached packages: [1] RevoUtils_11.0.1 RevoUtilsMath_11.0.0

loaded via a namespace (and not attached): [1] compiler_3.5.1 tools_3.5.1 yaml_2.2.0

jeroen commented 5 years ago

You're better off using the real R instead of microsoft R. Try this:

sudo add-apt-repository ppa:marutter/rrutter3.5
apt-get update
apt-get install r-base-dev
diwashrestha commented 5 years ago

I installed R 3.5.2 but got same error.

install.packages("protolite") Installing package into ‘/home/diwash/R/x86_64-pc-linux-gnu-library/3.5’ (as ‘lib’ is unspecified) trying URL 'https://cloud.r-project.org/src/contrib/protolite_1.8.tar.gz' Content type 'application/x-gzip' length 16931 bytes (16 KB)

downloaded 16 KB

The downloaded source packages are in ‘/tmp/RtmpJ7JQOJ/downloaded_packages’

sessionInfo() R version 3.5.2 (2018-12-20) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 18.04.2 LTS

Matrix products: default BLAS: /usr/lib/x86_64-linux-gnu/openblas/libblas.so.3 LAPACK: /usr/lib/x86_64-linux-gnu/libopenblasp-r0.2.20.so

locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=bho_NP
[4] LC_COLLATE=en_US.UTF-8 LC_MONETARY=bho_NP LC_MESSAGES=en_US.UTF-8 [7] LC_PAPER=bho_NP LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=bho_NP LC_IDENTIFICATION=C

attached base packages: [1] stats graphics grDevices utils datasets methods base

loaded via a namespace (and not attached): [1] compiler_3.5.2 tools_3.5.2 yaml_2.2.0

jeroen commented 5 years ago

Can you please run the following code and show me the output:

R_HOME=$(R RHOME)
CXXCPP=$(${R_HOME}/bin/R CMD config CXXCPP)
CXXFLAGS=$(${R_HOME}/bin/R CMD config CXXFLAGS)
CPPFLAGS=$(${R_HOME}/bin/R CMD config CPPFLAGS)
PKG_TEST_HEADER="<google/protobuf/message.h>"
echo "#include $PKG_TEST_HEADER" | ${CXXCPP} ${CPPFLAGS} ${PKG_CFLAGS} ${CXXFLAGS} -xc++ - > /dev/null
diwashrestha commented 5 years ago

where should i run this code in terminal or r console?

jeroen commented 5 years ago

In the terminal

diwashrestha commented 5 years ago

Without sudo:

diwash@diwash-Lenovo-G50-80:~$ R_HOME=$(R RHOME) diwash@diwash-Lenovo-G50-80:~$ CXXCPP=$(${R_HOME}/bin/R CMD config CXXCPP) diwash@diwash-Lenovo-G50-80:~$ CXXFLAGS=$(${R_HOME}/bin/R CMD config CXXFLAGS) diwash@diwash-Lenovo-G50-80:~$ CPPFLAGS=$(${R_HOME}/bin/R CMD config CPPFLAGS) diwash@diwash-Lenovo-G50-80:~$ PKG_TEST_HEADER="<google/protobuf/message.h>" diwash@diwash-Lenovo-G50-80:~$ echo "#include $PKG_TEST_HEADER" | ${CXXCPP} ${CPPFLAGS} ${PKG_CFLAGS} ${CXXFLAGS} -xc++ - > /dev/null

:1:10: fatal error: /usr/local/include/google/protobuf/message.h: Permission denied compilation terminated. With sudo: root@diwash-Lenovo-G50-80:/home/diwash# R_HOME=$(R RHOME) root@diwash-Lenovo-G50-80:/home/diwash# CXXCPP=$(${R_HOME}/bin/R CMD config CXXCPP) root@diwash-Lenovo-G50-80:/home/diwash# CXXFLAGS=$(${R_HOME}/bin/R CMD config CXXFLAGS) root@diwash-Lenovo-G50-80:/home/diwash# CPPFLAGS=$(${R_HOME}/bin/R CMD config CPPFLAGS) root@diwash-Lenovo-G50-80:/home/diwash# PKG_TEST_HEADER="" root@diwash-Lenovo-G50-80:/home/diwash# echo "#include $PKG_TEST_HEADER" | ${CXXCPP} ${CPPFLAGS} ${PKG_CFLAGS} ${CXXFLAGS} -xc++ - > /dev/null
jeroen commented 5 years ago

You have a broken version of protobuf in /usr/local that you probably compiled from source. This version probably masks the real libprotobuf-dev. Remove the broken version by doing:

sudo rm -Rf /usr/local/include/google
sudo rm -f /usr/local/lib/libprotobuf*