News for hackers. Stuff that matters.
Re:Elixir at PagerDuty by inferiorhuman on Thursday June 14, 2018 @05:18PM (#17315463)
Does rustfmt-preview work with bindgen though?
Re:Elixir at PagerDuty by steveklabnik on Thursday June 14, 2018 @05:41PM (#17315661)
I don’t know what this sentence means.
Re:Elixir at PagerDuty by inferiorhuman on Thursday June 14, 2018 @07:12PM (#17316185)
Bindgen relies on rustfmt. With the codebase I'm using rustfmt-nightly works, but the stable version segfaults. Known issue but that's why I've stuck with rustfmt-nightly.
Re:Elixir at PagerDuty by steveklabnik on Thursday June 14, 2018 @07:29PM (#17316277)
Interesting! I was not aware of that. So, no idea :)
Re:Elixir at PagerDuty by inferiorhuman on Thursday June 14, 2018 @07:50PM (#17316376)
https://github.com/rust-lang-nursery/rust-bindgen/issues/104...

So yeah looks like I'm tethered to the nightly toolchain after all. :/

Re:Elixir at PagerDuty by steveklabnik on Thursday June 14, 2018 @08:35PM (#17316563)
I happen to be in the same physical location as the maintainers of both. This should be re-opened. I’ll chat with them. But first... I’m also confused. The component is the rustfmt-nightly codebase. You’re still seeing problems with the component?
Re:Elixir at PagerDuty by inferiorhuman on Friday June 15, 2018 @03:35PM (#17322819)
I'm using bindgen to generate bindings for radare2. But I'm also using TryFrom, so I'm not likely to move off of the nightly toolchain any time soon.

Before I ended up going down the TryFrom rabbit hole I ran into two issues with bindgen:

1.) Bindgen segfaults with the ancient LLVM on OSX 10.9. Issue #1006. Solution: use LLVM >= 5 binaries from the LLVM site.

2.) Stable (deprecated) rustfmt causes bindgen to segfault. Solution: cargo install -f rustfmt-nightly. It could be as simple as "stable rustfmt requires --force to run because it's been deprecated", but more helpful error messages would be a great thing here.

Re:Elixir at PagerDuty by steveklabnik on Friday June 15, 2018 @04:02PM (#17323060)
What happens if you uninstall the rustfmt-nightly and use the component instead?

(TryFrom is being stabilized fairly soon, it got caught up in some silly stuff but is basically good to go)

Re:Elixir at PagerDuty by inferiorhuman on Friday June 15, 2018 @09:41PM (#17325288)
So on the mac, something's going on and even with LIBCLANG_PATH set I'm still getting a segfault in some clang stuff. On the BSD box, rustfmt-nightly allows everything to work. Using `cargo install --force rustfmt` will provoke bindgen into reporting an internal error:

Custom { kind: Other, error: StringError("Internal rustfmt error") }

I get the same results if I call the bindgen executable or have build.rs call the bindgen API. I've stuck with having build.rs call the bindgen executable because if I use the bindgen API, compilation is SLOW.

Re:Elixir at PagerDuty by steveklabnik on Friday June 15, 2018 @10:22PM (#17325446)
Not cargo install, the

    rustup component add rustfmt-preview
Re:Elixir at PagerDuty by inferiorhuman on Saturday June 16, 2018 @07:15PM (#17330017)
Results:

  $ cargo uninstall rustfmt && rustup component add rustfmt-preview
      Removing /home/alex/.cargo/bin/cargo-fmt
      Removing /home/alex/.cargo/bin/rustfmt
  info: downloading component 'rustfmt-preview'
  info: installing component 'rustfmt-preview'
  $ bindgen bindings.h -- -I/usr/local/include/libr > /dev/null
  Custom { kind: Other, error: StringError("Cannot find binary path") }
  $ rustc --version
  rustc 1.28.0-nightly (29f48ccf3 2018-06-03)
  $ cat bindings.h 
  #include <r_lib.h>
  #include <r_asm.h>
  #include <r_reg.h>
  #include <r_anal.h>
  #include <r_bin.h>
Re:Elixir at PagerDuty by steveklabnik on Saturday June 16, 2018 @09:18PM (#17330412)
Okay. Let’s get that bug re-opened!