Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New core plan for R #571

Merged
merged 6 commits into from Jun 23, 2017
Merged

New core plan for R #571

merged 6 commits into from Jun 23, 2017

Conversation

baggerspion
Copy link
Contributor

Signed-off-by: Paul Adams paul@baggerspion.net

@thesentinels
Copy link
Contributor

Thanks for the pull request! Here is what will happen next:

  1. Your PR will be reviewed by the maintainers
  2. If everything looks good, one of them will approve it, and your PR will be merged.

Thank you for contributing!

@stevendanna
Copy link
Contributor

👍 This looks like a good start to me. It would be nice if we could get some of the graphical output devices enabled:

  Interfaces supported:
  External libraries:        readline, curl
  Additional capabilities:   NLS
  Options enabled:           shared BLAS, R profiling

  Capabilities skipped:      PNG, JPEG, TIFF, cairo, ICU
  Options not enabled:       memory profiling

  Recommended packages:      yes

Because of dependency shenanigans I've had trouble getting some of those enabled without at least getting some parts of xorg packaged, which is started over in the xorg org.

I don't think we need those immediately, just wanted to mention it as I'm happy to help get those enabled over time.

@baggerspion
Copy link
Contributor Author

Thanks for the heads-up!

I can enable PNG, JPEG, TIFF and ICU with no problem. Will need to work with others to get core/cairo shipped.

@baggerspion
Copy link
Contributor Author

I'm going to leave this PR open to keep conversation going (other people are interested in this core/R). But if we want image export, I, at least, additionally need to work on:

  • core/cairo
  • core/Xlibs

This is currently a do-not-merge PR.

@robbkidd
Copy link
Contributor

@therealpadams,
you're my hero.

@baggerspion
Copy link
Contributor Author

baggerspion commented May 26, 2017

Status update:
When compiling R, during the .configure step, pkg-config cannot find cairo (despite being correctly present in PKG_PATH). There is some anecdotal evidence that this happens when pango is not present.

So now I am working on:

  • core/cairo
  • core/pango
  • core/harfbuzz
  • core/R

Thanks to @eeyun and @stevendanna for their help in the hack day yesterday. This PR is staying open for further comment.

@stevendanna
Copy link
Contributor

I was able to get cairo recognized with a small fix to pixman (in another PR) and by explicitly adding some transitive dependencies to the R pkg_deps array.

@stevendanna
Copy link
Contributor

PR for pixman: #577

@baggerspion
Copy link
Contributor Author

@stevendanna That's great news. Do you have a branch somewhere that I can merge into this PR so I can grab your R plan.sh?

@baggerspion
Copy link
Contributor Author

baggerspion commented May 28, 2017

** Status update **
Builds:

  • core/pango
  • core/harfbuzz
  • core/cairo

WIP:

  • core/R

In terms of builds, I'm pretty close to wrapping this up now. Once everything is building nicely, there will need to be some work to cleanup the plans. Note: this PR assumes that #577 is merged.

@baggerspion
Copy link
Contributor Author

@stevendanna when you have a moment, I'd hugely appreciate a review of this PR. I cannot work out why I am not getting R to build with all the graphical device support. I assume that once cairo works, jpeg, png etc will all enable, too.
Cannot work out why cairo is not being enabled, though.

@stevendanna
Copy link
Contributor

@therealpadams Thanks for pushing this forward. I'll pull down your recent changes and see what I can find.

@stevendanna
Copy link
Contributor

stevendanna commented May 30, 2017

OK. I've made some progress, but don't get too excited, lots of caveats below:

> capabilities()
       jpeg         png        tiff       tcltk         X11        aqua
       TRUE        TRUE        TRUE       FALSE       FALSE       FALSE
   http/ftp     sockets      libxml        fifo      cledit       iconv
       TRUE        TRUE        TRUE        TRUE        TRUE        TRUE
        NLS     profmem       cairo         ICU long.double     libcurl
       TRUE        TRUE        TRUE        TRUE        TRUE        TRUE
> png("foo.png", type="cairo")
> plot(c(1,2,3,4,5))
> dev.off()
null device
          1
>
Save workspace image? [y/n/c]: n
[157][default:/src:0]# file foo.png
foo.png: PNG image data, 480 x 480, 8-bit colormap, non-interlaced

