You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It took me a long time to get the "snappy" example, included in the FFI section, working on my machine. As it turned out, I needed several options in a build.rs file--one of which I didn't find until I stumbled across the rust-snappy repository.
Namely, I needed the following build.rs file:
fnmain(){println!("cargo:rustc-link-search=native=/path/to/snappy/");println!("cargo:rustc-link-lib=static=snappy");println!("cargo:include=/path/to/snappy/");// Need to link C with C++ filesprintln!("cargo:rustc-link-lib=stdc++");}
This is never mentioned in the FFI section, and it was a bit frustrating. I've seen it mentioned several places that it's "easy to call C from Rust", and I think giving people everything they need to know to be successful in the Rustonomicon would help make that even more true.
In addition, specifically mentioning the necessity of the stcd++ library for linking to C wrappers around C++ libraries would be great. I'm sure a lot of people are already familiar with that concept, but many others (myself included) don't know about it and would need a lot of trial and error to get that to work.
Do others agree? I'm willing to attempt a write-up if I could get some feedback on where it would be appropriate to include. My thought is to put it near the beginning so that people can get a working example from the beginning, but I'm probably biased since I just went through the experience of being confused.
The text was updated successfully, but these errors were encountered:
It took me a long time to get the "snappy" example, included in the FFI section, working on my machine. As it turned out, I needed several options in a
build.rs
file--one of which I didn't find until I stumbled across the rust-snappy repository.Namely, I needed the following
build.rs
file:This is never mentioned in the FFI section, and it was a bit frustrating. I've seen it mentioned several places that it's "easy to call C from Rust", and I think giving people everything they need to know to be successful in the Rustonomicon would help make that even more true.
In addition, specifically mentioning the necessity of the
stcd++
library for linking to C wrappers around C++ libraries would be great. I'm sure a lot of people are already familiar with that concept, but many others (myself included) don't know about it and would need a lot of trial and error to get that to work.Do others agree? I'm willing to attempt a write-up if I could get some feedback on where it would be appropriate to include. My thought is to put it near the beginning so that people can get a working example from the beginning, but I'm probably biased since I just went through the experience of being confused.
The text was updated successfully, but these errors were encountered: