I’m the author of the (spatialite-sys)[https://gitlab.com/ndarilek/spatialite-sys] crate. As far as I know, I’m its only consumer, and until recently I’ve been building all necessary dependencies with a build.sh that dumps everything in a shared prefix, then makes that prefix available to my dependent program’s build phase. Yesterday I decided to vendor a whole bunch of dependencies and invoke autotools from the build.rs, thus moving the build process into something managed by Cargo.
If I check out the crate and run
cargo build, everything works. If I depend on the crate externally, however, I get:
= note: /home/nolan/Projects/Waynav/Engine/target/debug/deps/libspatialite_sys-7559e698af999ec9.rlib(libgeos_c_la-geos_ts_c.o): In function `void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char const*>(char const*, char const*, std::forward_iterator_tag) [clone .isra.99]': /usr/include/c++/7/bits/basic_string.tcc:219: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_create(unsigned long&, unsigned long)' /usr/include/c++/7/bits/basic_string.tcc:212: undefined reference to `std::__throw_logic_error(char const*)' ... (Lots of similar errors omitted)
One of my dependencies is geos, which is a C++ library. I’m guessing based on these errors that I have to link against C++'s STL somehow? If so, any pointers on how to do that? Guessing I need to add some incantation to build.rs, but I’m not sure what that’d be in the case of statically linking in the C++ STL.
I did a bit of googling on the subject, and read some things about setting my crate type. Do I need to do that in this case? I’m not building an external library to be consumed from other C/C++ code, just a convenience crate for making SpatiaLite initializers and functions available from Rust-hosted SQLite databases.
Thanks for any help.