Lỗi trong khi cố gắng biên dịch RStudio


8

Tôi đang sử dụng Raspbian trong Raspberry Pi 2 Model B

Tôi đã làm theo các hướng dẫn trong Trang web RStudio và trong chủ đề này https://www.raspberrypi.org/forums/viewtopic.php?f=34&t=55828

sudo su
apt-get install git r-recommended
git clone https://github.com/rstudio/rstudio.git
cd rstudio
./dependencies/linux/install-dependencies-debian
mkdir build
cd build
cmake .. -DRSTUDIO_TARGET=Server -DCMAKE_BUILD_TYPE=Release
make install

Nhưng khi thực hiện cmake .. -DRSTUDIO_TARGET=Server -DCMAKE_BUILD_TYPE=Releasenó sẽ ném cho tôi lỗi này:

CMake Error at src/cpp/session/CMakeLists.txt:23 (message):
  Dictionaries not found (re-run install-dependencies script to install)


-- Configuring incomplete, errors occurred!
See also "/home/pi/rstudio/build/CMakeFiles/CMakeOutput.log".
See also "/home/pi/rstudio/build/CMakeFiles/CMakeError.log".

Tôi đã thử cài đặt lại các phụ thuộc nhưng điều đó không giúp được gì

Đây là nhật ký lỗi:

Determining if the function getpeereid exists failed with the following output:
Change Dir: /home/pi/rstudio/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTryCompileExec3944045131/fast"
/usr/bin/make -f CMakeFiles/cmTryCompileExec3944045131.dir/build.make CMakeFiles/cmTryCompileExec3944045131.dir/build
make[1]: Entering directory '/home/pi/rstudio/build/CMakeFiles/CMakeTmp'
/usr/bin/cmake -E cmake_progress_report /home/pi/rstudio/build/CMakeFiles/CMakeTmp/CMakeFiles 1
Building C object CMakeFiles/cmTryCompileExec3944045131.dir/CheckFunctionExists.c.o
/usr/bin/cc   -DCHECK_FUNCTION_EXISTS=getpeereid   -o CMakeFiles/cmTryCompileExec3944045131.dir/CheckFunctionExists.c.o   -c /usr/share/cmake-3.0/Modules/CheckFunction$
Linking C executable cmTryCompileExec3944045131
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec3944045131.dir/link.txt --verbose=1
/usr/bin/cc   -DCHECK_FUNCTION_EXISTS=getpeereid    CMakeFiles/cmTryCompileExec3944045131.dir/CheckFunctionExists.c.o  -o cmTryCompileExec3944045131 -rdynamic
CMakeFiles/cmTryCompileExec3944045131.dir/CheckFunctionExists.c.o: In function `main':
CheckFunctionExists.c:(.text+0x14): undefined reference to `getpeereid'
collect2: error: ld returned 1 exit status
CMakeFiles/cmTryCompileExec3944045131.dir/build.make:88: recipe for target 'cmTryCompileExec3944045131' failed
make[1]: *** [cmTryCompileExec3944045131] Error 1
make[1]: Leaving directory '/home/pi/rstudio/build/CMakeFiles/CMakeTmp'
Makefile:118: recipe for target 'cmTryCompileExec3944045131/fast' failed
make: *** [cmTryCompileExec3944045131/fast] Error 2

Bạn có biết những gì có thể xảy ra?

CHỈNH SỬA 1:

Đây là đầu ra của việc chạy ./dependencies/linux/install-dependencies-debian:

