0001-Fix-static-linking-with-OpenSSL.patch 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. From ba6b8ee5b6dee19493a150c3715b0e202440d206 Mon Sep 17 00:00:00 2001
  2. From: Bernd Kuhls <bernd.kuhls@t-online.de>
  3. Date: Thu, 24 Jan 2019 18:19:51 +0100
  4. Subject: [PATCH] Fix static linking with OpenSSL
  5. Adjust link order of libz to solve bug with static linking
  6. and remove host paths when looking for openssl.
  7. [Vincent:
  8. - Adapt the patch to make it apply on the new version.]
  9. [Bernd: rebased for tor-0.2.7.6, 0.2.8.10, 0.2.9.9, 0.3.1.7, 0.3.2.10,
  10. 0.3.4.8, 0.3.5.7 & 0.4.4.5]
  11. [Fabrice: fix detection of openssl functions in 0.3.5.8]
  12. Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
  13. Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
  14. Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  15. ---
  16. acinclude.m4 | 2 +-
  17. configure.ac | 4 ++--
  18. src/test/include.am | 8 ++++----
  19. src/tools/include.am | 4 ++--
  20. 4 files changed, 9 insertions(+), 9 deletions(-)
  21. diff --git a/acinclude.m4 b/acinclude.m4
  22. index 5ecdf1d5c..be5633f4f 100644
  23. --- a/acinclude.m4
  24. +++ b/acinclude.m4
  25. @@ -166,7 +166,7 @@ AC_CACHE_CHECK([for $1 directory], tor_cv_library_$1_dir, [
  26. for tor_trydir in "$try$1dir" "(system)" "$prefix" /usr/local /usr/pkg $8; do
  27. LDFLAGS="$tor_saved_LDFLAGS"
  28. - LIBS="$tor_saved_LIBS $3"
  29. + LIBS="$3 $tor_saved_LIBS"
  30. CPPFLAGS="$tor_saved_CPPFLAGS"
  31. if test -z "$tor_trydir" ; then
  32. diff --git a/configure.ac b/configure.ac
  33. index 05e1392cf..580befa6b 100644
  34. --- a/configure.ac
  35. +++ b/configure.ac
  36. @@ -973,7 +973,7 @@ AC_ARG_WITH(ssl-dir,
  37. ])
  38. AC_MSG_NOTICE([Now, we'll look for OpenSSL >= 1.0.1])
  39. -TOR_SEARCH_LIBRARY(openssl, $tryssldir, [-lssl -lcrypto $TOR_LIB_GDI $TOR_LIB_WS32],
  40. +TOR_SEARCH_LIBRARY(openssl, $tryssldir, [-lssl -lcrypto -lz $TOR_LIB_GDI $TOR_LIB_WS32],
  41. [#include <openssl/ssl.h>
  42. char *getenv(const char *);],
  43. [struct ssl_cipher_st;
  44. @@ -1005,7 +1005,7 @@ dnl Now check for particular openssl functions.
  45. save_LIBS="$LIBS"
  46. save_LDFLAGS="$LDFLAGS"
  47. save_CPPFLAGS="$CPPFLAGS"
  48. -LIBS="$TOR_OPENSSL_LIBS $LIBS"
  49. +LIBS="$TOR_OPENSSL_LIBS -lz $LIBS"
  50. LDFLAGS="$TOR_LDFLAGS_openssl $LDFLAGS"
  51. CPPFLAGS="$TOR_CPPFLAGS_openssl $CPPFLAGS"
  52. diff --git a/src/test/include.am b/src/test/include.am
  53. index ecb768957..39a622e88 100644
  54. --- a/src/test/include.am
  55. +++ b/src/test/include.am
  56. @@ -400,8 +400,8 @@ src_test_test_ntor_cl_LDFLAGS = @TOR_LDFLAGS_zlib@ $(TOR_LDFLAGS_CRYPTLIB)
  57. src_test_test_ntor_cl_LDADD = \
  58. $(TOR_INTERNAL_LIBS) \
  59. $(rust_ldadd) \
  60. - @TOR_ZLIB_LIBS@ @TOR_LIB_MATH@ \
  61. - $(TOR_LIBS_CRYPTLIB) @TOR_LIB_WS32@ @TOR_LIB_IPHLPAPI@ @TOR_LIB_GDI@ @TOR_LIB_USERENV@ \
  62. + @TOR_LIB_MATH@ \
  63. + $(TOR_LIBS_CRYPTLIB) @TOR_ZLIB_LIBS@ @TOR_LIB_WS32@ @TOR_LIB_IPHLPAPI@ @TOR_LIB_GDI@ @TOR_LIB_USERENV@ \
  64. @CURVE25519_LIBS@ @TOR_LZMA_LIBS@
  65. src_test_test_ntor_cl_AM_CPPFLAGS = \
  66. $(AM_CPPFLAGS)
  67. @@ -410,8 +410,8 @@ src_test_test_hs_ntor_cl_SOURCES = src/test/test_hs_ntor_cl.c
  68. src_test_test_hs_ntor_cl_LDFLAGS = @TOR_LDFLAGS_zlib@ $(TOR_LDFLAGS_CRYPTLIB)
  69. src_test_test_hs_ntor_cl_LDADD = \
  70. $(TOR_INTERNAL_LIBS) \
  71. - @TOR_ZLIB_LIBS@ @TOR_LIB_MATH@ \
  72. - $(TOR_LIBS_CRYPTLIB) @TOR_LIB_WS32@ @TOR_LIB_IPHLPAPI@ @TOR_LIB_GDI@ @CURVE25519_LIBS@
  73. + @TOR_LIB_MATH@ \
  74. + $(TOR_LIBS_CRYPTLIB) @TOR_ZLIB_LIBS@ @TOR_LIB_WS32@ @TOR_LIB_IPHLPAPI@ @TOR_LIB_GDI@ @CURVE25519_LIBS@
  75. src_test_test_hs_ntor_cl_AM_CPPFLAGS = \
  76. $(AM_CPPFLAGS)
  77. diff --git a/src/tools/include.am b/src/tools/include.am
  78. index f7aa7e0d1..4c4e8aa7a 100644
  79. --- a/src/tools/include.am
  80. +++ b/src/tools/include.am
  81. @@ -35,7 +35,7 @@ src_tools_tor_gencert_LDADD = \
  82. $(TOR_CRYPTO_LIBS) \
  83. $(TOR_UTIL_LIBS) \
  84. $(rust_ldadd) \
  85. - @TOR_LIB_MATH@ @TOR_ZLIB_LIBS@ $(TOR_LIBS_CRYPTLIB) \
  86. + @TOR_LIB_MATH@ $(TOR_LIBS_CRYPTLIB) @TOR_ZLIB_LIBS@ \
  87. @TOR_LIB_WS32@ @TOR_LIB_IPHLPAPI@ @TOR_LIB_GDI@ @TOR_LIB_USERENV@ @CURVE25519_LIBS@
  88. endif
  89. @@ -45,7 +45,7 @@ src_tools_tor_print_ed_signing_cert_LDADD = \
  90. src/trunnel/libor-trunnel.a \
  91. $(TOR_CRYPTO_LIBS) \
  92. $(TOR_UTIL_LIBS) \
  93. - @TOR_LIB_MATH@ $(TOR_LIBS_CRYPTLIB) \
  94. + @TOR_LIB_MATH@ $(TOR_LIBS_CRYPTLIB) @TOR_ZLIB_LIBS@ \
  95. @TOR_LIB_WS32@ @TOR_LIB_USERENV@ @TOR_LIB_GDI@
  96. if USE_NSS
  97. --
  98. 2.20.1