How to build the shiny-server from source on Debian? - r

I am trying to launch an shiny server on company's Debian machine. Based on the wiki: https://github.com/rstudio/shiny-server/wiki/Building-Shiny-Server-from-Source, I choose to "build the server from source" since Debian is not a supported distribution.
I was following the instruction step by step. However, I had an error when I tried to run:
$ cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DPYTHON="$PYTHON" ../
-- The C compiler identification is GNU 4.9.2
-- The CXX compiler identification is GNU 4.9.2
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
CMake Error at external/pandoc/CMakeLists.txt:14 (file):
file DOWNLOAD HASH mismatch
for file: [/home/mli/shiny_server/shiny-server/tmp/external/pandoc/pandoc-1.12.3.zip]
expected hash: [1541304bf51d86e361b7d930f899ac1c]
actual hash: [d41d8cd98f00b204e9800998ecf8427e]
status: [7;"Couldn't connect to server"]
The detail of the error listed as:
mkdir: cannot create directory ‘/home/mli/shiny_server/shiny-server/tmp/external/pandoc/pandoc-1.12.3.zip’: File exists
End-of-central-directory signature not found. Either this file is not
a zipfile, or it constitutes one disk of a multi-part archive. In the
latter case the central directory and zipfile comment will be found on
the last disk(s) of this archive.
I have been searching a solution for a couple days but nothing is really working for me yet. It would be very nice if anyone could help me on this..
As an alternative, I have also downloaded the "shiny-server-1.3.0.403-amd64.deb" and installed it with "$ sudo gdebi". It successfully installed with a small error message:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Building data structures... Done
Building data structures... Done
Shiny Server
Shiny Server is a server program from RStudio, Inc. that makes Shiny applications available over the web. Shiny is a web application framework for the R statistical computation language.
Do you want to install the software package? [y/N]:y
Selecting previously unselected package shiny-server.
(Reading database ... 49759 files and directories currently installed.)
Preparing to unpack shiny-server-1.3.0.403-amd64.deb ...
Unpacking shiny-server (1.3.0.403) ...
Setting up shiny-server (1.3.0.403) ...
User shiny already exists
grep: /etc/init/shiny-server.conf: No such file or directory
Adding LANG to /etc/init.d/shiny-server, setting to en_US.UTF-8
However, I can't initiate the server by:
$ sudo start shiny-server
Nothing happened after I ran the "start" command. Also, my Debian version is below:
Distributor ID: Debian
Description: Debian GNU/Linux 8.4 (jessie)
Release: 8.4
Codename: jessie

Related

Install Fails - R package Boom 0.9 on Ubuntu 18.04

I'm unable to install Boom 0.9 on Ubuntu 18.04, Boom 0.8 installs without issue. However, we need 0.9 as a pre-req for CausalImpact.
g++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-7/README.Bugs> for instructions.
/usr/lib/R/etc/Makeconf:176: recipe for target 'Models/Glm/PosteriorSamplers/fill_poisson_mixture_approximation_table_2.o' failed
make[1]: *** [Models/Glm/PosteriorSamplers/fill_poisson_mixture_approximation_table_2.o] Error 4
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory '/tmp/RtmpKl6J7B/R.INSTALL90e7ca998b2/Boom/src'
ERROR: compilation failed for package 'Boom'
* removing '/usr/local/lib/R/site-library/Boom'
The downloaded source packages are in
'/tmp/RtmpIk7UFT/downloaded_packages'
Warning message:
In install.packages("Boom") : installation of one or more packages failed,
probably 'Boom'
I've ensured that build-essential is up to date with the most current version available (and tried g++-8 as well).
I think someone else in your org may have already contacted me about this. We are mid-flight debugging.
Boom is a large package and can time out when building. The first thing to check is that you are able to build with multiple cores (i.e. you can pass the -j x flag to make).
As a diagnostic you can try building the package without involving R. Clone https://github.com/steve-the-bayesian/BOOM and build with either bazel (up to date) or make (not too far out of date). If this build succeeds then compare flags passed to the R build vs the native build.
To better understand where R is failing, download the Boom package from CRAN https://cran.r-project.org/src/contrib/Boom_0.9.1.tar.gz and try the following from the command line
R CMD CHECK Boom_0.9.1.tar.gz
This will probably fail, but it will generate a directory called Boom.Rcheck, which contains a file 00install.out containing all the compiler output.
It is suspicious that the build above fails on the poisson_mixture_approximation_table, which is a large file that might be overflowing your stack. Or that might be a coincidence.
Take a look at: https://cran.r-project.org/web/checks/check_results_Boom.html
The check page says 'GNU make' is a undeclared SystemRequirement.
Version: 0.9.1
Check: for GNU extensions in Makefiles
Result: NOTE
GNU make is a SystemRequirements.
Since your installation process also seems to fail at make[1] it might make sense to check if GNU make is installed.
The installation of the Boom package from source (also during the Docker build) can fail for several reasons:
low memory pro core
low stack size
timeout of the build process (possible)
We are currently using the following setup for Docker:
core: 4
memory: 8GB
We can use the following command to set the stack size to 16MB before starting the installation:
Docker:
RUN ulimit -s 16384 \
&& R -e 'install.packages("Boom");'
Linux:
ulimit -s 16384 \
&& R -e 'install.packages("Boom");'
Note: The stack size is an operating system-related configuration and can vary depending on the host operating system used.
Note: The command to install the boom package may be different for your application. We use for example packrat.
Similar issue: link

Cargo shows an error compiling "qml v0.0.9"

I tried to compile a sample Rust program which uses QML and got the following error:
error: failed to run custom build command for `qml v0.0.9`
process didn't exit successfully: `/home/olaf/SourceCode/rust_projects/sousa/target/debug/build/qml-cf7d687f9f68bd13/build-script-build` (exit code: 101)
--- stderr
thread 'main' panicked at 'Cannot build qrc resource:
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Doxygen: /usr/bin/doxygen (found version \"1.8.11\")
-- Configuring incomplete, errors occurred!
See also \"/home/olaf/SourceCode/rust_projects/sousa/target/debug/build/qml-29ff7d8391813cc4/out/DOtherSide/build/CMakeFiles/CMakeOutput.log\"."
"Klone nach \'DOtherSide\' ...
CMake Error at /usr/lib/x86_64-linux-gnu/cmake/Qt5Core/Qt5CoreConfig.cmake:27 (message):
The imported target \"Qt5::Core\" references the file
\"/usr/lib/x86_64-linux-gnu/libQt5Core.so.5.5.1\"
but this file does not exist. Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
\"/usr/lib/x86_64-linux-gnu/cmake/Qt5Core/Qt5CoreConfig.cmake\"
but not all the files it references.
Call Stack (most recent call first):
/usr/lib/x86_64-linux-gnu/cmake/Qt5Core/Qt5CoreConfig.cmake:43 (_qt5_Core_check_file_exists)
/usr/lib/x86_64-linux-gnu/cmake/Qt5Core/Qt5CoreConfig.cmake:134 (_populate_Core_target_properties)
lib/CMakeLists.txt:10 (find_package)
"', /home/olaf/.cargo/registry/src/github.com-1ecc6299db9ec823/qml-0.0.9/build.rs:32:8
note: Run with `RUST_BACKTRACE=1` for a backtrace.
Edit:
I have installed Qt 5.8, 5.9.1 and 5.9.3 but they are installed at my home folder ~/Qt and I think Cargo is looking somewhere else /usr/lib/...
How do I tell Cargo where to look for Qt?
Or do I have to install a specific package of Qt under /usr/lib/...?
As you can see in the error, the issue is that the file /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.5.1 (which a Qt dynamic library) does not exist, which means that you need to install this version of Qt on your machine.
If you're on Ubuntu or an Ubuntu-derived distro, you can follow the instructions here to install it.

installing R 3.3.2 in HOME directory in centos

I am trying to install R 3.3.2 on a server running centos 6. I have to install it in my Home directory on the server because i don't have the permissions anywhere else. I downloaded it using wget and then tar. But when I reach the point of "./configure" in order to run "make" afterwards it stops with an error.
checking if zlib version >= 1.2.5... no
checking whether zlib support suffices... configure: error: zlib library and headers are required
I installed zlib 1.2.8 and added its path to my bash_profile then tried to run the command ./configure for the R again but i got the same error. It seems that it still sees that I am using an old version of zlib (1.2.3) (The one that is already installed on the server). Have anyone had a similar issue or have any advices regarding this ? Thanks in advance
and added its path to my bash_profile
I am curious if you prepended or appended the path. In the latter case, configure will detect the old zlib.
In order to prepend, do like
export LD_LIBRARY_PATH=/path/to/zlib/inst/dir/lib:${LD_LIBRARY_PATH}

QT on Cygwin -- IPC Errors

I've downloaded the source for QT 5.6.0 and I'm attempting to compile/install it on a Cygwin installation for Windows.
The Cygwin build already has Qt4 and Qt3 libraries installed. Trying to upgrade so I can install the latest QtCreator suite.
Here is my Cygwin version via uname -a:
CYGWIN_NT-10.0 J_Mick-Windoze 2.5.1(0.297/5/3) 2016-04-21 22:14 x86_64 Cygwin
When I try to compile QT 5.6.1 via running ./configure -platform cygwin-g++ -prefix $PWD/qtbase -opensource -nomake tests I get the following error:
Running configuration tests (phase 1)...
Done running configuration tests.
Creating qmake...
.In file included from /home/JasonMick/Install_Stuff/qt-everywhere-opensource-src-5.6.0/qtbase/include/QtCore/5.6.0/QtCore/private/qcore_unix_p.h:1:0,
from /home/JasonMick/Install_Stuff/qt-everywhere-opensource-src-5.6.0/qtbase/src/corelib/global/qglobal.cpp:90:
/home/JasonMick/Install_Stuff/qt-everywhere-opensource-src-5.6.0/qtbase/src/corelib/kernel/qcore_unix_p.h: In function ‘key_t qt_safe_ftok(const QByteArray&, int)’:
/home/JasonMick/Install_Stuff/qt-everywhere-opensource-src-5.6.0/qtbase/src/corelib/kernel/qcore_unix_p.h:333:12: error: ‘::ftok’ has not been declared
return ::ftok(filename.constData(), qHash(filename, proj_id));
^
make: *** [qglobal.o] Error 1
Now clearly there is support for cygwin in the QT project as grepping inside configure I see the platform:
PLATFORM=cygwin-g++
...is defined. Doing some reading I read that ftok is a part of the IPC group of shared memory functions. One link regarding a similar error with a different app suggested linking in -lcygwin. I successfully added this to the L_FLAGS variable in the configure file, but it's still giving the same error, even when I specify the Cygwin as the platform via the -platform flag.
I would appreciate any advice as to how to get rid of this issue -- which I believe is attributable to some sort of missing IPC library error.

R studio failing to use rJava lib and failing javareconf

I'm running Rstudio on its own server.
Java is installed with good java_home and bin.
R is installed. rJava is installed.
Tried to do command: library("rJava") but had issues with libjvm.so, do following Rstudio recommandation I did sudo R CMD javareconf with root.
Here is the output of my javareconf:
Java interpreter : /home/scoremd/jdk1.7.0_03/jre/bin/java
Java version : 1.7.0_03
Java home path : /home/scoremd/jdk1.7.0_03
Java compiler : /home/scoremd/jdk1.7.0_03/bin/javac
Java headers gen.: /home/scoremd/jdk1.7.0_03/bin/javah
Java archive tool: /home/scoremd/jdk1.7.0_03/bin/jar
NOTE: Your JVM has a bogus java.library.path system property!
Trying a heuristic via sun.boot.library.path to find jvm library...
Java library path: $(JAVA_HOME)/jre/lib/amd64:$(JAVA_HOME)/jre/lib/amd64/server
JNI linker flags : -L$(JAVA_HOME)/jre/lib/amd64 -L$(JAVA_HOME)/jre/lib/amd64/server -ljvm
JNI cpp flags : -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux
Seems there is issue with finding the java library path... but my java is working fine and R also.
I didn't receive any solution from RStudio support and community (told me to ask in SO ....).
I have rstudio-server installed on my Centos server. There are a couple of users using rstudio and we decided to upgrade R from 3.6 to 4.0.
After the upgrade :
all users were running R 4.0.
No user could install rJava using install.package('rJava'). This error always popped up
configure: error: Cannot compile a simple JNI program. See config.log for details.
Make sure you have Java Development Kit installed and correctly registered in R.
If in doubt, re-run "R CMD javareconf" as root.
ERROR: configuration failed for package ‘rJava’
Running SUDO R CMD javareconf went smoothly, and also when I opened R as root and went along and tried install.packages('rJava') it installed the package just fine. (unbeknownst to me, root ran R 3.6 and users 4.0, see solution below)
However it did not work installing the package for users in R studio server. Always stating the same "try running sudo R CMD javareconf" as if the Java path for the users was wrong.
so we tried setting the "JAVA_HOME" variable to the same path that java jdk was installed in (found by searching installed packages in yum). That did not solve it.
my solution
I saw that root was running version 3.6 of R while all users ran 4.0. This was because I had installed 4.0 in another directory.. The directory of R 4.0 happens to be found first by the users. However for the root user... it finds the path of R 3.6 first.
So I set the path to the 4.0 folder in the $PATH variable of the root user, so that would find version 4.0 before finding R 3.6
echo $PATH
export PATH="/usr/local/bin:$PATH"
echo $PATH
Then I ran R as that user and ran "R CMD javareconf", installed the packages and all users are happy and working again.
(disclaimer, I'm not a experienced linux admin, there may be a better solution for running different R versions)
It's been some time since I used rJava, and it was on Windows, but I have some notes which may help you:
Make sure that the JRI native library is in a directory listed in java.library.path
(also confirmed using Process Explorer that jri.dll is being loaded)
The R process loads up jvm.dll when you do library(rJava)
Replace jvm.dll iny my notes above with libjvm.so in your case, and jri.dll with whatever .so file is relevant to you.

Resources