From 7be4892f658d2ac1a63c656bed4cb5628898be98 Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Wed, 4 Jun 2025 22:15:10 +0800 Subject: Fix vcpkg Boost JSON linking errors The error was "definition of dllimport static data member not allowed", and not "definition of dllimport function not allowed" as mentioned in commit 2bf9d234aac30ed4a85282730da0ffc83acf9adf description. Basically there were about 5 offending files, and all had BOOST_JSON_REQUIRE_CONST_INIT in them. Not including json/src.hpp (that includes them among others), fixes those errors, but then there are definitions in them that are actually used by llsdjson. After doing so many searches, I came across this: https://stackoverflow.com/questions/3491990/c-definition-of-dllimport-static-data-member and just from the first paragraph in the accepted answer, I realised llsdjson can still have those definitions, just not from the offending headers, but by simply linking to Boost JSON compiled library instead. --- indra/llcommon/llsdjson.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llcommon/llsdjson.cpp') diff --git a/indra/llcommon/llsdjson.cpp b/indra/llcommon/llsdjson.cpp index 655869a704..a3f80b7c2e 100644 --- a/indra/llcommon/llsdjson.cpp +++ b/indra/llcommon/llsdjson.cpp @@ -35,7 +35,7 @@ #include "llerror.h" #include "../llmath/llmath.h" -#include +#include //========================================================================= LLSD LlsdFromJson(const boost::json::value& val) -- cgit v1.2.3 From 990a8291bd89a4f46464a24a07fe965659f6fa52 Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Thu, 5 Jun 2025 14:04:32 +0800 Subject: Only Windows link to Boost JSON library file Adding another library file to link means adding many more lines for other platform(s), at least for macOS with its bundling. It's much simpler to make the condition on 2 files. --- indra/llcommon/llsdjson.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra/llcommon/llsdjson.cpp') diff --git a/indra/llcommon/llsdjson.cpp b/indra/llcommon/llsdjson.cpp index a3f80b7c2e..a4b45ed80d 100644 --- a/indra/llcommon/llsdjson.cpp +++ b/indra/llcommon/llsdjson.cpp @@ -35,7 +35,11 @@ #include "llerror.h" #include "../llmath/llmath.h" +#if LL_WINDOWS #include +#else +#include +#endif //========================================================================= LLSD LlsdFromJson(const boost::json::value& val) -- cgit v1.2.3