summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorSamuli Piippo <samuli.piippo@qt.io>2023-05-19 09:48:59 +0300
committerThiago Macieira <thiago.macieira@intel.com>2023-05-26 06:46:30 -0700
commit4a46ba1209907796f4a14f6feb35ed4d70155d7d (patch)
tree02f6253d40d9d8fab61a95e00b08b6f2ad77a3c9 /cmake
parent2794742facb103b9a5aae043391a892d4327f2b1 (diff)
network: fix link issue with older libc
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 <thiago.macieira@intel.com> Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/FindWrapResolv.cmake12
1 files changed, 8 insertions, 4 deletions
diff --git a/cmake/FindWrapResolv.cmake b/cmake/FindWrapResolv.cmake
index 9720c96c00..a0d1e7864c 100644
--- a/cmake/FindWrapResolv.cmake
+++ b/cmake/FindWrapResolv.cmake
@@ -29,15 +29,19 @@ check_cxx_source_compiles("
#include <netinet/in.h>
#include <resolv.h>
-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)