root@raspberrypi:/home/pi/rstudio# ./dependencies/linux/install-dependencies-debian
Reading package lists... Done
Building dependency tree
Reading state information... Done
build-essential is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Reading package lists... Done
Building dependency tree
Reading state information... Done
pkg-config is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Reading package lists... Done
Building dependency tree
Reading state information... Done
fakeroot is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Reading package lists... Done
Building dependency tree
Reading state information... Done
cmake is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Reading package lists... Done
Building dependency tree
Reading state information... Done
uuid-dev is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Reading package lists... Done
Building dependency tree
Reading state information... Done
libssl-dev is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Reading package lists... Done
Building dependency tree
Reading state information... Done
libbz2-dev is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Reading package lists... Done
Building dependency tree
Reading state information... Done
zlib1g-dev is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'libpam0g-dev' instead of 'libpam-dev'
libpam0g-dev is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Reading package lists... Done
Building dependency tree
Reading state information... Done
libxslt1-dev is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Reading package lists... Done
Building dependency tree
Reading state information... Done
libapparmor1 is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Reading package lists... Done
Building dependency tree
Reading state information... Done
apparmor-utils is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Reading package lists... Done
Building dependency tree
Reading state information... Done
libboost-all-dev is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Reading package lists... Done
Building dependency tree
Reading state information... Done
libpango1.0-dev is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package openjdk-6-jdk is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
  apt

E: Package 'openjdk-6-jdk' has no installation candidate

Nó cho tôi biết rằng openjdk-6-jdk là cần thiết nhưng nó không có trong repos. Tôi đã cài đặt openjdk-7-jdk theo cách thủ công, nhưng cài đặt nó không hoạt động.

