jheinen / GR.jl

Plotting for Julia based on GR, a framework for visualisation applications
Other
356 stars 76 forks source link

Linux aarch64 release missing #271

Open Babber opened 4 years ago

Babber commented 4 years ago

Dear Josef, dear All, I could make Julia install on Ubuntu in Termux (https://github.com/MFDGaming/ubuntu-in-termux) on my Android device. I could even install Jupyter and IJulia, and so far everything seem to work, although I have only tried a few packages yet. However, I cannot install GR:

(v1.2) pkg> build GR
  Building GR → `~/.julia/packages/GR/f1Iqi/deps/build.log`
┌ Error: Error building `GR`:
│ --2019-11-09 10:35:00--  https://github.com/sciapp/gr/releases/download/v0.42.0/gr-0.42.0-Linux-aarch64.tar.gz
│ Resolving github.com (github.com)... 140.82.118.4
│ Connecting to github.com (github.com)|140.82.118.4|:443... connected.
│ HTTP request sent, awaiting response... 404 Not Found
│ 2019-11-09 10:35:01 ERROR 404: Not Found.

I have noticed that the issue #261 is related to mine, and I also tried to ] add GR#master, but I got this error message:

ERROR: failed to fetch from https://github.com/jheinen/GR.jl.git, error: GitError(Code:EINVALIDSPEC, Class:Reference, the given reference name 'refs/heads/.l2s.master.lock0001' is not valid)

I was trying to compile GR myself following the instructions at https://gr-framework.org/building.html, but after installing a large number of dependencies, I keep bumping into error messages. The most recent one says that libtool: link: 'cairo-path-fill.lo' is not a valid libtool object. So in the end, my question is if you plan to release an aarch64 version of GR as well? Or in case it is already there in master, what can I do with that GitError? At the moment, I only have UnicodePlot in REPL, so it would be much appreciated to have GR. Thank you for your help in advance.

danielkaiser commented 4 years ago

Hi, we do not provide a binary distribution of the GR runtime for aarch64. Therefore you will need to compile the GR runtime yourself to use GR on aarch64.

I tried this on a small Ubuntu image and managed to compile and install GR using the CMake build. The dependencies I had to install so that GR could be compiled were

apt install gcc build-essential cmake libpng-dev libjpeg-dev curl libqhull-dev

This resulted in a minimal set of supported output formats. As you are planning to use it on a terminal emulator you probably also need support for writing common image formats (png, jpg, bmp). Therefore I additionally had to install cairo using

apt install libcairo-dev

With these packages installed on your system you should be able to run the following commands in the GR folder to build it using CMake:

mkdir build
cd build
cmake ..
make
make install

This should build GR and install it to /usr/local/gr. After running cmake .. you should get an overview of which output formats will be available.

I hope this helps installing GR on your system.

Babber commented 4 years ago

Hi, thank you for your help, @danielkaiser. I followed the steps you suggested, but the execution of cmake .. ended with this error:

CMake Error at /usr/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
  Could NOT find Jpeg (missing: JPEG_LIBRARY JPEG_INCLUDE_DIR
  JPEG_VERSION_STRING)
Call Stack (most recent call first):
  /usr/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
  cmake/FindJpeg.cmake:56 (find_package_handle_standard_args)
  CMakeLists.txt:42 (find_package)

-- Configuring incomplete, errors occurred!
See also "/home/gr/build/CMakeFiles/CMakeOutput.log".
root@localhost:/home/gr/build# make
make: *** No targets specified and no makefile found.  Stop.

As you see, I tried to run make anyway, but unsuccessfully. After this, I tried to run make in the parent \home\gr directory also without success:

make[3]: Leaving directory '/home/gr/3rdparty'
cc -o demo -I../gks -I/home/gr/3rdparty/build/include -DNO_GS -O3 -Wall -fPIC  demo.c libGR.a \
/home/gr/3rdparty/build/lib/libpng.a ../gks/libGKS.a /home/gr/3rdparty/build/lib/libfreetype.a /home/gr/3rdparty/build/lib/libjpeg.a \
/home/gr/3rdparty/build/lib/libz.a /home/gr/3rdparty/build/lib/libqhull.a -lpthread -ldl -lc -lm  -Wl,-rpath,'$ORIGIN/.'
/bin/ld: libGR.a(gr.o): in function `latex2image':
gr.c:(.text+0x143c): warning: the use of `tempnam' is dangerous, better use `mkstemp'
/bin/ld: /home/gr/3rdparty/build/lib/libpng.a(pngrutil.o): in function `png_read_filter_row':
pngrutil.c:(.text+0x4820): undefined reference to `png_init_filter_functions_neon'
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:77: demo] Error 1
make[2]: Leaving directory '/home/gr/lib/gr'
make[1]: *** [Makefile:55: default] Error 2
make[1]: Leaving directory '/home/gr/lib/gr'
make: *** [Makefile:17: all] Error 2

I don't know how many others might share a similar problem here, but if this is a fringe issue, I don't want to keep on the pressure to solve this. It would be really nice if it worked, but it is not critical. With very little effort I could install Julia on this system and then I had no idea that adding GR to it could lead to this many problems. I really cannot tell if solution is just around the corner or it would need extreme amount of further hacking. So I leave it up to you when to give up on this, but of course as long as you give me further instructions, I'll be happy to try them and report on what have happened.

FlorianRhiem commented 4 years ago

Hey, it's strange that CMake doesn't find libjpeg. Could you please check that the following files exist on your system?

These are the files that I'd expect CMake to find to define JPEG_INCLUDE_DIR and JPEG_LIBRARY and they should've been installed as part of libjpeg-dev.

As a side note: the Makefile in the project root and the CMake build are unrelated. The Makefile is a bit specialized (it expects to use a bundled libjpeg, among other things), while the CMake build should work on a system like yours as long as the required libraries are found.

Babber commented 4 years ago

Hi, I have checked, and these files were not there. So I installed libjpeg-dev, then jpeglib.h appeared, but not the other one. Anyway, after this, I could complete the installation, and now it works: I can finally plot with GR in Jupyter! Many thanks for your help!

Babber commented 4 years ago

Btw, it has just occurred to me that indeed, I have missed out installing libjpeg-dev in the first round. I was reading the instructions on one device and typing them in on the other like a caveman. Sorry for this! :)

IanButterworth commented 4 years ago

Given that loading and running Plots has become the go-to test for TTFP & compiler optimization, and Plots.jl is dependent on GR.jl, it would be great to provide proper aarch64 support especially because aarch64 is known to be slow to compile & load code so needs iterative testing

microe commented 4 years ago

I have a Pinebook Pro and was able to build the AUR gr-framework package for aarch64. What does it take to build the GR.jl version? Is there some way to point julia Pkg at a custom/local build of GR.jl?

jheinen commented 4 years ago

If the AUR gr-framework package for aarch64 is installed in /usr/gr, you can ] add GR and the GR build scripts will use it.

microe commented 4 years ago

Ah ha! That worked like a charm. I submitted my branch to the AUR package. Thanks so much for the help!