Skip to content

Commit

Permalink
backport patch that avoids unnecessary static libs in DLL build
Browse files Browse the repository at this point in the history
  • Loading branch information
h-vetinari committed Aug 8, 2022
1 parent 313c553 commit 01dd753
Show file tree
Hide file tree
Showing 7 changed files with 296 additions and 8 deletions.
3 changes: 3 additions & 0 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ source:
- patches/0002-fix-for-linking-to-the-CoreFoundation-framework-on-O.patch
- patches/0003-remove-ignore-4221-from-ABSL_MSVC_LINKOPTS.patch
- patches/0004-add-missing-osx-workaround.patch
# backport of https://github.com/abseil/abseil-cpp/pull/1115 (two commits)
- patches/0005-alphabetize-ABSL_INTERNAL_DLL_TARGETS.patch
- patches/0006-avoid-building-static-libs-on-windows-when-BUILD_SHA.patch

build:
number: 0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 336f3e70a058f6b07aa25725ea2a23a739f190ef Mon Sep 17 00:00:00 2001
From: Francesco Biscani <[email protected]>
Date: Sat, 21 Sep 2019 15:05:46 +0200
Subject: [PATCH 1/4] patch out the build issue on clang4 osx
Subject: [PATCH 1/6] patch out the build issue on clang4 osx

---
absl/time/internal/cctz/include/cctz/civil_time_detail.h | 4 ++++
Expand All @@ -23,5 +23,5 @@ index a5b084e6..0a9a4389 100644
#include <limits>
#include <ostream>
--
2.35.3.windows.1
2.37.0.windows.1

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From a99ff2d64fb489dfc207572edb2d8a151d3c92f9 Mon Sep 17 00:00:00 2001
From: Francesco Biscani <[email protected]>
Date: Sat, 21 Sep 2019 21:39:26 +0200
Subject: [PATCH 2/4] fix for linking to the CoreFoundation framework on OSX
Subject: [PATCH 2/6] fix for linking to the CoreFoundation framework on OSX

