-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dstep segfaults: Unhandled type kind cast(CXTypeKind)119 #98
Comments
Impressive SEGFAULT : ). Can you provide the dstep invocation? |
:) Here you are: |
Could you try this invocation:
? Replace |
Are you sure you are using the most recent version of dstep (sorry, but I needed to ask this : )). I'm unable to reproduce the error on my system (Linux Mint)... What system are you using? |
Adding dstep_home/resources to includes didn't help. I also switched from gcc-includes to those of llvm (using v3.9.0) - same result. |
Any information can be helpful. I'll see what I can do. |
I updated to dmd-2.071.2 - same result.
Can this be fixed or should the README get updated to require a more recent dmd-version? |
It should work fine with
Probably it should be fixed. However I''m not sure, but I suppose @jacob-carlborg will know. I'll try to install Gentoo on virtual-box and I'll see if I can reproduce the bug then. |
Gentoo is entirely built from source, so probably too much trouble for you simply to reproduce that bug (and due to the fact Gentoo is highly customized you might not be able to reproduce the issue then...) |
You may be right about that gentoo installation... Anyway, could you run |
One step closer :)
And magically dstep doesn't crash for me anymore on vterm.h!
And a related question: Is it possible to get the exact line where dstep is crashing? It would really help alot here. [1] http://bazaar.leonerd.org.uk/c/libvterm/ |
Didn't you have that in the debug build?
|
I don't really know which is the minimum supported version of DMD now, ciechowoj has done most of the recent development. Travis CI is configured to run 2.070.0. I'll give it a try to see which is the minimum version it will compile with. I'll update the readme file accordingly. |
Ok, with libclang 3.9.0 it is failing on my setup as well. There must be some difference between libclang 3.7 and libclang 3.9. |
It might be a new CXTypeKind that DStep currently doesn't know about. |
The line that triggers segfault is:
|
in Probably there is something wrong with |
You are right they introduced a new type kind |
Keep up to date with libclang? I don't mind checking the version of libclang, but I would rather use static linking and only support the latest version. |
So, I'll try to do this way.
Yeah, that would be nice, but as we were talking before about it, it isn't that trivial and would require a significant amount of work. @ff2000 as a temporary fix you could try to use an older version of libclang (3.7 seems to work)... |
Really? I tried to link with all static libraries in |
And what about windows and MacOS ? |
That was on macOS (that's my main platform). I haven't tried on Linux or Windows, would it be any different? |
I'm worried that the standard distribution of LLVM doesn't provide precompiled static libraries. Anyway, do you have an idea how to integrate it with build system? The only idea I can think of at the moment is to add a custom build step that downloads the LLVM binaries and links against them. It there is no appropriate binaries we would need to build LLVM from sources, with and configure it correctly beforehand to get static libraries. |
You mean for Windows? Or LLVM from a Linux dist repo? Hmm, the Windows exe does not ship with static libraries 😞.
I haven't though of this yet, but we already download the LLVM binaries when running the tests.
That would be a bit annoying but doable, at least on Posix. |
That what I meant saying "not that trivial" : ) |
Hmm, what about distributing the .dll/.so with dstep? If I remember correctly windows will use .dll that is in the local directory? If not we could load the functions dynamically. |
Yeah, that could be an alternative. But then the user might move the executable without moving the dll. Isn't it possible to embed a dll into an executable? |
I seems to be possible, at least here is one way to do this http://www.drdobbs.com/packing-dlls-in-your-exe/184416443 .
The dstep binary is a bit coupled to its directory due to files in "resource" sub-directory anyway. |
No, those files are embedded in the executable. |
"The embedded DLLs get extracted out of the application the first time a function from the DLL is called". I had hoped it does not need to be extracted. |
@ff2000 I've updated the readme file to indicate the minimum required version of the compiler. |
I believe there is a way to do it without extraction. |
That would be cool. |
Wow, seems there happened quite a lot while I was AFK :D
Sry for being unclear... I was talking about the line (and a little bit of context?) in the C header that I want to convert into D. Downgrading system-llvm currently is no option as I need the most recent version. Concerning bundling .dll/.so: |
Hmm, not sure how easy that would be.
Is that required in general for your system or for this specific translation? If an older version would work for this specific translation you could download the pre-compiled binaries here [1]. Should be enough to place libclang.so in the same directory as the
No one talked about bundling them in the repository. I talked about static linking and embed the DLL inside the executable.
Not sure what you mean with binary packages be there are already pre-compiled binaries available [2]. [1] http://llvm.org/releases/download.html#3.7.0 |
@jacob-carlborg thx for clarification. I didn't get your intention. I thought you plan something like this: And I will download llvm-3.7 now. I was talking about downgrading the system-llvm, using llvm-3.7 upstream binary only for dstep should be no problem! |
Here https://github.com/ciechowoj/dstep/tree/issue98 is a branch with fix for the problem, I cannot create pull request because it doesn't link against anything but libclang3.9 : ( . |
Hmm, I see. Looks like we might be forced to bump the minimum requirements. I need to give this some thought. |
@ciechowoj was this caused by a elaborated type specifier? Isn't that a C++ feature? |
On Sun, 23 Oct 2016 05:28:22 -0700, jacob-carlborg notifications@github.com wrote:
Sry for being unclear... I was talking about the line (and a little bit of context?) in the C header that I want to convert into D.
|
Yes.
Yes and no. From the libclang manual:
It seems they added an indirection for types from tag namespace, when you use They added a new function:
To get underlying type from elaborated type. This feature is unavailable in earlier versions of libclang. |
Aha, I see. |
Sorry for taking so long. I went ahead and tried the fix from @ciechowoj which didn't work for me. Compilation of dstep succeeded, running dstep didn't show an error, but importing tickit errored out:
I also tried to make dub pick up the llvm I downloaded, which was a complete disaster... |
Hmm, does
I'm not sure what you are trying to achieve here. Make dstep to use LLVM 3.9? |
@ciechowoj Sorry, it was late yesterday. I mixed two issues and didn't make it clear.
|
No problem, the late time haven't served me as well: I've misunderstood the first part of your post. I thought that those errors are clang errors from dstep, despite the fact you clearly said that the dstep tests had passes and the problem is with the usage of the result code (and that Truth said I haven't checked if the resulting
The translation of includes to imports is kind of broken in dstep now (I suspect that is the problem here), I have an idea how to fix this, but I do not have time to work on this at the moment...
I'm not sure if it will work for you but you may try to change the paths in
Nice to here that : ) |
Currently DStep doesn't guarantee that it will generate modules that will import all other necessary modules. Converting the C include model to the D module system is very difficult thing to get 100% correct. Generated modules may require some minor manual tweaks, especially when it comes to adding import statements.
If you put |
@ciechowoj I plan to bump the minimum requirement of libclang to 3.9. Did you have a fix for this bug? |
Maybe I rebase on Sunday. |
That would be great. |
Fix #98: dstep segfaults: Unhandled type kind cast(CXTypeKind)119
I want to create D-bindings for https://launchpad.net/libtickit. Unfortunately it segfaults:
Using a debug-build I get the following assertion:
The text was updated successfully, but these errors were encountered: