manuels / cxx2rs

A rust-binding generator for C files
GNU General Public License v2.0
51 stars 3 forks source link

Fails on lv2.h #4

Open badosu opened 9 years ago

badosu commented 9 years ago

I am experimenting on Rust as an audio processing language, so I am trying to create a simple lv2 plugin.

The problem is that I am not able to process the header file to access lv2 interface, see:

This is the file: lv2.h

~/l/amp ❯❯❯ python2.7 ~/Code/cxx2rs/cxx2rs.py lv2 /usr/include/lv2.h

#![crate_type = "lib"]
#![crate_name = "ssh"]

extern crate libc;
use std::mem;

use std::collections::enum_set::CLike;

Traceback (most recent call last):
  File "/home/badosu/Code/cxx2rs/cxx2rs.py", line 74, in <module>
    main()
  File "/home/badosu/Code/cxx2rs/cxx2rs.py", line 47, in main
    print "/*\n%s*/" % stringify_function_declaration(func)
  File "/home/badosu/Code/cxx2rs/stringify.py", line 21, in stringify_function_declaration
    canonical_function_name(node),
  File "/home/badosu/Code/cxx2rs/parser.py", line 94, in canonical_function_name
    for p in parent_path(node):
  File "/home/badosu/Code/cxx2rs/parser.py", line 89, in parent_path
    res = parent_path(parent) + [parent]
  File "/home/badosu/Code/cxx2rs/parser.py", line 86, in parent_path
    if parent.spelling is None:
AttributeError: 'NoneType' object has no attribute 'spelling'
manuels commented 9 years ago

I just pushed a new commit and tried compiling lv2.h. Worked fine here.

badosu commented 9 years ago

I am sorry, i just pulled fab40a86fc65b9f003bb2f89e019a44f431c5185, and it still fails for me, see the gist. I must say that it is failing in a different place now, though.

Am I doing anything wrong?

manuels commented 9 years ago

hmm, what does clang --version output on your system?

badosu commented 9 years ago

Hi @manuels, it follows:

~ ❯❯❯ clang --version
clang version 3.5.1 (tags/RELEASE_351/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
manuels commented 9 years ago
$ clang --version
Debian clang version 3.5.0-1~exp1 (trunk) (based on LLVM 3.5.0)
Target: x86_64-pc-linux-gnu
Thread model: posix

That is pretty strange!

badosu commented 9 years ago

Is your version different? If you tell me which is, I can use it to make it work :-). Thanks for helping me out with this issue.