mqtt-users team mailing list archive
-
mqtt-users team
-
Mailing list archive
-
Message #00026
Re: undefined reference to `be64toh'
Hi Diogo,
> /root/mosquitto-0.9/src/persist.c:472: undefined reference to `be64toh'
> /root/mosquitto-0.9/src/persist.c:306: undefined reference to `htobe64'
The be64toh() and htobe64() functions are in glibc from version 2.9.
If you have an earlier version or nslu2 uses one of the other C
libraries (which is quite likely), then those functions aren't
available.
The functions are used when writing out the persistent database, which
stores subscriptions and retained messages for when the broker
restarts. This is generally regarded as a good and useful thing.
You've got three choices.
1. Uncomment the line "#define WITH_32BIT_DBID" in config.h and
recompile. This means:
Compile with 32-bit integer database IDs instead of 64-bit integers.
May be useful in embedded systems or where be64toh()/htobe64() aren't
available. There is the potential for bad things to happen after the
IDs wrap around. This is especially likely if there are old retained
messages. Note that at a sustained rate of 10,000 messages/s, the
database ID would overflow every 5 days. It is also worth noting that
a broker compiled with 64-bit DB IDs will not load a persistent
database file saved from a 32-bit DB ID broker and vice versa.
2. Remove persistent database support completely by commenting out the
line "#define WITH_PERSISTENCE" in config.h, then recompile. This will
keep using 64-bit database IDs, but won't be writing them to disk at
any time so won't need the missing functions.
3. Don't worry about the portability of the persistent database file.
If the file isn't going to move to a different computer, it doesn't
matter if the data is potentially stored with mixed endian.To do this,
add the following to config.h and recompile.
#define be64toh(x) (x)
#define htobe64(x) (x)
I'd probably go for option 3.
It might be worth your while looking at some of the other options in
config.h - unless you've been using mosquitto before you won't have
any of the old sqlite dbs that need upgrading. You can comment out
WITH_SQLITE_UPGRADE and remove "-lsqlite3" from config.mk to save on a
bit of memory.
Cheers,
Roger
Follow ups
References