meilisearch / heed

A fully typed LMDB wrapper with minimum overhead 🐦
https://docs.rs/heed
MIT License
519 stars 52 forks source link

Question: does the build executable binary rely on a dynamic linked liblmdb library? #253

Closed linrongbin16 closed 3 months ago

linrongbin16 commented 3 months ago

Hi, I just want to confirm, when using this library in a single-binary rust project.

Does the final built executable binary rely on a dynamic linked liblmdb library?

Because usually in C/C++ project, this will happen, I'm not quite sure about the cargo build behavior.

I found that cargo build will by default build a static executable (except the glibc on linux, and the crt runtime on Windows), but how about third party C source code like the lmdb-master-sys in this project?

nolanderc commented 3 months ago

You can easily check using ldd:

$ ldd target/release/<your-executable>
    linux-vdso.so.1 (0x00007ffddbd24000)
    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fd87bcd4000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fd87b915000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fd87b600000)
    /lib64/ld-linux-x86-64.so.2 (0x00007fd87bd10000)

There is no reference to libmdb, so it is statically linked (except libc and co.)

linrongbin16 commented 3 months ago

Thank you!