0001-configure.ac-use-pkg-config-to-find-netfilter_conntr.patch 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. From b3c61360a93b7f08fc9c33526056211408301ea9 Mon Sep 17 00:00:00 2001
  2. From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  3. Date: Mon, 23 Nov 2020 21:16:38 +0100
  4. Subject: [PATCH] configure.ac: use pkg-config to find netfilter_conntrack
  5. Use pkg-config to retrieve the dependencies of netfilter_conntrack
  6. and avoid the following build failure when building statically:
  7. configure:13096: /data/buildroot-test/instance-1/output-1/host/bin/x86_64-linux-gcc -o conftest -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -static -I/data/buildroot-test/instance-1/output-1/host/x86_64-buildroot-linux-uclibc/sysroot/usr/include -DPCRE_STATIC -pthread -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -static -L/data/buildroot-test/instance-1/output-1/host/x86_64-buildroot-linux-uclibc/sysroot/usr/lib conftest.c -lnetfilter_conntrack -lnfnetlink -lev -lcares -lsodium -lmbedcrypto -lpcre >&5
  8. /data/buildroot-test/instance-1/output-1/host/opt/ext-toolchain/bin/../lib/gcc/x86_64-buildroot-linux-uclibc/8.3.0/../../../../x86_64-buildroot-linux-uclibc/bin/ld: /data/buildroot-test/instance-1/output-1/host/x86_64-buildroot-linux-uclibc/sysroot/usr/lib/libnetfilter_conntrack.a(api.o): in function `nfct_fill_hdr.constprop.4':
  9. api.c:(.text+0x3f): undefined reference to `mnl_nlmsg_put_header'
  10. Fixes:
  11. - http://autobuild.buildroot.org/results/6cad497a7ab941a0ee3fd7007defc81e30cdcbe0
  12. Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  13. [Upstream status:
  14. https://github.com/shadowsocks/shadowsocks-libev/pull/2773]
  15. ---
  16. configure.ac | 5 +++--
  17. src/Makefile.am | 2 +-
  18. 2 files changed, 4 insertions(+), 3 deletions(-)
  19. diff --git a/configure.ac b/configure.ac
  20. index 9787bc2..207c041 100755
  21. --- a/configure.ac
  22. +++ b/configure.ac
  23. @@ -252,7 +252,8 @@ AC_ARG_ENABLE(connmarktos,
  24. if test x"$enable_connmarktos" = "xyes" ; then
  25. AC_MSG_NOTICE([Linux Netfilter Conntrack support requested by --enable-connmarktos: ${enable_connmarktos}])
  26. if test "x$enable_connmarktos" != "xno"; then
  27. - AC_SEARCH_LIBS([nfct_query], [netfilter_conntrack],,[
  28. + PKG_CHECK_MODULES([NETFILTER_CONNTRACK], [libnetfilter_conntrack],,
  29. + [AC_SEARCH_LIBS([nfct_query], [netfilter_conntrack],,[
  30. if test x"$enable_connmarktos" = "xyes"; then
  31. AC_MSG_ERROR([--enable-connmarktos specified but libnetfilter-conntrack library not found])
  32. fi
  33. @@ -262,7 +263,7 @@ if test x"$enable_connmarktos" = "xyes" ; then
  34. if test x"$enable_connmarktos" = "xyes"; then
  35. AC_MSG_ERROR([--enable-connmarktos specified but libnetfilter-conntrack headers not found])
  36. fi
  37. - with_netfilter_conntrack=no])
  38. + with_netfilter_conntrack=no])])
  39. # If nothing is broken; enable the libraries usage.
  40. if test "x$with_netfilter_conntrack" != "xno"; then
  41. with_netfilter_conntrack=yes
  42. diff --git a/src/Makefile.am b/src/Makefile.am
  43. index c261ed0..b81ced7 100644
  44. --- a/src/Makefile.am
  45. +++ b/src/Makefile.am
  46. @@ -9,7 +9,7 @@ AM_CFLAGS += -I$(top_srcdir)/libcork/include
  47. endif
  48. AM_CFLAGS += $(LIBPCRE_CFLAGS)
  49. -SS_COMMON_LIBS = $(INET_NTOP_LIB) $(LIBPCRE_LIBS)
  50. +SS_COMMON_LIBS = $(INET_NTOP_LIB) $(LIBPCRE_LIBS) $(NETFILTER_CONNTRACK_LIBS)
  51. if !USE_SYSTEM_SHARED_LIB
  52. SS_COMMON_LIBS += $(top_builddir)/libbloom/libbloom.la \
  53. $(top_builddir)/libipset/libipset.la \
  54. --
  55. 2.29.2