mat813 / rb-kqueue

An FFI wrapper for kqueue
MIT License
22 stars 12 forks source link

Type error, 'uintptr_t' vir listen #4

Closed skoba closed 11 years ago

skoba commented 11 years ago

Type error occurs on FreeBSD 9.1 and listen with rb-kqueue. I am very happy if listen works well on FreeBSD, could you solve this?

% ruby -v                                                              ~
ruby 1.9.3p327 (2012-11-10 revision 37606) [amd64-freebsd9]

rb-kqueue 0.2.0, listen 0.7.2 guard 1.6.2, spork 0.9.2

Error message

/usr/local/lib/ruby/gems/1.9/gems/ffi-1.3.1/lib/ffi/types.rb:57:in `find_type': unable to resolve type 'uintptr_t' (TypeError)
    from /usr/local/lib/ruby/gems/1.9/gems/ffi-1.3.1/lib/ffi/library.rb:486:in `find_type'
    from /usr/local/lib/ruby/gems/1.9/gems/ffi-1.3.1/lib/ffi/struct.rb:315:in `find_type'
    from /usr/local/lib/ruby/gems/1.9/gems/ffi-1.3.1/lib/ffi/struct.rb:309:in `find_field_type'
    from /usr/local/lib/ruby/gems/1.9/gems/ffi-1.3.1/lib/ffi/struct.rb:351:in `array_layout'
    from /usr/local/lib/ruby/gems/1.9/gems/ffi-1.3.1/lib/ffi/struct.rb:261:in `layout'
    from /usr/local/lib/ruby/gems/1.9/gems/rb-kqueue-0.2.0/lib/rb-kqueue/native.rb:17:in `<class:KEvent>'
    from /usr/local/lib/ruby/gems/1.9/gems/rb-kqueue-0.2.0/lib/rb-kqueue/native.rb:15:in `<module:Native>'
    from /usr/local/lib/ruby/gems/1.9/gems/rb-kqueue-0.2.0/lib/rb-kqueue/native.rb:9:in `<module:KQueue>'
    from /usr/local/lib/ruby/gems/1.9/gems/rb-kqueue-0.2.0/lib/rb-kqueue/native.rb:3:in `<top (required)>'
    from /usr/local/lib/ruby/gems/1.9/gems/rb-kqueue-0.2.0/lib/rb-kqueue.rb:1:in `require'
    from /usr/local/lib/ruby/gems/1.9/gems/rb-kqueue-0.2.0/lib/rb-kqueue.rb:1:in `<top (required)>'
    from /usr/local/lib/ruby/gems/1.9/gems/listen-0.7.2/lib/listen/dependency_manager.rb:91:in `require'
    from /usr/local/lib/ruby/gems/1.9/gems/listen-0.7.2/lib/listen/dependency_manager.rb:91:in `block in load_depenencies'
    from /usr/local/lib/ruby/1.9/set.rb:222:in `block in each'
    from /usr/local/lib/ruby/1.9/set.rb:222:in `each_key'
    from /usr/local/lib/ruby/1.9/set.rb:222:in `each'
    from /usr/local/lib/ruby/gems/1.9/gems/listen-0.7.2/lib/listen/dependency_manager.rb:87:in `load_depenencies'
    from /usr/local/lib/ruby/gems/1.9/gems/listen-0.7.2/lib/listen/adapter.rb:141:in `usable?'
    from /usr/local/lib/ruby/gems/1.9/gems/listen-0.7.2/lib/listen/adapters/bsd.rb:67:in `usable?'
    from /usr/local/lib/ruby/gems/1.9/gems/listen-0.7.2/lib/listen/adapter.rb:154:in `usable_and_works?'
    from /usr/local/lib/ruby/gems/1.9/gems/listen-0.7.2/lib/listen/adapter.rb:48:in `select_and_initialize'
    from /usr/local/lib/ruby/gems/1.9/gems/listen-0.7.2/lib/listen/listener.rb:222:in `initialize_adapter'
    from /usr/local/lib/ruby/gems/1.9/gems/listen-0.7.2/lib/listen/listener.rb:47:in `start'
    from /usr/local/lib/ruby/gems/1.9/gems/guard-1.6.2/lib/guard.rb:189:in `block in start'
    from /usr/local/lib/ruby/gems/1.9/gems/guard-1.6.2/lib/guard.rb:363:in `block in within_preserved_state'
    from <internal:prelude>:10:in `synchronize'
    from /usr/local/lib/ruby/gems/1.9/gems/guard-1.6.2/lib/guard.rb:360:in `within_preserved_state'
    from /usr/local/lib/ruby/gems/1.9/gems/guard-1.6.2/lib/guard.rb:185:in `start'
    from /usr/local/lib/ruby/gems/1.9/gems/guard-1.6.2/lib/guard/cli.rb:110:in `start'
    from /usr/local/lib/ruby/gems/1.9/gems/thor-0.17.0/lib/thor/task.rb:27:in `run'
    from /usr/local/lib/ruby/gems/1.9/gems/thor-0.17.0/lib/thor/invocation.rb:120:in `invoke_task'
    from /usr/local/lib/ruby/gems/1.9/gems/thor-0.17.0/lib/thor.rb:344:in `dispatch'
    from /usr/local/lib/ruby/gems/1.9/gems/thor-0.17.0/lib/thor/base.rb:434:in `start'
    from /usr/local/lib/ruby/gems/1.9/gems/guard-1.6.2/bin/guard:6:in `<top (required)>'
    from /usr/local/bin/guard:23:in `load'
    from /usr/local/bin/guard:23:in `<main>'

Gemfile

source 'https://rubygems.org'

gem 'rails', '3.2.9'

gem 'sqlite3'

# Using edge openehr package
gem 'openehr'

gem 'thor'
gem "jeweler"
gem 'soap4r-ruby1.9'

group :test, :developlent do
  gem 'rspec'
  gem 'spork' #, "~> 1.0rc"
  gem 'guard'
  gem 'guard-spork'
  gem 'guard-rspec'
  gem 'guard-cucumber'
  gem
  gem 'rb-kqueue'
  gem 'spork-rails'
  gem 'libnotify'
  gem 'simplecov'
  gem 'database_cleaner'
#  gem 'rails3-generators' #mainly for factory_girl & simple_form at this point
  gem 'rspec-rails'
  gem 'ammeter'
  gem 'fabrication'
  gem 'forgery'
end

Guardfile

guard 'spork' do
  watch('Gemfile')
  watch('Gemfile.lock')
end

guard 'rspec', :cli => '--drb' do
  watch(%r{^spec/.+_spec\.rb$})
  watch(%r{^lib/(.+)\.rb$})     { |m| "spec/lib/#{m[1]}_spec.rb" }
  watch('spec/spec_helper.rb') { :rspec }
end

guard 'cucumber', cli: '--drb' do
  watch(%r{^features/.+\.feature$})
  watch(%r{^features/support/.+$})          { 'features' }
  watch(%r{^features/step_definitions/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'features' }
end
mat813 commented 11 years ago

I tried on three different 9.1, both i386 and amd64, and I can't seem to reproduce your error.

Could you reproduce the error with a simpler scenario ? like by running tests on listen ?

skoba commented 11 years ago

I cloned guard/listen and ran rspec by rake. The same errors occured.

% rake spec                                                 ~/src/listen
/usr/local/bin/ruby19 -S rspec ./spec/listen/adapter_spec.rb ./spec/listen/adapters/bsd_spec.rb ./spec/listen/adapters/darwin_spec.rb ./spec/listen/adapters/linux_spec.rb ./spec/listen/adapters/polling_spec.rb ./spec/listen/adapters/windows_spec.rb ./spec/listen/dependency_manager_spec.rb ./spec/listen/directory_record_spec.rb ./spec/listen/listener_spec.rb ./spec/listen/multi_listener_spec.rb ./spec/listen/turnstile_spec.rb ./spec/listen_spec.rb
/usr/local/lib/ruby/gems/1.9/gems/ffi-1.3.1/lib/ffi/types.rb:57:in `find_type': unable to resolve type 'uintptr_t' (TypeError)
    from /usr/local/lib/ruby/gems/1.9/gems/ffi-1.3.1/lib/ffi/library.rb:486:in `find_type'
    from /usr/local/lib/ruby/gems/1.9/gems/ffi-1.3.1/lib/ffi/struct.rb:315:in `find_type'
    from /usr/local/lib/ruby/gems/1.9/gems/ffi-1.3.1/lib/ffi/struct.rb:309:in `find_field_type'
    from /usr/local/lib/ruby/gems/1.9/gems/ffi-1.3.1/lib/ffi/struct.rb:351:in `array_layout'
    from /usr/local/lib/ruby/gems/1.9/gems/ffi-1.3.1/lib/ffi/struct.rb:261:in `layout'
    from /usr/local/lib/ruby/gems/1.9/gems/rb-kqueue-0.2.0/lib/rb-kqueue/native.rb:17:in `<class:KEvent>'
    from /usr/local/lib/ruby/gems/1.9/gems/rb-kqueue-0.2.0/lib/rb-kqueue/native.rb:15:in `<module:Native>'
    from /usr/local/lib/ruby/gems/1.9/gems/rb-kqueue-0.2.0/lib/rb-kqueue/native.rb:9:in `<module:KQueue>'
    from /usr/local/lib/ruby/gems/1.9/gems/rb-kqueue-0.2.0/lib/rb-kqueue/native.rb:3:in `<top (required)>'
    from /usr/local/lib/ruby/site_ruby/1.9/rubygems/custom_require.rb:55:in `require'
    from /usr/local/lib/ruby/site_ruby/1.9/rubygems/custom_require.rb:55:in `require'
    from /usr/local/lib/ruby/gems/1.9/gems/rb-kqueue-0.2.0/lib/rb-kqueue.rb:1:in `<top (required)>'
    from /usr/local/lib/ruby/site_ruby/1.9/rubygems/custom_require.rb:55:in `require'
    from /usr/local/lib/ruby/site_ruby/1.9/rubygems/custom_require.rb:55:in `require'
    from /usr/home/skoba/src/listen/lib/listen/dependency_manager.rb:91:in `block in load_depenencies'
    from /usr/local/lib/ruby/1.9/set.rb:222:in `block in each'
    from /usr/local/lib/ruby/1.9/set.rb:222:in `each_key'
    from /usr/local/lib/ruby/1.9/set.rb:222:in `each'
    from /usr/home/skoba/src/listen/lib/listen/dependency_manager.rb:87:in `load_depenencies'
    from /usr/home/skoba/src/listen/lib/listen/adapter.rb:141:in `usable?'
    from /usr/home/skoba/src/listen/lib/listen/adapters/bsd.rb:67:in `usable?'
    from /usr/home/skoba/src/listen/spec/listen/adapter_spec.rb:137:in `block (2 levels) in <top (required)>'
    from /usr/home/skoba/src/listen/spec/listen/adapter_spec.rb:134:in `each'
    from /usr/home/skoba/src/listen/spec/listen/adapter_spec.rb:134:in `block in <top (required)>'
    from /usr/local/lib/ruby/gems/1.9/gems/rspec-core-2.12.2/lib/rspec/core/example_group.rb:244:in `module_eval'
    from /usr/local/lib/ruby/gems/1.9/gems/rspec-core-2.12.2/lib/rspec/core/example_group.rb:244:in `subclass'
    from /usr/local/lib/ruby/gems/1.9/gems/rspec-core-2.12.2/lib/rspec/core/example_group.rb:230:in `describe'
    from /usr/local/lib/ruby/gems/1.9/gems/rspec-core-2.12.2/lib/rspec/core/dsl.rb:18:in `describe'
    from /usr/home/skoba/src/listen/spec/listen/adapter_spec.rb:3:in `<top (required)>'
    from /usr/local/lib/ruby/gems/1.9/gems/rspec-core-2.12.2/lib/rspec/core/configuration.rb:789:in `load'
    from /usr/local/lib/ruby/gems/1.9/gems/rspec-core-2.12.2/lib/rspec/core/configuration.rb:789:in `block in load_spec_files'
    from /usr/local/lib/ruby/gems/1.9/gems/rspec-core-2.12.2/lib/rspec/core/configuration.rb:789:in `each'
    from /usr/local/lib/ruby/gems/1.9/gems/rspec-core-2.12.2/lib/rspec/core/configuration.rb:789:in `load_spec_files'
    from /usr/local/lib/ruby/gems/1.9/gems/rspec-core-2.12.2/lib/rspec/core/command_line.rb:22:in `run'
    from /usr/local/lib/ruby/gems/1.9/gems/rspec-core-2.12.2/lib/rspec/core/runner.rb:80:in `run'
    from /usr/local/lib/ruby/gems/1.9/gems/rspec-core-2.12.2/lib/rspec/core/runner.rb:17:in `block in autorun'