---
absl/time/CMakeLists.txt | 6 ++++--
Expand All @@ -27,5 +27,5 @@ index debab3ba..4eb9ebf8 100644
absl_cc_library(
NAME
--
2.35.3.windows.1
2.37.0.windows.1

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 1a77917fe7c5c3feece1a608d5537f848f4e930f Mon Sep 17 00:00:00 2001
From: "Uwe L. Korn" <[email protected]>
Date: Thu, 30 Jul 2020 13:01:32 +0200
Subject: [PATCH 3/4] remove "-ignore:4221" from ABSL_MSVC_LINKOPTS
Subject: [PATCH 3/6] remove "-ignore:4221" from ABSL_MSVC_LINKOPTS

see also https://github.com/microsoft/vcpkg/issues/13945
---
Expand Down Expand Up @@ -41,5 +41,5 @@ index 0d6c1ec3..8df92751 100644
# Standard). These flags are used for detecting whether or not the target
# architecture has hardware support for AES instructions which can be used
--
2.35.3.windows.1
2.37.0.windows.1

4 changes: 2 additions & 2 deletions recipe/patches/0004-add-missing-osx-workaround.patch
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 3b5f3943a593d5c7544b594d0bd6eec569d26067 Mon Sep 17 00:00:00 2001
From: "H. Vetinari" <[email protected]>
Date: Fri, 1 Jul 2022 13:37:17 +0200
Subject: [PATCH 4/4] add missing osx workaround
Subject: [PATCH 4/6] add missing osx workaround

---
absl/debugging/internal/examine_stack.cc | 4 ++++
Expand All @@ -23,5 +23,5 @@ index 5bdd341e..e86f384f 100644
#include <sys/ucontext.h>
#endif
--
2.35.3.windows.1
2.37.0.windows.1

224 changes: 224 additions & 0 deletions recipe/patches/0005-alphabetize-ABSL_INTERNAL_DLL_TARGETS.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,224 @@
From fa9d0f4abb4c4a3112e2c1faa3138206354bd6c4 Mon Sep 17 00:00:00 2001
From: "H. Vetinari" <[email protected]>
Date: Wed, 2 Mar 2022 08:07:20 +1100
Subject: [PATCH 5/6] alphabetize ABSL_INTERNAL_DLL_TARGETS

this is a pure reshuffle; no additions/deletions
---
CMake/AbseilDll.cmake | 172 +++++++++++++++++++++---------------------
1 file changed, 86 insertions(+), 86 deletions(-)

diff --git a/CMake/AbseilDll.cmake b/CMake/AbseilDll.cmake
index 00cddb84..5638ed66 100644
--- a/CMake/AbseilDll.cmake
+++ b/CMake/AbseilDll.cmake
@@ -353,120 +353,120 @@ set(ABSL_INTERNAL_DLL_FILES
)

set(ABSL_INTERNAL_DLL_TARGETS
- "stacktrace"
- "symbolize"
- "examine_stack"
- "failure_signal_handler"
- "debugging_internal"
- "demangle_internal"
- "leak_check"
- "stack_consumption"
- "debugging"
- "hash"
- "spy_hash_state"
- "city"
- "memory"
- "strings"
- "strings_internal"
- "cord"
- "str_format"
- "str_format_internal"
- "pow10_helper"
- "int128"
- "numeric"
- "utility"
+ "algorithm"
+ "algorithm_container"
"any"
+ "any_invocable"
+ "atomic_hook"
"bad_any_cast"
"bad_any_cast_impl"
- "span"
- "optional"
"bad_optional_access"
"bad_variant_access"
- "variant"
- "compare"
- "algorithm"
- "algorithm_container"
- "graphcycles_internal"
- "kernel_timeout_internal"
- "synchronization"
- "thread_pool"
- "any_invocable"
+ "base"
+ "base_internal"
"bind_front"
- "function_ref"
- "atomic_hook"
- "log_severity"
- "raw_logging_internal"
- "spinlock_wait"
+ "bits"
+ "btree"
+ "city"
+ "civil_time"
+ "compare"
+ "compressed_tuple"
"config"
- "dynamic_annotations"
+ "container"
+ "container_common"
+ "container_memory"
+ "cord"
"core_headers"
- "malloc_internal"
- "base_internal"
- "base"
- "throw_delegate"
- "pretty_function"
+ "counting_allocator"
+ "debugging"
+ "debugging_internal"
+ "demangle_internal"
+ "dynamic_annotations"
"endian"
- "bits"
+ "examine_stack"
"exponential_biased"
- "periodic_sampler"
- "scoped_set_env"
- "type_traits"
+ "failure_signal_handler"
+ "fixed_array"
+ "flat_hash_map"
+ "flat_hash_set"
+ "function_ref"
+ "graphcycles_internal"
+ "hash"
+ "hash_function_defaults"
+ "hash_policy_traits"
+ "hashtable_debug"
+ "hashtable_debug_hooks"
+ "hashtablez_sampler"
+ "inlined_vector"
+ "inlined_vector_internal"
+ "int128"
+ "kernel_timeout_internal"
+ "layout"
+ "leak_check"
+ "log_severity"
+ "malloc_internal"
+ "memory"
"meta"
- "random_random"
+ "node_hash_map"
+ "node_hash_set"
+ "node_slot_policy"
+ "numeric"
+ "optional"
+ "periodic_sampler"
+ "pow10_helper"
+ "pretty_function"
"random_bit_gen_ref"
"random_distributions"
- "random_seed_gen_exception"
- "random_seed_sequences"
- "random_internal_traits"
"random_internal_distribution_caller"
"random_internal_distributions"
- "random_internal_fast_uniform_bits"
- "random_internal_seed_material"
- "random_internal_pool_urbg"
"random_internal_explicit_seed_seq"
- "random_internal_sequence_urbg"
- "random_internal_salted_seed_seq"
- "random_internal_iostream_state_saver"
- "random_internal_generate_real"
- "random_internal_wide_multiply"
+ "random_internal_fast_uniform_bits"
"random_internal_fastmath"
+ "random_internal_generate_real"
+ "random_internal_iostream_state_saver"
"random_internal_nonsecure_base"
"random_internal_pcg_engine"
- "random_internal_randen_engine"
"random_internal_platform"
+ "random_internal_pool_urbg"
"random_internal_randen"
- "random_internal_randen_slow"
+ "random_internal_randen_engine"
"random_internal_randen_hwaes"
"random_internal_randen_hwaes_impl"
+ "random_internal_randen_slow"
+ "random_internal_salted_seed_seq"
+ "random_internal_seed_material"
+ "random_internal_sequence_urbg"
+ "random_internal_traits"
"random_internal_uniform_helper"
+ "random_internal_wide_multiply"
+ "random_random"
+ "random_seed_gen_exception"
+ "random_seed_sequences"
+ "raw_hash_map"
+ "raw_hash_set"
+ "raw_logging_internal"
+ "sample_recorder"
+ "scoped_set_env"
+ "span"
+ "spinlock_wait"
+ "spy_hash_state"
+ "stack_consumption"
+ "stacktrace"
"status"
+ "str_format"
+ "str_format_internal"
+ "strings"
+ "strings_internal"
+ "symbolize"
+ "synchronization"
+ "thread_pool"
+ "throw_delegate"
"time"
- "civil_time"
"time_zone"
- "container"
- "btree"
- "compressed_tuple"
- "fixed_array"
- "inlined_vector_internal"
- "inlined_vector"
- "counting_allocator"
- "flat_hash_map"
- "flat_hash_set"
- "node_hash_map"
- "node_hash_set"
- "container_memory"
- "hash_function_defaults"
- "hash_policy_traits"
- "hashtablez_sampler"
- "hashtable_debug"
- "hashtable_debug_hooks"
- "node_slot_policy"
- "raw_hash_map"
- "container_common"
- "raw_hash_set"
- "layout"
"tracked"
- "sample_recorder"
+ "type_traits"
+ "utility"
+ "variant"
)

function(absl_internal_dll_contains)
--
2.37.0.windows.1

Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
From 5b0225562085b17749a04a57cd6e89e8926c7053 Mon Sep 17 00:00:00 2001
From: "H. Vetinari" <[email protected]>
Date: Wed, 2 Mar 2022 13:43:37 +1100
Subject: [PATCH 6/6] avoid building static libs on windows when
BUILD_SHARED_LIBS=ON

except all flags_* libraries, for which DLL builds on windows
are not supported

To do this, expand list of ABSL_INTERNAL_DLL_TARGETS; this
is due to how the logic of absl_internal_dll_contains checks
whether additional static libraries should be built, compare
https://github.com/abseil/abseil-cpp/blob/20211102.0/CMake/AbseilHelpers.cmake#L112-L132
---
CMake/AbseilDll.cmake | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/CMake/AbseilDll.cmake b/CMake/AbseilDll.cmake
index 5638ed66..b9a3664b 100644
--- a/CMake/AbseilDll.cmake
+++ b/CMake/AbseilDll.cmake
@@ -376,6 +376,11 @@ set(ABSL_INTERNAL_DLL_TARGETS
"container_common"
"container_memory"
"cord"
+ "cord_internal"
+ "cordz_functions"
+ "cordz_handle"
+ "cordz_info"
+ "cordz_sample_token"
"core_headers"
"counting_allocator"
"debugging"
@@ -404,6 +409,7 @@ set(ABSL_INTERNAL_DLL_TARGETS
"layout"
"leak_check"
"log_severity"
+ "low_level_hash"
"malloc_internal"
"memory"
"meta"
@@ -418,6 +424,7 @@ set(ABSL_INTERNAL_DLL_TARGETS
"random_bit_gen_ref"
"random_distributions"
"random_internal_distribution_caller"
+ "random_internal_distribution_test_util"
"random_internal_distributions"
"random_internal_explicit_seed_seq"
"random_internal_fast_uniform_bits"
@@ -453,6 +460,8 @@ set(ABSL_INTERNAL_DLL_TARGETS
"stack_consumption"
"stacktrace"
"status"
+ "statusor"
+ "strerror"
"str_format"
"str_format_internal"
"strings"
--
2.37.0.windows.1

0 comments on commit 01dd753

Please sign in to comment.