[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[mosquitto-dev] How to staticly link and run Mosquitto?
|
I want a single binary, no libraries at all, and run it from a scratch
filesystem (empty except the binary and the config file, and maybe a
persistence directory). The goal is to run a minimal container image.
I'm trying to build from source like this:
make \
WITH_STATIC_LIBRARIES=no \
WITH_SHARED_LIBRARIES=no \
WITH_UNIX_SOCKETS=no \
WITH_PERSISTENCE=no \
WITH_BRIDGE=no \
WITH_TLS=no \
WITH_CJSON=no \
WITH_DOCS=no \
binary
I've disabled lots of features for now to reduce the problem as much as
possible – if it works I want to enable at least "persistence".
When I run it on a scratch filesystem, I get:
exec /mosquitto: no such file or directory
When I trace, I get these library accesses which I believe cause the
above error:
$ strace -f -t -e trace=file ./mosquitto
11:52:10 execve("./mosquitto", ["./mosquitto"], 0x7ffd5a62d960 /* 56
vars */) = 0
11:52:10 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or
directory)
11:52:10 openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
11:52:10 newfstatat(3, "", {st_mode=S_IFREG|0644, st_size=77763, ...},
AT_EMPTY_PATH) = 0
11:52:10 openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libm.so.6",
O_RDONLY|O_CLOEXEC) = 3
11:52:10 newfstatat(3, "", {st_mode=S_IFREG|0644, st_size=940560, ...},
AT_EMPTY_PATH) = 0
11:52:10 openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libc.so.6",
O_RDONLY|O_CLOEXEC) = 3
11:52:10 newfstatat(3, "", {st_mode=S_IFREG|0755, st_size=2216304, ...},
AT_EMPTY_PATH) = 0
Can someone help on what options I need to provide to the build?
Unfortunately I'm more or less still rookie with C/C++.
I've searched the documentation but could not find any info on that topic.