Summary: | devel/cpprestsdk: json.h breaks with the FreeBSD std::unique_ptr | ||||||
---|---|---|---|---|---|---|---|
Product: | Ports & Packages | Reporter: | Jan-Espen Oversand <sigsegv> | ||||
Component: | Individual Port(s) | Assignee: | Fernando Apesteguía <fernape> | ||||
Status: | Closed FIXED | ||||||
Severity: | Affects Only Me | CC: | fernape | ||||
Priority: | --- | Flags: | fernape:
merge-quarterly?
|
||||
Version: | Latest | ||||||
Hardware: | Any | ||||||
OS: | Any | ||||||
Attachments: |
|
Hi Jan, Is this patch needed too for bug #276188? Or 2.10.19 is also broken? is this specific to a FreeBSD version, or does it happen everywhere? (In reply to Fernando Apesteguía from comment #1) This is also a problem with the 2.10.19 version, and in fact the same patches should work fine (without fuzz) with both versions of cpprestsdk. (In reply to Mina Galić from comment #2) Tested on FreeBSD 14.0. I can test 13.2 later, but it might take me a few days. But bottom line, I guess cpprestsdk has been developed against the gcc stdc++ library, and the clang libcpp might differ slightly with regards to type completeness requirements. (In reply to Jan-Espen Oversand from comment #3) Then this should be committed before bug #276188. Thanks. Committed, Thanks! A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=6cbfd8b1e7dc89a48a126867b180813df46c19e4 commit 6cbfd8b1e7dc89a48a126867b180813df46c19e4 Author: Jan-Espen Oversand <sigsegv@radiotube.org> AuthorDate: 2024-01-08 08:33:05 +0000 Commit: Fernando Apesteguía <fernape@FreeBSD.org> CommitDate: 2024-01-08 17:53:11 +0000 devel/cpprestsdk: Fix include of json.h De-inlining the constructor and destructor makes the sizeof(_Value) available to std::unique_ptr. PR: 276187 Reported by: sigsegv@radiotube.org devel/cpprestsdk/Makefile | 1 + .../files/patch-include_cpprest_json.h (new) | 20 ++++++++++++++++++++ devel/cpprestsdk/files/patch-src_json_json.cpp (new) | 19 +++++++++++++++++++ 3 files changed, 40 insertions(+) |
Created attachment 247517 [details] Patch files to de-inline the failing constructor and destructor A simple #include <cpprestsdk/json.h> fails with errors like this: In file included from /usr/include/c++/v1/iostream:43: In file included from /usr/include/c++/v1/ios:221: In file included from /usr/include/c++/v1/__locale:18: In file included from /usr/include/c++/v1/mutex:191: In file included from /usr/include/c++/v1/__memory/shared_ptr.h:31: /usr/include/c++/v1/__memory/unique_ptr.h:63:19: error: invalid application of 'sizeof' to an incomplete type 'web::json::details::_Value' static_assert(sizeof(_Tp) >= 0, "cannot delete an incomplete type"); ^~~~~~~~~~~ /usr/include/c++/v1/__memory/unique_ptr.h:297:7: note: in instantiation of member function 'std::default_delete<web::json::details::_Value>::operator()' requested here __ptr_.second()(__tmp); ^ /usr/include/c++/v1/__memory/unique_ptr.h:263:75: note: in instantiation of member function 'std::unique_ptr<web::json::details::_Value>::reset' requested here _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 ~unique_ptr() { reset(); } ^ /usr/local/include/cpprest/json.h:716:14: note: in instantiation of member function 'std::unique_ptr<web::json::details::_Value>::~unique_ptr' requested here explicit value(std::unique_ptr<details::_Value> v) : m_value(std::move(v)) ^ /usr/local/include/cpprest/json.h:35:7: note: forward declaration of 'web::json::details::_Value' class _Value; ^ 1 error generated. Suggested patch included. De-inlining the constructor and destructor makes the sizeof(_Value) available to std::unique_ptr.