Skip to content

[nix] build with poco 1.14.1 fails because of missing include #11175

@dwt

Description

@dwt

Describe the Bug

When compiling collabora-online with poco 1.14.1. (latest release) the build fails with errors like this:

In file included from kit/ChildSession.cpp:46:
./common/JsonUtil.hpp: In function 'bool JsonUtil::parseJSON(const std::string&, Poco::JSON::Object::Ptr&)':
./common/JsonUtil.hpp:45:47: error: expected unqualified-id before '&' token
   45 |         catch (const Poco::JSON::JSONException& exception)
      |                                               ^
./common/JsonUtil.hpp:45:47: error: expected ')' before '&' token
   45 |         catch (const Poco::JSON::JSONException& exception)
      |               ~                               ^
      |                                               )
./common/JsonUtil.hpp:45:47: error: expected '{' before '&' token
./common/JsonUtil.hpp:45:49: error: 'exception' was not declared in this scope; did you mean 'std::exception'?
   45 |         catch (const Poco::JSON::JSONException& exception)
      |                                                 ^~~~~~~~~
      |                                                 std::exception
In file included from /nix/store/x5k7anh2zz9vbdicl0mbxyjd1kw4a8j4-gcc-14-20241116/include/c++/14-20241116/new:41,
                 from /nix/store/x5k7anh2zz9vbdicl0mbxyjd1kw4a8j4-gcc-14-20241116/include/c++/14-20241116/bits/stl_construct.h:59,
                 from /nix/store/x5k7anh2zz9vbdicl0mbxyjd1kw4a8j4-gcc-14-20241116/include/c++/14-20241116/bits/char_traits.h:57,
                 from /nix/store/x5k7anh2zz9vbdicl0mbxyjd1kw4a8j4-gcc-14-20241116/include/c++/14-20241116/string:42,
                 from /nix/store/7rgi6n33x0dd77yfxny284ij2kfgdhk0-poco-1.14.1-dev/include/Poco/Foundation.h:94,
                 from /nix/store/7rgi6n33x0dd77yfxny284ij2kfgdhk0-poco-1.14.1-dev/include/Poco/Util/Util.h:23,
                 from /nix/store/7rgi6n33x0dd77yfxny284ij2kfgdhk0-poco-1.14.1-dev/include/Poco/Util/XMLConfiguration.h:21,
                 from kit/Kit.hpp:14,
                 from kit/ChildSession.cpp:14:

Steps to Reproduce

  1. Check out pull request poco: 1.13.3 -> 1.14.1 NixOS/nixpkgs#369312
    2.nix-build --attr collabora-online --system aarch64-linux
  2. See error

Expected Behavior

It should build cleanly

Actual Behavior

It does not

Additional Context

I was able to work around it with this patch:

diff --git a/common/JsonUtil.hpp b/common/JsonUtil.hpp
index 564812e0e6..b7eb8fe0b4 100644
--- a/common/JsonUtil.hpp
+++ b/common/JsonUtil.hpp
@@ -23,6 +23,7 @@
 #include <Poco/Dynamic/Var.h>
 #include <Poco/JSON/Object.h>
 #include <Poco/JSON/Parser.h>
+#include <Poco/JSON/JSONException.h>

 namespace JsonUtil
 {
@@ -248,4 +249,3 @@ inline std::string escapeJSONValue(std::string val)
 } // end namespace JsonUtil

 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
-

I am not sure why this is needed, as there weren't any changes in the relevant header that seem like they are the source of this error. That said, it seems reasonable that there is an include missing, as the type is not actually imported. Still, my C++ is way too rusty to have a conclusive opinion on this.

So:

  • Can you explain why this patch was necessary?
  • Is there a better way to fix this build?
  • Would you consider adding this patch to the next version of collabora-online?

Metadata

Metadata

Assignees

No one assigned

    Labels

    24.04bugSomething isn't working

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions