yajl-ruby icon indicating copy to clipboard operation
yajl-ruby copied to clipboard

Use system YAJL instead of bundled one

Open voxik opened this issue 13 years ago • 4 comments

Would it be possible to make yajl-ruby to work with system version of yajl library? I'd love to see yajl-ruby packaged for Fedora, but this is showstopper unfortunately. Thank you.

voxik avatar Dec 14 '12 15:12 voxik

Unfortunately I'm using a patched version of yajl, which is why I chose to embed it. Definitely not ideal (I should have probably renamed the symbols or something). Would it help at all if I added -fvisibility=hidden? Or is that not the issue here?

I've been meaning to upgrade to yajl 2.x because I worked with @lloyd to pull in some of the patches I had in my embedded version of yajl 1.x into yajl 2.x. I'm hoping upgrading will let me work from a system yajl. I just haven't had any time to work on it :\

brianmario avatar Dec 14 '12 17:12 brianmario

Well, it is not about conflicts, it is about Fedora's policy [1]. Please let me know if there is anything I can help with.

[1] https://fedoraproject.org/wiki/Packaging:Guidelines#Bundling_of_multiple_projects

voxik avatar Dec 14 '12 17:12 voxik

@brianmario Hi, I made the necessary changes to change to system version of Yajl [1] and to update to Yajl 2 [2]. Only remaining issue is your patch of yajl_parser.c:

/* got a value.  transition depends on the state we're in. */
{
  yajl_state s = yajl_bs_current(hand->stateStack);
  if (s == yajl_state_start || s == yajl_state_got_value) {
    // Your patch
    yajl_reset_parser(hand);
    // What's in Yajl
    yajl_bs_set(hand->stateStack, yajl_state_parse_complete);

If yajl_state_parse_complete is set, parsing chunks of JSON would not work as expected, which you most likely know. We either need to submit a patch to Yajl or reconsider how Yajl should really work. Is this a bug or expected behaviour?

For now I left those 7 specs failing. Would be really nice if you could look at my changes and comment on them, so I can submit a pull request.

[1] https://github.com/strzibny/yajl-ruby/commit/9b92bf6107830356496c1092627021cedbca2dcd [2] https://github.com/strzibny/yajl-ruby/commit/ca1da4b89ed94bcbd0b37ec25b5646604cb1e2be

strzibny avatar Jan 22 '13 12:01 strzibny

@brianmario I looked into the 2.0 branch and it seems to me that the issue above is sort out and the suggested changes are also somehow implemented, is that correct? yajl_gen_reset fnc is missing in original Yajl 2 for ruby-yajl to work correctly, right? If this is the only difference, lets propose a patch to Yajl. What do you think?

I also noticed other changes like separating encoder and parser etc. Is this somehow incomplete? What is really missing in order to make it available both for system and bundled libs? Is there something else beyond deciding which version to use in extconf.rb?

strzibny avatar Jan 23 '13 13:01 strzibny