Can't `liblmdb` be linked statically?
Closed this issue · 2 comments
I've taken a look at the FreeBSD port of monero-cli
and recognized that it replaces /usr/local/lib/liblmdb.so
with it's own library during the process of installation. Then I went a bit deeper and found the next comment:
monero/external/db_drivers/CMakeLists.txt
Line 29 in caa62bc
The full text of that comment is:
# We aren't even going to check the system for an installed LMDB driver, as it is too
# critical a consensus component to rely on dynamically linked libraries
The problem is obvious, monero-cli
just replaces the existing library silently.
If this library is too critical, why not to link it statically? If it isn't possible for some reason, why not to place it somewhere else?
Even more, monero-cli
never knows if this library will be replaced in the future. So if liblmdb.so
is too critical, maybe it's still better to link it statically?
If the problem is just the lack of free time, I can do it myself and send you a pull request.
Is this in regards to the FreeBSD port, or monero's own CMake file?
We don't have an install target and we do already statically link lmdb, but maybe I'm misunderstanding something.
If the issue is purely in regards to the FreeBSD port, it should be reported to the maintainer.
Hi @selsta and many thanks for the quick reply. I didn't know you're already linking it statically.
I'm working on FreeBSD port of monero-gui
and it works just perfectly. The only problem is the process of installation. As I mentioned before, it attempts to replace /usr/local/lib/liblmdb.so
.
I still don't have a firm idea what's the reason and I would really appreciate any help. For now I see the next line:
which seems to be the reason. But I'm not sure.Or, since you already link it statically, maybe I'm missing some CMake arguments and it still attempts to link it dynamically. At least for monero-gui
.
Anyway thank you for the information. Since I know it must be linked statically, I'm able to do more research to solve the problem by myself.