Sau khi làm điều đó, tôi nhận xét (#) dòng trong đó cố gắng cài đặt openjdk-6-jdk. Bây giờ nó theo các gói cài đặt và đây là (các dòng cuối cùng) của đầu ra:

Reading package lists... Done
Building dependency tree
Reading state information... Done
ant is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Reading package lists... Done
Building dependency tree
Reading state information... Done
unzip is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
./dependencies/linux/install-dependencies-debian: line 58: cd: ../common: No such file or directory

Tôi đã nhập lại vào tệp install-dependencies-linuxvà đây là những dòng không thành công:

cd ../common
./install-common
cd ../linux

Nhưng tôi không biết những gì đang cố gắng cài đặt. Sau những dòng này, bắt đầu các dòng cài đặt Qt nhưng đó là phiên bản RStudio Desktop, không phải phiên bản Máy chủ của tôi.

EDIT 2:

Tôi phát hiện ra bằng cách sử dụng lệnh find / -name install-commoncó một thư mục chung trong thư mục phụ thuộc. Vì vậy, tôi cd'ed đến /dependencies/common/và tự thực hiện một./install-common

root@raspberrypi:/home/pi/rstudio/dependencies/common# ./install-common
--2015-11-21 19:26:41--  https://s3.amazonaws.com/rstudio-buildtools/gin-1.5.zip
Resolving s3.amazonaws.com (s3.amazonaws.com)... 54.231.98.155
Connecting to s3.amazonaws.com (s3.amazonaws.com)|54.231.98.155|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1055663 (1.0M) [application/zip]
Saving to: ‘gin-1.5.zip’

gin-1.5.zip         100%[=====================>]   1.01M   951KB/s   in 1.1s

2015-11-21 19:26:43 (951 KB/s) - ‘gin-1.5.zip’ saved [1055663/1055663]

--2015-11-21 19:26:44--  https://s3.amazonaws.com/rstudio-buildtools/gwt-2.7.0.zip
Resolving s3.amazonaws.com (s3.amazonaws.com)... 54.231.9.24
Connecting to s3.amazonaws.com (s3.amazonaws.com)|54.231.9.24|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 108818328 (104M) [application/zip]
Saving to: ‘gwt-2.7.0.zip’

gwt-2.7.0.zip       100%[=====================>] 103.78M  7.80MB/s   in 20s

2015-11-21 19:27:04 (5.27 MB/s) - ‘gwt-2.7.0.zip’ saved [108818328/108818328]

--2015-11-21 19:27:36--  https://s3.amazonaws.com/rstudio-buildtools/junit-4.9b3.jar
Resolving s3.amazonaws.com (s3.amazonaws.com)... 54.231.49.132
Connecting to s3.amazonaws.com (s3.amazonaws.com)|54.231.49.132|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 247280 (241K) [application/java-archive]
Saving to: ‘junit-4.9b3.jar’

junit-4.9b3.jar     100%[=====================>] 241.48K   246KB/s   in 1.0s

2015-11-21 19:27:38 (246 KB/s) - ‘junit-4.9b3.jar’ saved [247280/247280]

--2015-11-21 19:27:38--  https://s3.amazonaws.com/rstudio-buildtools/selenium-java-2.37.0.zip
Resolving s3.amazonaws.com (s3.amazonaws.com)... 54.231.112.67
Connecting to s3.amazonaws.com (s3.amazonaws.com)|54.231.112.67|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 24625928 (23M) [application/zip]
Saving to: ‘selenium-java-2.37.0.zip’

selenium-java-2.37. 100%[=====================>]  23.48M  2.28MB/s   in 16s

2015-11-21 19:27:55 (1.45 MB/s) - ‘selenium-java-2.37.0.zip’ saved [24625928/24625928]

--2015-11-21 19:28:00--  https://s3.amazonaws.com/rstudio-buildtools/selenium-server-standalone-2.37.0.jar
Resolving s3.amazonaws.com (s3.amazonaws.com)... 54.231.114.92
Connecting to s3.amazonaws.com (s3.amazonaws.com)|54.231.114.92|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 34730734 (33M) [application/x-java-archive]
Saving to: ‘selenium-server-standalone-2.37.0.jar’

selenium-server-sta 100%[=====================>]  33.12M  4.39MB/s   in 8.6s

2015-11-21 19:28:10 (3.84 MB/s) - ‘selenium-server-standalone-2.37.0.jar’ saved [34730734/34730734]

--2015-11-21 19:28:10--  https://s3.amazonaws.com/rstudio-buildtools/chromedriver-mac
Resolving s3.amazonaws.com (s3.amazonaws.com)... 54.231.96.144
Connecting to s3.amazonaws.com (s3.amazonaws.com)|54.231.96.144|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 22034760 (21M) [application/octet-stream]
Saving to: ‘chromedriver-mac’

chromedriver-mac    100%[=====================>]  21.01M  5.39MB/s   in 4.8s

2015-11-21 19:28:15 (4.34 MB/s) - ‘chromedriver-mac’ saved [22034760/22034760]

--2015-11-21 19:28:15--  https://s3.amazonaws.com/rstudio-buildtools/chromedriver-linux
Resolving s3.amazonaws.com (s3.amazonaws.com)... 54.231.97.227
Connecting to s3.amazonaws.com (s3.amazonaws.com)|54.231.97.227|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 19303552 (18M) [application/octet-stream]
Saving to: ‘chromedriver-linux’

chromedriver-linux  100%[=====================>]  18.41M  2.53MB/s   in 9.4s

2015-11-21 19:28:25 (1.95 MB/s) - ‘chromedriver-linux’ saved [19303552/19303552]

--2015-11-21 19:28:25--  https://s3.amazonaws.com/rstudio-buildtools/chromedriver-win.exe
Resolving s3.amazonaws.com (s3.amazonaws.com)... 54.231.13.152
Connecting to s3.amazonaws.com (s3.amazonaws.com)|54.231.13.152|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 6731776 (6.4M) [application/octet-stream]
Saving to: ‘chromedriver-win.exe’

chromedriver-win.ex 100%[=====================>]   6.42M  2.52MB/s   in 2.6s

2015-11-21 19:28:29 (2.52 MB/s) - ‘chromedriver-win.exe’ saved [6731776/6731776]

--2015-11-21 19:28:29--  https://s3.amazonaws.com/rstudio-dictionaries/core-dictionaries.zip
Resolving s3.amazonaws.com (s3.amazonaws.com)... 54.231.10.192
Connecting to s3.amazonaws.com (s3.amazonaws.com)|54.231.10.192|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 876339 (856K) [application/zip]
Saving to: ‘core-dictionaries.zip’

core-dictionaries.z 100%[=====================>] 855.80K  1.00MB/s   in 0.8s

2015-11-21 19:28:31 (1.00 MB/s) - ‘core-dictionaries.zip’ saved [876339/876339]

--2015-11-21 19:28:31--  https://s3.amazonaws.com/rstudio-buildtools/mathjax-23.zip
Resolving s3.amazonaws.com (s3.amazonaws.com)... 54.231.1.152
Connecting to s3.amazonaws.com (s3.amazonaws.com)|54.231.1.152|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1674748 (1.6M) [application/zip]
Saving to: ‘mathjax-23.zip’

mathjax-23.zip      100%[=====================>]   1.60M   578KB/s   in 2.8s

2015-11-21 19:28:35 (578 KB/s) - ‘mathjax-23.zip’ saved [1674748/1674748]

1.50.0 already installed in /opt/rstudio-tools/boost/boost_1_50_0
--2015-11-21 19:28:35--  https://s3.amazonaws.com/rstudio-buildtools/pandoc-1.13.1.zip
Resolving s3.amazonaws.com (s3.amazonaws.com)... 54.231.64.184
Connecting to s3.amazonaws.com (s3.amazonaws.com)|54.231.64.184|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 115697042 (110M) [application/zip]
Saving to: ‘pandoc-1.13.1.zip’

pandoc-1.13.1.zip   100%[=====================>] 110.34M  1.99MB/s   in 44s

2015-11-21 19:29:20 (2.52 MB/s) - ‘pandoc-1.13.1.zip’ saved [115697042/115697042]

cp: cannot stat ‘pandoc-1.13.1/linux/debian/armv7l/pandoc*’: No such file or directory

Và bây giờ khi tôi thực hiện lại một cmake thì đây là đầu ra:

root@raspberrypi:/home/pi/rstudio/build# cmake .. -DRSTUDIO_TARGET=Server -DCMAKE_BUILD_TYPE=Release
-- Boost version: 1.50.0
-- Found R: /usr/lib/R
CMake Error at src/cpp/session/CMakeLists.txt:32 (message):
  rsconnect package not found (re-run install-dependencies script to install)


-- Configuring incomplete, errors occurred!
See also "/home/pi/rstudio/build/CMakeFiles/CMakeOutput.log".
See also "/home/pi/rstudio/build/CMakeFiles/CMakeError.log".

Ít nhất bây giờ nó ném một lỗi trong một dòng khác!

EDIT 3:

Tôi đã cài đặt thủ công các phụ thuộc bên trong install-commonvà bây giờ lệnh cmake hoạt động! Yay!

Bây giờ tôi đã thực hiện một make installnhưng nó bị kẹt ở đây:

Buildfile: /home/pi/rstudio/src/gwt/build.xml

ext:

1
Câu hỏi cũ (đã chết) ở đây ... Bạn đã nhận được kết quả gì từ cài đặt phụ thuộc (vậy apt-get ..../dependencies/linux/install-dependencies-debian)?
Wilf

@Wilf Cảm ơn bạn rất nhiều vì bình luận của bạn. Tôi đã chỉnh sửa câu hỏi,
Sergio Fernández

@Wilf Và xin lỗi, đầu ra từ apt-get ...tất cả đều ổn. git is already the newest version. r-recommended is already the newest version.
Sergio Fernández

1
Chỉ là một điểm phân loại - đối với bản ghi bạn có Raspberry Pi Model B + hoặc Raspberry Pi 2 Model B - thứ hai có thêm ba lõi xử lý (và gấp đôi bộ nhớ IIRC) ...
SlySven

Xin lỗi, tôi đã viết Raspberry Pi 2 Model B + ở đầu bài này. Ý tôi là Raspberry Pi 2 Model B. Bây giờ thì đúng rồi, cảm ơn bạn.
Sergio Fernández

Câu trả lời:


6

Sử dụng một số mẹo từ luồng này (cảm ơn bạn!), Một luồng Stack Overflow khác, cài đặt ARM khác (trên Chromebook) và rất nhiều thử nghiệm và lỗi, tôi đã có thể tải RStudio Server v0.99.491 lên và chạy trên Pi 2.

Sergio, điều tôi nghĩ bạn đang thiếu là:

  1. Cài đặt thủ công pandoc.

    sudo apt-get install -y pandoc
    
  2. Một trình biên dịch GWT mới. Quá trình dưới đây sẽ thay đổi tùy thuộc vào cách bạn thiết lập thư mục của mình. Về cơ bản, tải xuống trình biên dịch mới nhất, giải nén nó và di chuyển nó vào thư mục "trình biên dịch".

    cd ~/downloads
    wget http://dl.google.com/closure-compiler/compiler-latest.zip
    unzip compiler-latest.zip
    rm COPYING README.md compiler-latest.zip
    sudo mv compiler.jar /home/pi/downloads/rstudio/src/gwt/tools/compiler/compiler.jar
    
  3. Có khả năng, không gian SWAP. Tôi đã có kết quả hỗn hợp khiến nó được biên dịch có và không có SWAP. Những gì tôi biết là, tôi đã sử dụng SWAP để cài đặt hoạt động như hiện tại.

Đối với bất kỳ ai khác có thể đã có một thời gian khó khăn theo quy trình trên, tôi đã làm hết sức mình để biên dịch nó. LƯU Ý: sẽ mất GIỜ đến ./install-commonmake install. Tôi nghĩ rằng phải mất gần 4,5 giờ để xây dựng make install.

sudo su
apt-get update
apt-get upgrade -y
apt-get install -y git r-recommended
cd /home/pi/downloads/
git clone https://github.com/rstudio/rstudio.git
cd /home/pi/downloads/rstudio/dependencies/common/
./install-common
cd /home/pi/downloads/rstudio/dependencies/linux/
./install-dependencies-debian

#saw java 6 was not installed. installed v7
apt-get install -y openjdk-7-jdk

#tried to make install, got an error about dictionaries not installed and rerun install-dependencies
cd /home/pi/downloads/rstudio/dependencies/common/
./install-common

#tried to make install, hangs at "ext:" so I tried manually installing pandoc, which should have been installed earlier, but apparently was not
apt-get install -y pandoc

#tried to make install, hangs at "ext:" so I tried installing the latest GWT compiler
cd ~/downloads
wget http://dl.google.com/closure-compiler/compiler-latest.zip
unzip compiler-latest.zip
rm COPYING README.md compiler-latest.zip
mv compiler.jar /home/pi/downloads/rstudio/src/gwt/tools/compiler/compiler.jar

#build and install works!
cd /home/pi/downloads/rstudio/
#remove build if exists
rm -r ./build
mkdir build
cmake -DRSTUDIO_TARGET=Server -DCMAKE_BUILD_TYPE=Release
make install

Tôi nên nói thêm rằng có một vài bước nữa để khởi động máy chủ, nhưng đây là nơi tôi tưởng tượng hầu hết mọi người bị mắc kẹt. Dưới đây là các bước tiếp theo được thực hiện từ bản dựng ARM của Jrowen trên Chromebook :

# Additional install steps
sudo useradd -r rstudio-server
sudo cp /usr/local/lib/rstudio-server/extras/init.d/debian/rstudio-server /etc/init.d/rstudio-server
sudo chmod +x /etc/init.d/rstudio-server 
sudo ln -f -s /usr/local/lib/rstudio-server/bin/rstudio-server /usr/sbin/rstudio-server
sudo chmod 777 -R /usr/local/lib/R/site-library/

# Setup locale
sudo apt-get install -y locales
sudo DEBIAN_FRONTEND=noninteractive dpkg-reconfigure locales
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8
#echo 'export LANG=en_US.UTF-8' >> ~/.bashrc
#echo 'export LANGUAGE=en_US.UTF-8' >> ~/.bashrc

# Clean the system of packages used for building
sudo apt-get autoremove -y cabal-install ghc openjdk-7-jdk pandoc libboost-all-dev
sudo rm -r -f ~/rstudio-$VERS
sudo apt-get autoremove -y

# Start the server
sudo rstudio-server start

# Go to localhost:8787

Chào mừng bạn đến góc hương vị Raspberry Pi của cộng đồng Stack Exchange. Đây có vẻ như là một câu trả lời bằng văn bản cho tôi!
SlySven

1

3 năm sau, dựa trên câu trả lời của dhewlett, tôi đã có thể xây dựng RStudio 1.1.463 trên Raspbian Stretch. Tôi đã đặt tất cả vào bản dựng docker để dễ tái tạo hơn. Nó đến trong một số phần.

Đầu tiên tạo môi trường xây dựng cho RStudio. Dockerfile.build_env trông như thế này:

FROM balenalib/raspberrypi3-debian:stretch-build as build_env

ARG VERSION_MAJOR=1
ARG VERSION_MINOR=1
ARG VERSION_PATCH=463
ARG PACKAGE_RELEASE=1
ARG VERSION_TAG=${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}

RUN apt-get update && apt-get upgrade -y && apt-get install -y \
      galternatives \
      git \
      openjdk-8-jdk \
      pandoc \
      pandoc-citeproc \
      python-dev \
      r-recommended

RUN mkdir -p /home/pi/Downloads
WORKDIR /home/pi/Downloads

# Get the RStudio sources. We only download the version of the code we need,
# instead of HEAD. HEAD has dependencies that RaspberryPi3 Debian (v9 Stretch)
# currently doesn't satisfy, e.g. QT >= 5.10.
RUN set -x \
    && wget https://github.com/rstudio/rstudio/archive/v${VERSION_TAG}.tar.gz -O rstudio.tgz \
    && tar xzf rstudio.tgz \
    && rm rstudio.tgz \
    && ln -s rstudio-${VERSION_TAG} rstudio

WORKDIR /home/pi/Downloads/rstudio/dependencies/linux
# We're going to use the system version of the boost library (version
# 1.62.0) instead of installing and building the RStudio version of boost
# (version 1.63.0) which takes several hours of build time.
RUN perl -i -pe 's/(^.*install-boost$)/# \1/s' ../common/install-common
RUN apt-get install libboost-all-dev
# Script installs qt-sdk only for x86 but we need armhf, so skip qt install.
RUN ./install-dependencies-debian --exclude-qt-sdk
# Extra dependencies to build rstudio-desktop: use the system QT libraries instead.
RUN apt-get install -y \
      libqt5opengl5-dev \
      libqt5sensors5-dev \
      libqt5svg5-dev \
      libqt5webkit5-dev \
      libqt5xmlpatterns5-dev \
      qt5-default \
      qt5-style-plugins \
      qtpositioning5-dev \
      qtwebengine5-dev

WORKDIR /home/pi/Downloads/rstudio
# Package building wants to grab QT library files to bundle them with the
# RStudio desktop .deb package. But bundling of system QT doesn't work due
# to path differences and is unnecessary anyway.
RUN sed -i -e 's#\(set(RSTUDIO_BUNDLE_QT\) TRUE#\1 FALSE#' src/cpp/desktop/CMakeLists.txt
# Add the package dependencies to system QT libraries.
RUN sed -i -e 's#\(^.*set(RSTUDIO_DEBIAN_DEPENDS "${RSTUDIO_DEBIAN_DEPENDS}libgstreamer0.10.*$\)#\1\nset(RSTUDIO_DEBIAN_DEPENDS "${RSTUDIO_DEBIAN_DEPENDS}libqt5webchannel5, libqt5webkit5, libqt5positioning5, libqt5sensors5, libqt5svg5, libqt5xml5, libqt5xmlpatterns5, ")#' package/linux/CMakeLists.txt
# Add our own package release (aka. Debian revision number) to the .deb file.
RUN sed -i -e 's#\(^.*\)-\(${PACKAGE_ARCHITECTURE}\)#set(CPACK_DEBIAN_PACKAGE_RELEASE "'${PACKAGE_RELEASE}'")\n\1-${CPACK_DEBIAN_PACKAGE_RELEASE}_\2#' package/linux/CMakeLists.txt

# Constrain gwtc compiler to use a single worker - gwtc is a memory hog and
# running multiple workers is getting too tight with 1 GB RAM + 1 GB swap.
RUN perl -0777 -i -pe 's#(<arg value="-localWorkers"/>\s+<arg value=)"\d+"(/>)#\1"1"\2#s' src/gwt/build.xml

# Change "cmake_policy(SET CMP0020 OLD)" to "cmake_policy(SET CMP0043 OLD)"
# to avoid a build time complaint.
RUN sed -i -e s/CMP0020/CMP0043/g src/cpp/desktop/CMakeLists.txt

# We build in a separate directory.
RUN mkdir build

Và xây dựng hình ảnh đó với:

docker build -t raspberrypi-rstudio-build-env -f Dockerfile.build_env .

Sau đó, xây dựng gói Debian RStudio Server với Dockerfile.server_deb:

# The compilation, especially gwtc (java), needs a lot of memory so you need
# to add more swap on your RP3 in order for the compile to succeed:
#   * In /etc/dphys-swapfile set CONF_SWAPSIZE=1024 (default is 100)
#   * Then run sudo service dphys-swapfile restart
#   * Once the build is done and you're happy with the result you can set
#     the swap space back to the default 100 MB with:
#     * In /etc/dphys-swapfile set CONF_SWAPSIZE=100
#     * sudo service dphys-swapfile restart

FROM raspberrypi-rstudio-build-env as build_env

ARG VERSION_MAJOR=1
ARG VERSION_MINOR=1
ARG VERSION_PATCH=463
ARG PACKAGE_RELEASE=1
ARG VERSION_TAG=${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}
ARG BUILD_TAG=${VERSION_TAG}-${PACKAGE_RELEASE}

# Build only with parallelism 2 - gwtc is a memory hog. If you still run out
# of memory override this to 1.
ARG BUILD_PARALLELISM=2

WORKDIR /home/pi/Downloads/rstudio/build

RUN set -x \
    && cmake .. \
      -DRSTUDIO_TARGET=Server \
      -DCMAKE_BUILD_TYPE=Release \
      -DRSTUDIO_PACKAGE_BUILD=1 \
      -DRSTUDIO_BOOST_VERSION=1.62.0 \
      -DRSTUDIO_USE_SYSTEM_BOOST=1 \
    && make preinstall -j${BUILD_PARALLELISM}
# Create the deb package. Unfortunately cpack wants to rerun the whole build,
# so we'll work around that by giving it an empty build rule.
# (There really should be a better way to avoid the rebuild.)
RUN set -x \
    && mv Makefile Makefile.orig \
    && echo 'preinstall:' > Makefile \
    && cpack -G DEB \
    && mv Makefile.orig Makefile
# The product of this build is: rstudio-server-${BUILD_TAG}_armhf.deb

# Extract only the finished Debian package and leave it in an empty docker
# image to reduce image size. If you want to capture the package in its
# build environment, build it only to stage --target=build_env
FROM scratch as package

# ARGs need to be redefined in every build stage to be accessible.
ARG VERSION_MAJOR=1
ARG VERSION_MINOR=1
ARG VERSION_PATCH=463
ARG PACKAGE_RELEASE=1
ARG VERSION_TAG=${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}
ARG BUILD_TAG=${VERSION_TAG}-${PACKAGE_RELEASE}

COPY --from=build_env /home/pi/Downloads/rstudio/build/rstudio-server-${BUILD_TAG}_armhf.deb /

Xây dựng hình ảnh đó và giải nén gói RStudio Server Debian:

docker build -t raspberrypi-rstudio-server-deb -f Dockerfile.server_deb .
docker image save raspberrypi-rstudio-server-deb | tar xO --wildcards '*/layer.tar' | tar x

Tương tự như vậy đối với Gói Debian RStudio Desktop, bạn sẽ sử dụng Dockerfile.desktop_deb:

FROM raspberrypi-rstudio-build-env as build_env

ARG VERSION_MAJOR=1
ARG VERSION_MINOR=1
ARG VERSION_PATCH=463
ARG PACKAGE_RELEASE=1
ARG VERSION_TAG=${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}
ARG BUILD_TAG=${VERSION_TAG}-${PACKAGE_RELEASE}

# Build only with parallelism 2 - gwtc is a memory hog. If you still run out
# of memory override this to 1.
ARG BUILD_PARALLELISM=2

WORKDIR /home/pi/Downloads/rstudio/build

RUN set -x \
    && cmake .. \
      -DRSTUDIO_TARGET=Desktop \
      -DCMAKE_BUILD_TYPE=Release \
      -DRSTUDIO_PACKAGE_BUILD=1 \
      -DRSTUDIO_BOOST_VERSION=1.62.0 \
      -DRSTUDIO_USE_SYSTEM_BOOST=1 \
      -DQT_QMAKE_EXECUTABLE=/usr/lib/arm-linux-gnueabihf/qt5/bin/qmake \
    && make preinstall -j${BUILD_PARALLELISM}
# Create the deb package. Unfortunately cpack wants to rerun the whole build,
# so we'll work around that by giving it an empty build rule.
# (There really should be a better way to avoid the rebuild.)
RUN set -x \
    && mv Makefile Makefile.orig \
    && echo 'preinstall:' > Makefile \
    && cpack -G DEB \
    && mv Makefile.orig Makefile
# The product of this build is: rstudio--${BUILD_TAG}_armhf.deb

# Comment out next line for native build.
RUN [ "cross-build-end" ]

# Extract only the finished Debian package and leave it in an empty docker
# image to reduce image size. If you want to capture the package in its
# build environment, build it only to stage --target=build_env
FROM scratch as package

# ARGs need to be redefined in every build stage to be accessible.
ARG VERSION_MAJOR=1
ARG VERSION_MINOR=1
ARG VERSION_PATCH=463
ARG PACKAGE_RELEASE=1
ARG VERSION_TAG=${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}
ARG BUILD_TAG=${VERSION_TAG}-${PACKAGE_RELEASE}

COPY --from=build_env /home/pi/Downloads/rstudio/build/rstudio--${BUILD_TAG}_armhf.deb /

Xây dựng hình ảnh đó và giải nén gói RStudio Desktop Debian:

docker build -t raspberrypi-rstudio-desktop-deb -f Dockerfile.desktop_deb .
docker image save raspberrypi-rstudio-desktop-deb | tar xO --wildcards '*/layer.tar' | tar x

Cuối cùng, cài đặt các gói .deb với apt cũng kéo theo các gói phụ thuộc. Hãy chắc chắn để cập nhật danh sách gói đầu tiên mặc dù:

sudo apt-get update
sudo apt install ./rstudio-server-1.1.463-1_armhf.deb
sudo apt install ./rstudio--1.1.463-1_armhf.deb
Khi sử dụng trang web của chúng tôi, bạn xác nhận rằng bạn đã đọc và hiểu Chính sách cookieChính sách bảo mật của chúng tôi.
Licensed under cc by-sa 3.0 with attribution required.