Skip to content

Instantly share code, notes, and snippets.

@richfitz
Last active August 29, 2015 14:16
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save richfitz/f949282560ee78c581c3 to your computer and use it in GitHub Desktop.
Save richfitz/f949282560ee78c581c3 to your computer and use it in GitHub Desktop.
libjq / R musings

Installation on OSX is currently a PITA if you don't have brew (I don't so that my system stays more similar to users of things, and because I'm a masochist apparently). See this issue as this will be fixed in jq 1.5. So, create an executable shell script sheep in the jq directory containing

#!/bin/sh
echo "baa"

and run YACC=./sheep ./configure - make should run fine after that.

There is a library target for jq, which is great because now we only have to wrap a library, rather than write one. Further, there is a set of Python bindings that we can use as a starting point. The repo is here.

Ruby bindings here

"Documentation" is here

So, the next steps are

  1. Identify a "hello world" example we can work towards
  2. Work out how to get libjq and R's shared library stuff working together

Once we have that done we can then expand out the DSL and implement more of the tool.

All the things I've interfaced previously have been header/system installed shared libraries. I don't think that's the right way here - I think we want to include all of jq/libjq into the object that we build. There are at least two different ways of doing that. The other sticking block is I can't see a simple C-level example of using libjq anywhere so we'll need to write that too.

  • this seems like the relevant section in R-exts
  • We're likely to fall foul of GNU-isms in the makefile.
  • But then the last example on that page looks exactly what we want, plus it should make it very easy to upgrade the jq version that we're linking to.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment