Open ChaoXu1997 opened 3 years ago
Update:2021/08/17
This won't work anymore, try v1.4.1717.
Follow this one
But I use VERS=v1.4.1106 instead. Letter 'v' means a success. Tested on Ubuntu 20.04 LTS , Oracle Cloud Arm-based Ampere
#1. Install R; Debian stretch has latest version
sudo apt-get update
v sudo apt-get install -y r-base r-base-dev
v sudo apt-get install -y git r-recommended python-dev
#2. Download RStudio source
sudo -i
v VERS=v1.4.1106
v wget -O $VERS https://github.com/rstudio/rstudio/archive/refs/tags/$VERS.tar.gz
v mkdir ~/rstudio-$VERS
v tar xvf ~/$VERS -C ~/rstudio-$VERS --strip-components 1
v rm ~/$VERS
#3. install-common
#a. Yarn was installed, but doesn't seem to be working :(
v curl -sL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
#b.
v cd ~/rstudio-$VERS/dependencies/common/
#c. Avoid installing crashpad
v sudo nano ~/rstudio-$VERS/dependencies/common/install-common
# Comment these lines and add a : for nop
# ./install-crashpad
# sudo ./install-crashpad
v ./install-common
#4. Install Java SDK
v apt-get install -y openjdk-11-jdk
v update-java-alternatives --jre-headless --jre --set java-1.11.0-openjdk-arm64
v update-java-alternatives -l
v update-alternatives --config java
v apt autoremove
#5. install-dependencies
v cd ~/rstudio-$VERS/dependencies/linux/
v ./install-dependencies-focal --exclude-qt-sdk
#6. build and install
v cd ~/rstudio-$VERS/
v rm -r ./build
v mkdir build
v cd build
v cmake .. -DRSTUDIO_TARGET=Server -DCMAKE_BUILD_TYPE=Release
v make install
#7. Configure Rstudio
v useradd -r rstudio-server
v cp /usr/local/lib/rstudio-server/extras/init.d/debian/rstudio-server /etc/init.d/rstudio-server
v chmod +x /etc/init.d/rstudio-server
v update-rc.d rstudio-server defaults
v ln -f -s /usr/local/lib/rstudio-server/bin/rstudio-server /usr/sbin/rstudio-server
v chmod 777 -R /usr/local/lib/R/site-library/
mkdir -p /var/run/rstudio-server /var/lock/rstudio-server /var/log/rstudio-server /var/lib/rstudio-server
v mkdir -p /var/run/rstudio-server
v mkdir -p /var/lock/rstudio-server
v mkdir -p /var/log/rstudio-server
v mkdir -p /var/lib/rstudio-server
v nano /etc/init.d/rstudio-server
# Modify your PATH for using the compiled version of R
PATH=/usr/local/bin/:/sbin:/usr/sbin:/bin:/usr/bin
v systemctl daemon-reload
v rstudio-server start
#8. Test
v lsof -i -P -n | grep 8787
Hi, I got this error while following your guide and running cmake .. -DRSTUDIO_TARGET=Server -DCMAKE_BUILD_TYPE=Release
.
Please set them or make sure they are set and tested correctly in the CMake files:
SOCI_CORE_LIB
linked by target "rstudio-core-tests" in directory /root/rstudio-v1.4.1106/src/cpp/core
linked by target "rstudio-core" in directory /root/rstudio-v1.4.1106/src/cpp/core
linked by target "rserver" in directory /root/rstudio-v1.4.1106/src/cpp/server
SOCI_POSTGRESQL_LIB
linked by target "rstudio-core-tests" in directory /root/rstudio-v1.4.1106/src/cpp/core
linked by target "rstudio-core" in directory /root/rstudio-v1.4.1106/src/cpp/core
linked by target "rserver" in directory /root/rstudio-v1.4.1106/src/cpp/server
SOCI_SQLITE_LIB
linked by target "rstudio-core-tests" in directory /root/rstudio-v1.4.1106/src/cpp/core
linked by target "rstudio-core" in directory /root/rstudio-v1.4.1106/src/cpp/core
linked by target "rserver" in directory /root/rstudio-v1.4.1106/src/cpp/server
-- Configuring incomplete, errors occurred!
See also "/root/rstudio-v1.4.1106/build/CMakeFiles/CMakeOutput.log".
See also "/root/rstudio-v1.4.1106/build/CMakeFiles/CMakeError.log".
Here is CMakeError.log
Determining if the function getpeereid exists failed with the following output:
Change Dir: /root/rstudio-v1.4.1106/build/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/make cmTC_36468/fast && /usr/bin/make -f CMakeFiles/cmTC_36468.dir/build.make CMakeFiles/cmTC_36468.dir/build
make[1]: Entering directory '/root/rstudio-v1.4.1106/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_36468.dir/CheckFunctionExists.c.o
/usr/bin/cc -DCHECK_FUNCTION_EXISTS=getpeereid -fPIE -o CMakeFiles/cmTC_36468.dir/CheckFunctionExists.c.o -c /usr/share/cmake-3.16/Modules/CheckFunctionExists.c
Linking C executable cmTC_36468
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_36468.dir/link.txt --verbose=1
/usr/bin/cc -DCHECK_FUNCTION_EXISTS=getpeereid -pie -Wl,-z,relro,-z,now CMakeFiles/cmTC_36468.dir/CheckFunctionExists.c.o -o cmTC_36468
/usr/bin/ld: CMakeFiles/cmTC_36468.dir/CheckFunctionExists.c.o: in function `main':
CheckFunctionExists.c:(.text+0x10): undefined reference to `getpeereid'
collect2: error: ld returned 1 exit status
make[1]: *** [CMakeFiles/cmTC_36468.dir/build.make:87: cmTC_36468] Error 1
make[1]: Leaving directory '/root/rstudio-v1.4.1106/build/CMakeFiles/CMakeTmp'
make: *** [Makefile:121: cmTC_36468/fast] Error 2
Compiling soci
requires a PostgreSQL client library. Try adding sudo apt-get install libpq-dev
before building.
Thanks, I tried that, but it still shows the same error.
$ apt-cache search getpeereid
libbsd-dev - utility functions from BSD systems - development files
Try sudo apt-get install libbsd-dev
That did not help either. :(
Hmmm ... I don't have a Raspberry Pi - I have a Jetson but it's running 18.04 and I haven't seen this error. I did run into the libpq one though
I am using Ubuntu 20.04 on an Oracle cloud ARM machine. It gives 24 GB RAM and a 4 core CPU as always free. This one worked, but I can't change the default username and password:
Hmmm ... how much RAM is in the Raspberry Pi? It's been a while but I used to have RStudio Server builds crash on my 4 GB Jetson Nano because the Java steps ran out of RAM.
You may get up to 8 GB on a raspberry pi. Better is to sign up for oracle cloud always free tier.
Use this one; it's the best for ARM:
@r-saikat
My guide is specific working only for v1.4.1106 and Ubuntu 20.04 LTS. It has been successfully tested on Oracle Arm-based Ampere.
When you compile the latest version rather than v1.4.1106, it will come out with these 3 LIB missing errors.
SOCI_CORE_LIB
SOCI_POSTGRESQL_LIB
SOCI_SQLITE_LIB
@myfingerhurt My build process is now working for Ubuntu 18.04 LTS and v1.4.1717 (NVIDIA Jetson). I believe the same scripts will work on 20.04 LTS. They're essentially the same as the ones that come in the RStudio source except:
arm64
pandoc
from the GitHub repo - binaries are there for both amd64
and arm64
. The scripts patch the RStudio cmake
configuration to use the downloaded version instead of the one that's hard-coded in RStudio's scripts.crashpad
. It downloads some horrendous Google build tools which include amd64
binaries that crash on an arm64
machine.amd64
binary for Node.js on Linux. Mine fetches an arm64
binary on arm64
machines like the Jetson.I have a bit more documentation to clean up and some more testing but it seems to be working. In particular I haven't had any problems with soci. There are some build dependencies; you need at least libpq-dev
for it but I think the RStudio scripts install that.
@myfingerhurt I used the docker one because it's easy to deploy and works. I am a stats guy with limited computer knowledge. Also, it's quick to deploy. Can you share the arm64 binary you built on oracle ampere, maybe in a repo, so that I may deploy it without needing to build it separately?
You may get up to 8 GB on a raspberry pi. Better is to sign up for oracle cloud always free tier.
Use this one; it's the best for ARM:
Ah ... interesting. I looked at it and he may be getting the binaries indirectly from my Jetson Docker image ... more motivation for me to document it, especially because of RStudio's AGPL-3 licensing. My source is available here on GitHub but there are some files now that I've hacked from the RStudio source.
In an ideal world there'd be free / low cost CI tools for arm64
equivalent to what we have with GitHub Actions for amd64
. RStudio uses Jenkins and Docker for their CI/CD and only the Docker part needs to run on the Arm machine. But as I noted, the RStudio build process has some third-party binaries that are Intel / AMD only.
@r-saikat
Here is what you requested. https://www.dropbox.com/s/aq6vdse8vw77d5z/rstudio-server-v1.4.1106-arm64.tar.gz?dl=0
$readelf -h /usr/local/lib/rstudio-server/bin/rserver
ELF Header:
Magic: 7f 45 4c 46 02 01 01 03 00 00 00 00 00 00 00 00
Class: ELF64
Data: 2's complement, little endian
Version: 1 (current)
OS/ABI: UNIX - GNU
ABI Version: 0
Type: DYN (Shared object file)
Machine: AArch64
Version: 0x1
Entry point address: 0x5e27c
Start of program headers: 64 (bytes into file)
Start of section headers: 6989784 (bytes into file)
Flags: 0x0
Size of this header: 64 (bytes)
Size of program headers: 56 (bytes)
Number of program headers: 9
Size of section headers: 64 (bytes)
Number of section headers: 30
Section header string table index: 29
Thank you. I'll try using this.
How can I compile rstudio-server on raspberry pi 4? I try this script but it doesn't work