From 4a46ba1209907796f4a14f6feb35ed4d70155d7d Mon Sep 17 00:00:00 2001 From: Samuli Piippo Date: Fri, 19 May 2023 09:48:59 +0300 Subject: [PATCH] network: fix link issue with older libc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Amend 68b625901f9eb7c34e3d7aa302e1c0a454d3190b and fix link issue with slightly less modern libc/libresolv where not all functions have been moved over to libc. ld: src/network/CMakeFiles/Network.dir/kernel/qdnslookup_unix.cpp.o: in function `QDnsLookupRunnable::query(QDnsLookupReply*)': qdnslookup_unix.cpp:(.text+0x183): undefined reference to `__res_nquery' ld: qdnslookup_unix.cpp:(.text+0x437): undefined reference to `__dn_expand' ld: qdnslookup_unix.cpp:(.text+0x621): undefined reference to `__dn_expand' ld: qdnslookup_unix.cpp:(.text+0x8ff): undefined reference to `__res_nquery' ld: qdnslookup_unix.cpp:(.text+0xbd7): undefined reference to `__dn_expand' ld: qdnslookup_unix.cpp:(.text+0xd7f): undefined reference to `__dn_expand' ld: qdnslookup_unix.cpp:(.text+0xf4f): undefined reference to `__dn_expand' ld: qdnslookup_unix.cpp:(.text+0x10fa): undefined reference to `__dn_expand' ld: qdnslookup_unix.cpp:(.text+0x131c): undefined reference to `__dn_expand' collect2: error: ld returned 1 exit status Change-Id: If81b292222c78d828b9fef61f30a62f1d584c183 Reviewed-by: Thiago Macieira Reviewed-by: MÃ¥rten Nordheim --- cmake/FindWrapResolv.cmake | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/cmake/FindWrapResolv.cmake b/cmake/FindWrapResolv.cmake index 9720c96c00b..a0d1e7864ce 100644 --- a/cmake/FindWrapResolv.cmake +++ b/cmake/FindWrapResolv.cmake @@ -29,15 +29,19 @@ check_cxx_source_compiles(" #include #include -int main(int, char **) +int main(int, char **argv) { - res_init(); + res_state statep; + int n = res_nmkquery(statep, 0, argv[1], 0, 0, NULL, 0, NULL, NULL, 0); + n = res_nsend(statep, NULL, 0, NULL, 0); + n = dn_expand(NULL, NULL, NULL, NULL, 0); + return n; } -" HAVE_RES_INIT) +" HAVE_LIBRESOLV_FUNCTIONS) cmake_pop_check_state() -if(HAVE_RES_INIT) +if(HAVE_LIBRESOLV_FUNCTIONS) set(WrapResolv_FOUND ON) add_library(WrapResolv::WrapResolv INTERFACE IMPORTED) if(LIBRESOLV)