rake aborted!
/usr/local/bin/ruby19 -S rspec ./spec/listen/adapter_spec.rb ./spec/listen/adapters/bsd_spec.rb ./spec/listen/adapters/darwin_spec.rb ./spec/listen/adapters/linux_spec.rb ./spec/listen/adapters/polling_spec.rb ./spec/listen/adapters/windows_spec.rb ./spec/listen/dependency_manager_spec.rb ./spec/listen/directory_record_spec.rb ./spec/listen/listener_spec.rb ./spec/listen/multi_listener_spec.rb ./spec/listen/turnstile_spec.rb ./spec/listen_spec.rb failed
mat813 commented 11 years ago

Hum, ok, still can't reproduce :

$ uname -r
9.1-RELEASE
$ ruby -v
ruby 1.9.3p374 (2013-01-15 revision 38858) [i386-freebsd9.1]
$ rake spec
/home/mat/.rvm/rubies/ruby-1.9.3-p374/bin/ruby -S rspec ./spec/listen/adapter_spec.rb ./spec/listen/adapters/bsd_spec.rb ./spec/listen/adapters/darwin_spec.rb ./spec/listen/adapters/linux_spec.rb ./spec/listen/adapters/polling_spec.rb ./spec/listen/adapters/windows_spec.r
b ./spec/listen/dependency_manager_spec.rb ./spec/listen/directory_record_spec.rb ./spec/listen/listener_spec.rb ./spec/listen/multi_listener_spec.rb ./spec/listen/turnstile_spec.rb ./spec/listen_spec.rb
Run options:
  include {:focus=>true}
  exclude {:broken=>true}

