Giter Club home page Giter Club logo

cxx2rs's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

badosu mardiros

cxx2rs's Issues

can't find clang on debian

I'm getting

clang.cindex.LibclangError: libclang.so: cannot open shared object file: No such file or directory. To provide a path to libclang use Config.set_library_path() or Config.set_library_file().

libclang is on my system:

/usr/lib/llvm-3.5/lib/libclang.so

any ideas?

Not implemented: Type=TypeKind.FUNCTIONNOPROTO

Happens on this code

struct foo {
    float (*getBar)();
}

I call it like this:

cxx2rs foo test.h

Full output

 File "/usr/local/bin/cxx2rs", line 9, in <module>
    load_entry_point('cxx2rs==0.3.7', 'console_scripts', 'cxx2rs')()
  File "/Library/Python/2.7/site-packages/cxx2rs/__main__.py", line 60, in main
    print rustify_struct_declaration(struct)
  File "/Library/Python/2.7/site-packages/cxx2rs/rustify.py", line 134, in rustify_struct_declaration
    members += "\tpub %s,\n" % rustify_variable_declaration(c)
  File "/Library/Python/2.7/site-packages/cxx2rs/rustify.py", line 18, in rustify_variable_declaration
    rustify_type(node.type.get_canonical()))
  File "/Library/Python/2.7/site-packages/cxx2rs/rustify.py", line 88, in rustify_type
    res = rustify_pointer(node)
  File "/Library/Python/2.7/site-packages/cxx2rs/rustify.py", line 49, in rustify_pointer
    return '*mut ' + rustify_type(canonical_pointee)
  File "/Library/Python/2.7/site-packages/cxx2rs/rustify.py", line 102, in rustify_type
    raise Exception("Not implemented: Type=%s" % canonical_kind)
Exception: Not implemented: Type=TypeKind.FUNCTIONNOPROTO

clang version

Apple LLVM version 7.0.0 (clang-700.1.76)
Target: x86_64-apple-darwin15.0.0
Thread model: posix

Fails on lv2.h

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'

running tests fails with error about undefined symbol in libclang

Running test "function_arg.c"...
Traceback (most recent call last):
  File "./cxx2rs.py", line 72, in <module>
    main()
  File "./cxx2rs.py", line 33, in main
    index = clang.cindex.Index.create()
  File "/usr/lib/python2.7/dist-packages/clang/cindex.py", line 2047, in create
    return Index(conf.lib.clang_createIndex(excludeDecls, 0))
  File "/usr/lib/python2.7/dist-packages/clang/cindex.py", line 141, in __get__
    value = self.wrapped(instance)
  File "/usr/lib/python2.7/dist-packages/clang/cindex.py", line 3357, in lib
    lib = self.get_cindex_library()
  File "/usr/lib/python2.7/dist-packages/clang/cindex.py", line 3388, in get_cindex_library
    raise LibclangError(msg)
clang.cindex.LibclangError: /usr/lib/x86_64-linux-gnu/libclang-3.5.so.1: undefined symbol: _ZN4llvm24llvm_start_multithreadedEv. To provide a path to libclang use Config.set_library_path() or Config.set_library_file().
Traceback (most recent call last):
  File "./run_tests.py", line 82, in <module>
    main()
  File "./run_tests.py", line 79, in main
    run_test(fname_cxx)
  File "./run_tests.py", line 52, in run_test
    actual_output = subprocess.check_output(cmd).split()
  File "/usr/lib/python2.7/subprocess.py", line 573, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '['./cxx2rs.py', 'cxx', '././tests/function_arg.c']' returned non-zero exit status 1

Convert jvmti header files

Hi,
I want to convert JVM Tool Interface header files (jdk1.7.0_79\include). There is no any lib file, just headers.

python.exe cxx2rs C:\Users...\src\jvmti.h > jvmti.rs
Traceback (most recent call last):
File "C:\Python27\lib\runpy.py", line 162, in run_module_as_main
"main", fname, loader, pkg_name)
File "C:\Python27\lib\runpy.py", line 72, in run_code
exec code in run_globals
File "C:\Python27\Lib\site-packages\cxx2rs__main
.py", line 13, in
from parser import canonical_function_name
ImportError: cannot import name canonical_function_name

How do I do that?
thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.