Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
build-script-build (signal: 11, SIGSEGV: invalid memory reference) #439
Comments
|
I had trouble on 32bit with upstream bindgen. |
fitzgen
added
the
bug
label
Jan 24, 2017
|
Thanks for the bug report! Care to run this under gdb or lldb and dump the output of |
bbigras
commented
Jan 24, 2017
not sure how to use lldb:
|
|
That only gives you the backtrace of cargo, could you check with Thanks for reporting this! :) |
bbigras
commented
Jan 24, 2017
|
|
Could you compile bindgen on debug ? |
|
That's seemed like a debug build (it's under That's I think the less useful backtrace I've ever seen, heh. Thanks for providing it though, much appreciated. It seems this is not a bindgen problem per se, the I think that this may be a libclang.so problem (this seems to happen while loading libclang?). May you try to do a local LLVM build and try with LIBCLANG_PATH set to that? It's going to take a while (I don't even know if the memory requirements to build LLVM can be fullfilled with a 32-bit build?). In any case, you can do it with: $ git clone https://github.com/llvm-mirror/llvm
$ cd llvm/tools
$ git clone https://github.com/llvm-mirror/clang
$ cd .. # To the llvm folder
$ mkdir build && cd build && cmake .. -DCMAKE_BUILD_TYPE=Debug && makeAfter that, libclang should be in |
bbigras
commented
Jan 25, 2017
I didn't have enough memory (I only had 3 GB and some was in use). I'll try on a bigger VM. Unless there's another solution. |
jeandudey
commented
Jan 30, 2017
•
|
The solution is very easy (i think), when i was working in the remacs codebase i came up with a similar issue (Wilfred/remacs#95), this was because the code was using newtypes, and in 32 bits they aren't passed correctly between C and Rust code, unlike 64 bits code. Currently An example of this is See rust-lang/rust#39394 for the explanation of why newtypes behave different than normal types. |
jeandudey
referenced this issue
in rust-lang/rust
Jan 30, 2017
Closed
tuple structs cause FFI segfaults on 32-bit Linux #39394
|
Oh, of course. That also explains why that didn't happen in the old bindgen before the clang-sys switch. It's a pity because we're also generating newtypes for bitfield-like enums. I agree this definitely needs, at least, some documentation (this is such a common pattern that nobody of the reviewers, among which there were rustc people, noticed this). Ideally we would actually have some compiler magic for this, since this is both a common idiom and really convenient. Treating newtypes as the underlying type regarding ABI may not be a bad idea, but it's a breaking change of course. Maybe it's worth an rfc though? In any case, cc @KyleMayes, this probably needs (another) libclang redesign plus breaking change I fear :/ |
|
Thanks @jeandudey for the comment, this would have required much more time to debug otherwise! |
|
|
|
This also affects all the enums and similar as far as I know though |
|
Oh yeah, forgot about those. R.I.P. type safety. I'll fix that soon. |
|
OK, all type safety has been excised in |
|
@brunoqc do you know if running a bindgen build with clang-sys |
|
@KyleMayes thanks for the quick turnaround btw :) |
jeandudey
commented
Jan 30, 2017
•
|
I tested it and works correctly, also this error needs to be fixed to build correctly:
|
bbigras commentedJan 24, 2017
I'm able to build this on Arch 64-bit but not on Ubuntu trusty 32-bit. I'm wondering if the cause could be the 32-bit part.
Ubuntu 14.04.5 LTS (32-bit)
clang-3.9
bindgen 0.20.0
Cargo.toml
lib.rs
build.rs
wrapper.h