dashaub / ARM-RStudio

Compile RStudio for ARM Ubuntu 14.04 on Samsung Chromebook
GNU General Public License v2.0
53 stars 17 forks source link

Fail at linking and old version of r-base-core #6

Closed TymekDev closed 4 years ago

TymekDev commented 6 years ago

Hey, I am completly new to Ubuntu staff and just gotten my chromebook (Acer R13) little more than a week ago and setup crouton on it. I have stumbled upon two problems while running ARM-RStudio.sh script.

First being a wrong r-base-core version. When I try to install r-base it throws an error saying r-base-core version is too old - should be ">=3.4.4-1xenial0" and only 3.2.3-4 is installed. I cound't find newer version for arm, in fact I have only found amd packages in the repositories.

I wanted to see what happend if I skipped the installation step of R packages and ran the script after excluding line responsible for it. It resulted in following error:

[ 39%] Generating ui_DesktopInputDialog.h
/home/butcherq/Qt5.4.2/5.4/gcc_64/bin/uic: 1: /home/butcherq/Qt5.4.2/5.4/gcc_64/bin/uic: Syntax error: ")" unexpected
src/cpp/desktop/CMakeFiles/rstudio.dir/build.make:204: recipe for target 'src/cpp/desktop/ui_DesktopInputDia log.h' failed
make[2]: *** [src/cpp/desktop/ui_DesktopInputDialog.h] Error 2
CMakeFiles/Makefile2:550: recipe for target 'src/cpp/desktop/CMakeFiles/rstudio.dir/all' failed
make[1]: *** [src/cpp/desktop/CMakeFiles/rstudio.dir/all] Error 2
Makefile:149: recipe for target 'all' failed
make: *** [all] Error 2

****  Installation failed. Aborting package creation.

Mind that I might have messed up something involuntarily whilst trying to set this up. Any help will be appreciated.

dashaub commented 6 years ago

I built this script to work on Ubuntu 14.04, and unfortunately a lot has changed in RStudio releases since then that break this on newer versions. I plan on picking this up again to get it working on Ubuntu 18.04 once it is released in a few weeks. Since I don't use Ubuntu 16.04, there isn't much way for me to test it anyway, and I plan to only support Ubuntu 18.04 going forward. Sorry this won't help for now.

TymekDev commented 6 years ago

Thanks for reply. I have since tried installing RStudio from https://github.com/rstudio/rstudio/ and I have encountered the exact same issue. Given that, the problem probably is on my part, however I have no clue how to fix it.

CL-Jeremy commented 6 years ago

@butcherq Regarding the linking problem of RStudio, it would become obvious if you actually try to click in that Qt5.4.2 folder in your home directory and try to launch any executable from …/bin/, since it is a static x86-64 (a.k.a. amd64) build of the Qt SDK provided by RStudio, Inc. Since the official building workflow only supports x86 architectures, only x86 and amd64 versions of these giant self-containing SDKs - not even Qt hosts these for ARM architectures, which subdivides into v6 (armel), v7 (armhf) and v8 (arm64) - are actually known by the dependency installer. Since your Chromebook has ARMv8 cores (Cortex-A72/A53), the 64-bit version gets downloaded and all seems well from the perspective of the build script (using a 64-bit g++), up to the point when ld begins to link into the Qt SDK, which turns out to be an amd64 build - too bad it does not complain earlier.

My own solution to this was to compile the entire Qt SDK from the source code taken from the official Qt archive (as I am still on 14.04 and the repository only has Qt 5.2.1), install that to the local prefix, proceed with the building process and wait till the installation ends. Funnily enough, the links were then stripped out from the final binaries and the SDK was rendered useless, but what prevents us from relinking with patchelf. In fact I had to use it anyway in my case, since I built Qt as shared libraries against tons of system libraries (not quite the way to go in quirky environments, but gives some flexibility), the bunch of .so's have been assigned the chosen local prefix as RUNPATH, which must be set to $ORIGIN when shipped bundled. I put these symlinks, along with the actual .so.5.4.2 files (static version would be .a if applicable), into a …/lib/ (actually for cosmetic reasons - you may choose …/lib64/ to follow this convention or leave them in …/bin/):

libQt5DBus.so.5
libQt5Gui.so.5
libQt5Network.so.5
libQt5OpenGL.so.5
libQt5Positioning.so.5
libQt5PrintSupport.so.5
libQt5Qml.so.5
libQt5Quick.so.5
libQt5Sensors.so.5
libQt5Sql.so.5
libQt5WebChannel.so.5
libQt5WebKit.so.5
libQt5WebKitWidgets.so.5
libQt5Widgets.so.5

and fetched the rstudio-<version>/build/src/cpp/desktop/rstudio binary (before its RUNPATH got stripped) changed it to $ORIGIN/../lib/, and replace the installed binary. All other files remain intact. Obviously these could be simplified and automated with scripts, but I am no CMake guru to handle that.

Voilà! I got my RStudio working after much hassle. You could dpkg-repack the installed version into a final .deb file for distribution, though I prefer making it by hand due to little disk space. I have attached my package to serve as a reference (Cortex-A15, hard float with NEON-VFPv4 on an NVIDIA SHIELD Tablet). You may dpkg -x it and take a look inside. It is supposed to install and run well on a normal armhf Ubuntu 14.04 distribution (after adding these PPA's ppa:libreoffice/ppa, ppa:ondrej/php).

Regarding r-base, I am using the ancient stock version for now and it works fine for me. Whichever version it has should not affect building RStudio (I used the ARM-RStudio.sh script from the master branch and I suppose you have got the same version).

bildschirmfoto vom 2018-06-10 19 02 28

dashaub commented 6 years ago

@CL-Jeremy That's very useful information. If you already have the code in a script, I'd be glad to accept a PR.

dashaub commented 4 years ago

@tmakowski @CL-Jeremy

Should be working now. Please reopen the issue if not.