kaitai-io / kaitai_struct_visualizer

Kaitai Struct: visualizer and hex viewer tool
https://rubygems.org/gems/kaitai-struct-visualizer
GNU General Public License v3.0
280 stars 25 forks source link

unable to run #13

Closed evandrix closed 7 years ago

evandrix commented 7 years ago

$ ksv 1194614.gif gif.ksy

error message

/eta: unknown key found, expected: enums, instances, meta, seq, types
Compilation OK
/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': no implicit conversion of nil into String (TypeError)
    from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /var/lib/gems/2.3.0/gems/kaitai-struct-visualizer-0.5/lib/kaitai/struct/visualizer/visualizer_main.rb:31:in `block in compile_format'
    from /usr/lib/ruby/2.3.0/tmpdir.rb:89:in `mktmpdir'
    from /var/lib/gems/2.3.0/gems/kaitai-struct-visualizer-0.5/lib/kaitai/struct/visualizer/visualizer_main.rb:10:in `compile_format'
    from /var/lib/gems/2.3.0/gems/kaitai-struct-visualizer-0.5/lib/kaitai/struct/visualizer/visualizer.rb:18:in `initialize'
    from /var/lib/gems/2.3.0/gems/kaitai-struct-visualizer-0.5/bin/ksv:19:in `new'
    from /var/lib/gems/2.3.0/gems/kaitai-struct-visualizer-0.5/bin/ksv:19:in `<top (required)>'
    from /usr/local/bin/ksv:23:in `load'
    from /usr/local/bin/ksv:23:in `<main>'
GreyCat commented 7 years ago

Judging from /eta: unknown key found, you've got a key named eta on the top level of the gif.ksy file, while it should be named meta. Copy-paste error?

thsieh123 commented 7 years ago

Hi, First time running this. What could be wrong in this situation? Would this due to incompatible with kaitai-struct runtime I have?

ksv ~/workspace2/temp/test.png ~/workspace2/kaitai_struct/formats/image/png.ksy

Compilation OK Class loaded OK /var/lib/gems/1.9.1/gems/kaitai-struct-0.5/lib/kaitai/struct/struct.rb:314:in ensure_fixed_contents': wrong number of arguments (1 for 2) (ArgumentError) from /tmp/d20161231-50149-wf4cb6/png.rb:29:in_read' from /var/lib/gems/1.9.1/gems/kaitai-struct-visualizer-0.5/lib/kaitai/struct/visualizer/visualizer.rb:29:in initialize' from /var/lib/gems/1.9.1/gems/kaitai-struct-visualizer-0.5/bin/ksv:19:innew' from /var/lib/gems/1.9.1/gems/kaitai-struct-visualizer-0.5/bin/ksv:19:in <top (required)>' from /usr/local/bin/ksv:23:inload' from /usr/local/bin/ksv:23:in `

'

png_ksy.zip

test

thsieh123 commented 7 years ago

Could be that kaitai_struct's commit c27986b404 broke binary compatibility. Wonder how to rebuild kaitai_struct_visualizer?

thsieh123 commented 7 years ago

ah, sorry, I got it working now.

GreyCat commented 7 years ago

@thsieh123 Sorry for late reply %) Indeed, you've encountered incompatibility between 0.5 and upcoming 0.6 API. You need to either user 0.5 everywhere (i.e. both runtime and compiler), or current git (upcoming 0.6) everywhere (i.e. compile the compiler from git + use Ruby runtime from git). As far as I remember, visualizer itself had no major API changes between 0.5 and 0.6, so it's only a matter of ksc vs runtime.

Actually, this case gave a good idea that we probably need to add some sanity checks into generated code, to check the version of API.

GreyCat commented 7 years ago

@thsieh123 I've added this as an issue to main KS project: https://github.com/kaitai-io/kaitai_struct/issues/72

thsieh123 commented 7 years ago

Thanks!