This is available on my branch which I forked off of yours: baggerspion/core-plans@core/R...stevendanna:core/R-ssd

Here is a brief summary of where I've gotten:

  1. A lot of things were in pkg_build_deps that needed to be in pkg_deps. I've sorted most of them out, but we'll want to do another pass once everything is working.

  2. I've added some "transitive" deps directly to pkg_deps so that they are correctly added to PKG_CONFIG_PATH. This is how I got the configure script recognizing pango and cairo. A good trick for figuring out why pkg-config isn't finding something is to have it tell you by exporting the same PKG_CONFIG_PATH that the build is using and then running pkg-config directly with the --print-errors flag:

    [52][default:/src:0]# /hab/pkgs/core/pkg-config/0.29/20170513212944/bin/pkg-config cairo --print-errors
    Package fontconfig was not found in the pkg-config search path.
    Perhaps you should add the directory containing `fontconfig.pc'
    to the PKG_CONFIG_PATH environment variable
    Package 'fontconfig', required by 'cairo', not found
    
  3. The configure script that R ships, expect that cairo-xlib is there no matter how cairo has been compiled. Here are the two tests programs it might execute:

    Pango and Cairo:

    #include <pango/pango.h>
    #include <pango/pangocairo.h>
    #include <cairo-xlib.h>
    #if CAIRO_VERSION  < 10200
    #error cairo version >= 1.2 required
    #endif
    int main(void) {
        cairo_t  *CC = NULL; // silence picky compilers
        cairo_arc(CC, 0.0, 0.0, 1.0, 0.0, 6.28);
        pango_cairo_create_layout(CC);
        pango_font_description_new();
        return 0;
     }
    

    Cairo-only:

    #include <cairo.h>
    #include <cairo-xlib.h>
    #if CAIRO_VERSION  < 10200
    #error cairo version >= 1.2 required
    #endif
    int main(void) {
        cairo_t  *CC;
        cairo_arc(CC, 0.0, 0.0, 1.0, 0.0, 6.28);
        cairo_select_font_face (CC, "Helvetica", CAIRO_FONT_SLANT_NORMAL,
                                 CAIRO_FONT_WEIGHT_BOLD);
        return 0;
     }
    

    To get around this I removed pango so I just had to deal with one of the tests and then ran sed on the configure script to remove the include <cairo-xlib.h>. The test still passes without this include. My guess is the same is true for the pango+cairo test, the cairo-only test just seemed like the place to start.

    To be honest, this makes me a bit nervous since I don't know much about cairo and whether not having cairo-xlib will be a problem down the road. I might be "OK" with it for now until we can get xlib in core.

  4. Even after all that, lots of code won't work "out-of-the-box" since the default "type" parameter for devices like png still seems to be "xlib" even though we compiled it completely without xlib. It would be nice if we could figure out how to make the default "cairo".

  5. Editing the configuration file also led to some failures during building some package that requires java config. I haven't dug into it at all yet. It might have to do with the timestamp on the configure script or it could have been environmental.

@baggerspion
Copy link
Contributor Author

We now successfully have all graphics drivers enabled and cairo enabled as the default bitmap type:

> capabilities()
       jpeg         png        tiff       tcltk         X11        aqua 
       TRUE        TRUE        TRUE       FALSE       FALSE       FALSE 
   http/ftp     sockets      libxml        fifo      cledit       iconv 
       TRUE        TRUE        TRUE        TRUE        TRUE        TRUE 
        NLS     profmem       cairo         ICU long.double     libcurl 
       TRUE        TRUE        TRUE        TRUE        TRUE        TRUE 
> options("bitmapType")
$bitmapType
[1] "cairo"

Signed-off-by: Paul Adams <paul@baggerspion.net>
Signed-off-by: Paul Adams <paul.adams@endocode.com>
@baggerspion
Copy link
Contributor Author

These plans now have all their pkg_build_deps and pkg_deps corrected and the EXPORTS removed. I reckon these are now OK to merge.

…over these plans.

Signed-off-by: Paul Adams <paul@baggerspion.net>
Signed-off-by: Paul Adams <paul@baggerspion.net>
@baggerspion
Copy link
Contributor Author

So here's a problem:
It's one thing to have FontConfig installed. It's totally another to have fonts installed...
rplot_360

I was able to show that the output is correct, by installing some fonts manually into my studio:
rplot_360-1

Signed-off-by: Paul Adams <paul@baggerspion.net>
@baggerspion
Copy link
Contributor Author

This PR is getting a little crazy :) It now contains:
core/cairo
core/harfbuzz
core/pango
core/R
core/liberation-fonts-ttf

The Liberation Fonts pkg simply downloads and untars the Liberations Fonts for use by, for example, R. Problem, we need to run fc-cache $(pkg_path_for core/liberation-fonts-ttf) at some point before the fonts can actually be used. Not entirely sure when.

@bdangit
Copy link
Contributor

bdangit commented Jun 3, 2017

While we could do this in init but I suspect this is more of a cli command than a service that is to be managed underneath Hab sup.

Alternatively, you could always make a "R" wrapper where it will execute the command you need as well setup any other additional exports/variables/etc.

Copy link
Contributor

@bdangit bdangit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good!

R/plan.sh Outdated
core/diffutils
core/file
core/gcc
core/icu
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to call this out here if it's defined in pkg_deps

R/plan.sh Outdated
core/file
core/gcc
core/icu
core/liberation-fonts-ttf
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you need this during runtime, you'll want to make sure this is placed in pkg_deps

R/plan.sh Outdated
core/icu
core/liberation-fonts-ttf
core/libjpeg-turbo
core/libpng
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove here if called out in pkg_deps

R/plan.sh Outdated
core/gcc
core/icu
core/liberation-fonts-ttf
core/libjpeg-turbo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this if defined in pkg_deps

R/plan.sh Outdated
do_build() {
sed -i '/#include.*<cairo-xlib.h>/d' ./configure
./configure --prefix="${pkg_prefix}" \
--with-x=no \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alignment seems off by one space

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These alignment errors are super weird... don't see them in VIM. Will guess my way around them :)

R/plan.sh Outdated
sed -i '/#include.*<cairo-xlib.h>/d' ./configure
./configure --prefix="${pkg_prefix}" \
--with-x=no \
--disable-java \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alignment

harfbuzz/plan.sh Outdated
pkg_origin=core
pkg_version=1.3.1
pkg_maintainer="The Habitat Maintainers <humans@habitat.sh>"
pkg_license=('mit')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nit but would Uppercase to MIT

harfbuzz/plan.sh Outdated

do_build() {
./configure --prefix="$pkg_prefix" \
--with-gobject=yes
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alignment off by one space

pango/plan.sh Outdated
core/patch
core/perl
core/pkg-config
core/util-linux
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alignment by one space

Signed-off-by: Paul Adams <paul@baggerspion.net>
@baggerspion
Copy link
Contributor Author

Thanks for the review, @bdangit. Alignment issues all fixed and I've sorted out pkg_deps vs pkg_build_deps (thought I'd already done that).

I think this is mergeable now. The issue with updating the font-cache is something that can be fixed with documentation.

@bdangit
Copy link
Contributor

bdangit commented Jun 4, 2017

👍

@stevendanna
Copy link
Contributor

@eeyun Wondering if we can remove the DO-NOT-MERGE label? This looks good to me. While there is the fc-cache issue, I think it is best to "document and iterate" on that issue.

@eeyun
Copy link
Contributor

eeyun commented Jun 7, 2017

LGTM!

@eeyun
Copy link
Contributor

eeyun commented Jun 23, 2017


core/pixman/0.34.0/20170623171747 has been built and uploaded to the depot. 💖
core/cairo/1.14.8/20170623172008 has been built and uploaded to the depot. 💖
core/liberation-fonts-ttf/2.00.1/20170623172912 has been built and uploaded to the depot. 💖
core/harfbuzz/1.3.1/20170623172916 has been built and uploaded to the depot. 💖
core/pango/1.40.6/20170623172955 has been built and uploaded to the depot. 💖
core/R/3.4.0/20170623173042 has been built and uploaded to the depot. 💖

The following reverse dependencies in the chain have also been rebuilt:
core/qemu/2.7.0/20170623173821 has been built and uploaded to the depot. 💖
core/grub/2.02/20170623174156 has been built and uploaded to the depot. 💖

@eeyun eeyun merged commit 8585f28 into habitat-sh:master Jun 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants