From ed8c29be9a0dbbbd83f39f0b6574b65b0f96b400 Mon Sep 17 00:00:00 2001 From: Ryan Lamb <4955475+kinyoklion@users.noreply.github.com> Date: Tue, 15 Aug 2023 16:21:22 -0700 Subject: [PATCH 01/10] fix: Fixes required to run with msvc 14.1 (vs2017) --- libs/common/include/launchdarkly/attributes_builder.hpp | 2 +- .../include/launchdarkly/persistence/persistence.hpp | 2 ++ libs/common/include/launchdarkly/value.hpp | 8 +++++--- libs/common/src/value.cpp | 3 +++ 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/libs/common/include/launchdarkly/attributes_builder.hpp b/libs/common/include/launchdarkly/attributes_builder.hpp index 3f959c168..025dcb602 100644 --- a/libs/common/include/launchdarkly/attributes_builder.hpp +++ b/libs/common/include/launchdarkly/attributes_builder.hpp @@ -63,7 +63,7 @@ class AttributesBuilder final { AttributesBuilder& operator=(AttributesBuilder const&) = delete; AttributesBuilder& operator=(AttributesBuilder&&) = delete; - AttributesBuilder(AttributesBuilder&& builder) noexcept = default; + AttributesBuilder(AttributesBuilder&& builder) = default; ~AttributesBuilder() = default; /** diff --git a/libs/common/include/launchdarkly/persistence/persistence.hpp b/libs/common/include/launchdarkly/persistence/persistence.hpp index 0cb027eff..6cda9802c 100644 --- a/libs/common/include/launchdarkly/persistence/persistence.hpp +++ b/libs/common/include/launchdarkly/persistence/persistence.hpp @@ -1,5 +1,7 @@ #pragma once +#include + /** * Interface for a data store that holds feature flag data and other SDK * properties in a serialized form. diff --git a/libs/common/include/launchdarkly/value.hpp b/libs/common/include/launchdarkly/value.hpp index b176d2c4e..9d3a82019 100644 --- a/libs/common/include/launchdarkly/value.hpp +++ b/libs/common/include/launchdarkly/value.hpp @@ -413,9 +413,11 @@ class Value final { enum Type type_; // Empty constants used when accessing the wrong type. - inline static const std::string empty_string_; - inline static const Array empty_vector_; - inline static const Object empty_map_; + // These are not inline static const because of this bug: + // https://developercommunity.visualstudio.com/t/inline-static-destructors-are-called-multiple-time/1157794 + static const std::string empty_string_; + static const Array empty_vector_; + static const Object empty_map_; static const Value null_value_; }; diff --git a/libs/common/src/value.cpp b/libs/common/src/value.cpp index bc28777fa..1db2b19a9 100644 --- a/libs/common/src/value.cpp +++ b/libs/common/src/value.cpp @@ -7,6 +7,9 @@ namespace launchdarkly { +const std::string Value::empty_string_; +const Value::Array Value::empty_vector_; +const Value::Object Value::empty_map_; const Value Value::null_value_; Value::Value() : type_(Value::Type::kNull), storage_{0.0} {} From b29b20f6ec3a767055cb3df1a9c0d2d3604b5b2e Mon Sep 17 00:00:00 2001 From: Ryan Lamb <4955475+kinyoklion@users.noreply.github.com> Date: Tue, 15 Aug 2023 16:22:49 -0700 Subject: [PATCH 02/10] Comment. --- libs/common/include/launchdarkly/attributes_builder.hpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libs/common/include/launchdarkly/attributes_builder.hpp b/libs/common/include/launchdarkly/attributes_builder.hpp index 025dcb602..bc0dc82c9 100644 --- a/libs/common/include/launchdarkly/attributes_builder.hpp +++ b/libs/common/include/launchdarkly/attributes_builder.hpp @@ -63,6 +63,8 @@ class AttributesBuilder final { AttributesBuilder& operator=(AttributesBuilder const&) = delete; AttributesBuilder& operator=(AttributesBuilder&&) = delete; + // This cannot be noexcept because of: + // https://developercommunity.visualstudio.com/t/bug-in-stdmapstdpair-implementation-with-move-only/840554 AttributesBuilder(AttributesBuilder&& builder) = default; ~AttributesBuilder() = default; From 576756cd12c694d18d8d4a71dd6bb155035981c3 Mon Sep 17 00:00:00 2001 From: Ryan Lamb <4955475+kinyoklion@users.noreply.github.com> Date: Tue, 15 Aug 2023 16:53:46 -0700 Subject: [PATCH 03/10] isalnum fix. --- libs/common/src/config/app_info_builder.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libs/common/src/config/app_info_builder.cpp b/libs/common/src/config/app_info_builder.cpp index 8cd6c737d..df83d2749 100644 --- a/libs/common/src/config/app_info_builder.cpp +++ b/libs/common/src/config/app_info_builder.cpp @@ -21,7 +21,13 @@ tl::expected AppInfoBuilder::Tag::Build() const { } bool ValidChar(char c) { - return std::isalnum(c) != 0 || c == '-' || c == '.' || c == '_'; + if(c > 0 && c < 255) { + // The MSVC implementation of isalnum will assert if the number it outside + // its lookup table. + // iswalnum would not, but is less restrictive than desired. + return std::isalnum(c) != 0 || c == '-' || c == '.' || c == '_'; + } + return false; } std::optional IsValidTag(std::string const& key, From 0c892eb90b461585c12e20d4218d02e922c07cd6 Mon Sep 17 00:00:00 2001 From: Ryan Lamb <4955475+kinyoklion@users.noreply.github.com> Date: Wed, 16 Aug 2023 08:50:38 -0700 Subject: [PATCH 04/10] Try manual OPENSSL_ROOT_DIR --- .github/workflows/client.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/client.yml b/.github/workflows/client.yml index dcf8bbf15..372ecaaf0 100644 --- a/.github/workflows/client.yml +++ b/.github/workflows/client.yml @@ -59,7 +59,7 @@ jobs: - uses: ilammy/msvc-dev-cmd@v1 - uses: ./.github/actions/ci env: - OPENSSL_ROOT_DIR: ${{ env.OPENSSL_ROOT_DIR }} + OPENSSL_ROOT_DIR: 'C:\ProgramFiles\OpenSSL' BOOST_LIBRARY_DIR: 'C:\local\boost_1_81_0\lib64-msvc-14.3' BOOST_LIBRARYDIR: 'C:\local\boost_1_81_0\lib64-msvc-14.3' with: From 96c060a52244aa4df77abba11440c89fad16bbd8 Mon Sep 17 00:00:00 2001 From: Ryan Lamb <4955475+kinyoklion@users.noreply.github.com> Date: Wed, 16 Aug 2023 09:07:00 -0700 Subject: [PATCH 05/10] Remove OPENSSL_ROOT_DIR for windows. --- .github/actions/client-release/action.yml | 1 - .github/workflows/client.yml | 1 - 2 files changed, 2 deletions(-) diff --git a/.github/actions/client-release/action.yml b/.github/actions/client-release/action.yml index c6084d6e1..2ee0befc3 100644 --- a/.github/actions/client-release/action.yml +++ b/.github/actions/client-release/action.yml @@ -74,7 +74,6 @@ runs: if: runner.os == 'Windows' shell: bash env: - OPENSSL_ROOT_DIR: ${{ env.OPENSSL_ROOT_DIR }} BOOST_LIBRARY_DIR: 'C:\local\boost_1_81_0\lib64-msvc-14.3' BOOST_LIBRARYDIR: 'C:\local\boost_1_81_0\lib64-msvc-14.3' BOOST_ROOT: ${{ steps.install-boost.outputs.BOOST_ROOT }} diff --git a/.github/workflows/client.yml b/.github/workflows/client.yml index 372ecaaf0..9457b8e2d 100644 --- a/.github/workflows/client.yml +++ b/.github/workflows/client.yml @@ -59,7 +59,6 @@ jobs: - uses: ilammy/msvc-dev-cmd@v1 - uses: ./.github/actions/ci env: - OPENSSL_ROOT_DIR: 'C:\ProgramFiles\OpenSSL' BOOST_LIBRARY_DIR: 'C:\local\boost_1_81_0\lib64-msvc-14.3' BOOST_LIBRARYDIR: 'C:\local\boost_1_81_0\lib64-msvc-14.3' with: From d697112e7aae68068567914c8d9c5fbbe790169a Mon Sep 17 00:00:00 2001 From: Ryan Lamb <4955475+kinyoklion@users.noreply.github.com> Date: Wed, 16 Aug 2023 09:23:22 -0700 Subject: [PATCH 06/10] Better path. --- .github/actions/client-release/action.yml | 1 + .github/workflows/client.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/actions/client-release/action.yml b/.github/actions/client-release/action.yml index 2ee0befc3..6a07bdc41 100644 --- a/.github/actions/client-release/action.yml +++ b/.github/actions/client-release/action.yml @@ -74,6 +74,7 @@ runs: if: runner.os == 'Windows' shell: bash env: + OPENSSL_ROOT_DIR: 'C:\Program Files\OpenSSL' BOOST_LIBRARY_DIR: 'C:\local\boost_1_81_0\lib64-msvc-14.3' BOOST_LIBRARYDIR: 'C:\local\boost_1_81_0\lib64-msvc-14.3' BOOST_ROOT: ${{ steps.install-boost.outputs.BOOST_ROOT }} diff --git a/.github/workflows/client.yml b/.github/workflows/client.yml index 9457b8e2d..fcbea06d5 100644 --- a/.github/workflows/client.yml +++ b/.github/workflows/client.yml @@ -59,6 +59,7 @@ jobs: - uses: ilammy/msvc-dev-cmd@v1 - uses: ./.github/actions/ci env: + OPENSSL_ROOT_DIR: 'C:\Program Files\OpenSSL' BOOST_LIBRARY_DIR: 'C:\local\boost_1_81_0\lib64-msvc-14.3' BOOST_LIBRARYDIR: 'C:\local\boost_1_81_0\lib64-msvc-14.3' with: From 94e0c146ff30f044a0ebf9aa8ceecd024db3d3c0 Mon Sep 17 00:00:00 2001 From: Ryan Lamb <4955475+kinyoklion@users.noreply.github.com> Date: Wed, 16 Aug 2023 09:26:39 -0700 Subject: [PATCH 07/10] Echo path for debugging. --- .github/workflows/client.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/client.yml b/.github/workflows/client.yml index fcbea06d5..5e4c615ca 100644 --- a/.github/workflows/client.yml +++ b/.github/workflows/client.yml @@ -55,6 +55,7 @@ jobs: build-test-windows: runs-on: windows-2022 steps: + - run: echo $PATH - uses: actions/checkout@v3 - uses: ilammy/msvc-dev-cmd@v1 - uses: ./.github/actions/ci From b3737057154c1ef8a3e51d3f471ebc7302bc0391 Mon Sep 17 00:00:00 2001 From: Ryan Lamb <4955475+kinyoklion@users.noreply.github.com> Date: Wed, 16 Aug 2023 09:29:45 -0700 Subject: [PATCH 08/10] Add LS command --- .github/workflows/client.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/client.yml b/.github/workflows/client.yml index 5e4c615ca..dadd46d64 100644 --- a/.github/workflows/client.yml +++ b/.github/workflows/client.yml @@ -56,6 +56,7 @@ jobs: runs-on: windows-2022 steps: - run: echo $PATH + - run: ls '/c/Program Files' - uses: actions/checkout@v3 - uses: ilammy/msvc-dev-cmd@v1 - uses: ./.github/actions/ci From 029338d4419f94b8643654c1f1735c93f041cfe9 Mon Sep 17 00:00:00 2001 From: Ryan Lamb <4955475+kinyoklion@users.noreply.github.com> Date: Wed, 16 Aug 2023 09:31:52 -0700 Subject: [PATCH 09/10] Add shell. --- .github/workflows/client.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/client.yml b/.github/workflows/client.yml index dadd46d64..17a8999a4 100644 --- a/.github/workflows/client.yml +++ b/.github/workflows/client.yml @@ -55,8 +55,8 @@ jobs: build-test-windows: runs-on: windows-2022 steps: - - run: echo $PATH - run: ls '/c/Program Files' + shell: bash - uses: actions/checkout@v3 - uses: ilammy/msvc-dev-cmd@v1 - uses: ./.github/actions/ci From ba39694bac79468b92c53ec776fc60ce7520493f Mon Sep 17 00:00:00 2001 From: Ryan Lamb <4955475+kinyoklion@users.noreply.github.com> Date: Wed, 16 Aug 2023 09:48:05 -0700 Subject: [PATCH 10/10] Remove debugging. --- .github/workflows/client.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/client.yml b/.github/workflows/client.yml index 17a8999a4..fcbea06d5 100644 --- a/.github/workflows/client.yml +++ b/.github/workflows/client.yml @@ -55,8 +55,6 @@ jobs: build-test-windows: runs-on: windows-2022 steps: - - run: ls '/c/Program Files' - shell: bash - uses: actions/checkout@v3 - uses: ilammy/msvc-dev-cmd@v1 - uses: ./.github/actions/ci