skade / leveldb-sys

MIT License
7 stars 15 forks source link

Use predictable CMake LIBDIR #17

Closed michaelsproul closed 3 years ago

michaelsproul commented 4 years ago

When compiling leveldb-sys on an RPM-based distro (Amazon Linux), I encountered a linking issue where rustc couldn't find the static libraries. Running with cargo build -v revealed that rustc was looking in target/debug/build/leveldb-sys-c386c93bc8ab6af5/out/lib, while the actual libraries had been placed in target/debug/build/leveldb-sys-c386c93bc8ab6af5/out/lib64 (i.e. lib64 instead of lib).

In an attempt to fix the issue in a portable way, I've modified build.rs so that it defines CMAKE_INSTALL_LIBDIR when invoking CMake, causing it to always output the lib archives in a predictable location (i.e. always lib). I've tested this change on Amazon Linux, Ubuntu 20.04 and macOS 10.15 and it works on all of them.

PS: I noticed that the commit for v2.0.6 isn't on master; this PR targets master but I'm happy to rebase as necessary

skade commented 3 years ago

Thanks, I released this as 2.0.7.

2.0.6 not being tagged is an annoying fault on my side. The only commit missing is the bump and and tag commit.

michaelsproul commented 3 years ago

Thanks!