eclipse / mosquitto

Eclipse Mosquitto - An open source MQTT broker
https://mosquitto.org
Other
8.62k stars 2.33k forks source link

config.mk: fix adns build with glibc >= 2.35 #2986

Open ffontaine opened 5 months ago

ffontaine commented 5 months ago

libanl is not built since glibc 2.35 and https://github.com/bminor/glibc/commit/737e873b305d8a2d925a8e346b84910eae5a39b3 resulting in the following build failure:

/home/autobuild/autobuild/instance-15/output-1/host/lib/gcc/or1k-buildroot-linux-gnu/12.3.0/../../../../or1k-buildroot-linux-gnu/bin/ld: cannot find -lanl: No such file or directory

So do not hardcode -lanl in config.mk as anl is already added if needed in src/CMakeLists.txt since https://github.com/eclipse/mosquitto/commit/8406c08124a6984053c95b41cceff87878278a32

Fixes:

tpetazzoni commented 4 months ago

Thanks @ffontaine for reporting the issue, which we also investigated today. However I think your patch is not completely correct, as it would break the build for toolchains older than glibc 2.35, for which getaddrinfo_a is in the separate libanl.so library.

Also, your sentence "So do not hardcode -lanl in config.mk as anl is already added if needed in src/CMakeLists.txt since https://github.com/eclipse/mosquitto/commit/8406c08124a6984053c95b41cceff87878278a32" is quite confusing. Indeed, there's no relationship between config.mk and CMakeLists.txt.

In addition, the CMakeLists.txt also get it wrong: it only checks for getaddrinfo_a in the anl library. But in fact, now getaddrinfo_a is available directly in the C library itself. So the CMakeLists.txt should check in C library first, then in libanl, and if not disable adns support.