All examples were filtered out; ignoring {:focus=>true}

Listen::DependencyManager
  #dependencies_loaded?
    return false when dependencies are not loaded
    return true when there are no dependencies to load
    return true when dependencies are loaded
  #dependency
[...]

Are you sure your ruby, and gems, like ffi and rb-kqueue were compiled on 9.1 ? (well, it seems so as your ruby says amd64-freebsd9, but, you never know…) Have you tried reinstalling them ?

I'm a bit at loss here, I don't see how you could have those errors. Do you have, hum, uintptr_t defined in /usr/include (should be in machine/_types.h and sys/_stdint.h)

Could you try with a ruby installed by rvm and not the stock one ?

skoba commented 11 years ago

Thank you for advise me. All of ruby, gems and rb-kqueue were compiled on 9.1. I tried other my FreeBSD PC to check, and it passed and green. I think ZFS might cause something wrong, is it possible? The errors occur on ZFS, but not on UFS.

skoba commented 11 years ago

Once I sent-pr about ZFS curiosity.

http://www.freebsd.org/cgi/query-pr.cgi?pr=169282

mat813 commented 11 years ago

Sorry for the wait, I don't have any 9.1 with ZFS at the moment, but I'm looking at upgrading a 8.2 box. I'll let you know.

skoba commented 11 years ago

I found ffi package x86_64-freebsd/type.conf lacked uintptr_t type and sent pull request to ffi package. However, more test must be performed, because guard-listen does not find kevent of file change now.