I need to build a C binding with -fPIC flags passed to the C compiler. Setting CFLAGS has no visible effect, I've managed to do some acrobatic tricks to edit Makefile on the fly, but that's a way to proof setup, not a way to do builds.
After some search, I could not find anything useful. But there should be the way!
How are you invoking the C build from your build.rs?
It's invoked somehow from the third-party library. I've found that it was my mistake, source is C++, so CXXFLAGS worked just fine.
Now I'd like to find out how do I make Rust always build C/C++ sources with -fPIC without setting a variable.
It's a libdb-sys used from libdb.
libdb-sys crate will need to provide some mechanism that you can use. It's not possible to do anything from your crate because by the time your build script is run, your dependency will have already been compiled.
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.