-
Notifications
You must be signed in to change notification settings - Fork 706
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
build-script-build (signal: 11, SIGSEGV: invalid memory reference) #439
Comments
I had trouble on 32bit with upstream bindgen. |
Thanks for the bug report! Care to run this under gdb or lldb and dump the output of |
not sure how to use lldb:
|
That only gives you the backtrace of cargo, could you check with Thanks for reporting this! :) |
|
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 && make After that, libclang should be in |
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. |
The solution is very easy (i think), when i was working in the remacs codebase i came up with a similar issue (remacs/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. |
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 :) |
I tested it and works correctly, also this error needs to be fixed to build correctly:
|
Using bitflags for FFI is unsound in linux32, and it causes crashes like https://bugzilla.mozilla.org/show_bug.cgi?id=1406952. This is pretty similar to rust-lang/rust-bindgen#439. For this to be properly type safe we need to wait for rust-lang/rust#43036. Hopefully that's not for too long.
Using bitflags for FFI is unsound in linux32, and it causes crashes like https://bugzilla.mozilla.org/show_bug.cgi?id=1406952. This is pretty similar to rust-lang/rust-bindgen#439. For this to be properly type safe we need to wait for rust-lang/rust#43036. Hopefully that's not for too long.
Using bitflags for FFI is unsound in linux32, and it causes crashes like https://bugzilla.mozilla.org/show_bug.cgi?id=1406952. This is pretty similar to rust-lang/rust-bindgen#439. For this to be properly type safe we need to wait for rust-lang/rust#43036. Hopefully that's not for too long.
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
The text was updated successfully, but these errors were encountered: