serpapi / nokolexbor

High-performance HTML5 parser for Ruby based on Lexbor, with support for both CSS selectors and XPath.
182 stars 4 forks source link

undefined symbol: xmlFreeNodeList #1

Closed kostya closed 1 year ago

kostya commented 1 year ago
require "nokolexbor"
doc = Nokolexbor::HTML("")
/var/lib/gems/3.0.0/gems/nokolexbor-0.2.0/lib/nokolexbor.rb:3:in `require': /var/lib/gems/3.0.0/gems/nokolexbor-0.2.0/lib/nokolexbor/nokolexbor.so: undefined symbol: xmlFreeNodeList - /var/lib/gems/3.0.0/gems/nokolexbor-0.2.0/lib/nokolexbor/nokolexbor.so (LoadError)
        from /var/lib/gems/3.0.0/gems/nokolexbor-0.2.0/lib/nokolexbor.rb:3:in `<top (required)>'
zyc9012 commented 1 year ago

@kostya Fixed and released new version.

kostya commented 1 year ago

still failing:

/var/lib/gems/3.0.0/gems/nokolexbor-0.2.1/lib/nokolexbor.rb:3:in `require': /var/lib/gems/3.0.0/gems/nokolexbor-0.2.1/lib/nokolexbor/nokolexbor.so: undefined symbol: strnstr - /var/lib/gems/3.0.0/gems/nokolexbor-0.2.1/lib/nokolexbor/nokolexbor.so (LoadError)
        from /var/lib/gems/3.0.0/gems/nokolexbor-0.2.1/lib/nokolexbor.rb:3:in `<top (required)>'
zyc9012 commented 1 year ago

still failing:

/var/lib/gems/3.0.0/gems/nokolexbor-0.2.1/lib/nokolexbor.rb:3:in `require': /var/lib/gems/3.0.0/gems/nokolexbor-0.2.1/lib/nokolexbor/nokolexbor.so: undefined symbol: strnstr - /var/lib/gems/3.0.0/gems/nokolexbor-0.2.1/lib/nokolexbor/nokolexbor.so (LoadError)
        from /var/lib/gems/3.0.0/gems/nokolexbor-0.2.1/lib/nokolexbor.rb:3:in `<top (required)>'

What is your OS and gcc version?

kostya commented 1 year ago

gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0 Ubuntu 22.04.1 LTS

zyc9012 commented 1 year ago

@kostya Can you try this gem locally and see if it fixes the error?

nokolexbor-0.2.1.gem.zip

gem uninstall nokolexbor
gem install /path/to/nokolexbor-0.2.1.gem
kostya commented 1 year ago

It works if i do gem uninstall && gem install, from rubygems or from your file. But if i install it from bundler, undefined symbol: strnstr

zyc9012 commented 1 year ago

It works if i do gem uninstall && gem install, from rubygems or from your file. But if i install it from bundler, undefined symbol: strnstr

Just released new version and it should be good now.

kostya commented 1 year ago

fixed, thanks.

kostya commented 1 year ago

just compare with crystal, funny that in ruby parse faster, that in compiled language. crystal parse: 2.88s, css: 0.6s ruby parse: 2.34s, css: 1.43s

Probably in crystal finalize, and free memory called on every step. I dont know how it called in ruby.

zyc9012 commented 1 year ago

Probably in crystal finalize, and free memory called on every step. I dont know how it called in ruby.

It will be freed on GC, depending on how large the document is.

I'm wondering why css differs that much.

kostya commented 1 year ago

is css not only pure lib time but also extract array. and loop in ruby, which is should be slower.

zyc9012 commented 1 year ago

is css not only pure lib time but also extract array. and loop in ruby, which is should be slower.

I'm not using ruby array but lexbor array. Maybe because I did extra things like making result set unique and ordering the result set.