Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#64055 closed defect (fixed)

legacysupport @1.0.4: Add support for missing "operator delete ( void* ptr, std::size_t sz )" in macos < 10.12

Reported by: tenzap Owned by: tenzap
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc: mascguy (Christopher Nielsen), cjones051073 (Chris Jones), kencu (Ken)
Port: legacysupport

Description (last modified by tenzap)

Originally, when building KeePassXC on macOS 10.11 with a compiler that supports the -fsized-deallocation (like clang++-mp-9.0, or a recent AppleClang, probably >= 8) there is this error:

error: call to unavailable function 'operator delete': introduced in macOS 10.12

Test case file to compile with -fsized-deallocation flag:

#include <new>
int main() {
  void * ptr = nullptr;
  std::size_t size = 1;
  ::operator delete(ptr, size);
}

Maybe this is part of the things that could be addressed by legacysupport?

There may be other related functions missing since delete is 'overloaded' https://en.cppreference.com/w/cpp/memory/new/operator_delete https://en.cppreference.com/w/cpp/header/new

For now this is worked around in KeePassXC with a patch that disables use of -fsized-deallocation on macos < 10.12.

Change History (13)

comment:1 Changed 2 years ago by tenzap

Description: modified (diff)

comment:2 in reply to:  description Changed 2 years ago by tenzap

Last edited 2 years ago by tenzap (previous) (diff)

comment:3 Changed 2 years ago by tenzap

Description: modified (diff)

comment:4 Changed 2 years ago by tenzap

Description: modified (diff)

comment:5 Changed 2 years ago by mascguy (Christopher Nielsen)

Cc: mascguy added

comment:6 Changed 2 years ago by mascguy (Christopher Nielsen)

Cc: cjones051073 kencu added

Ken/Chris, would it make sense to add this to legacysupport? Or is the better choice to have ports utilize macports-libcxx?

comment:7 Changed 2 years ago by kencu (Ken)

I don't see that the OP proposes something new to add to legacysupport here in this ticket.

Disabling the newer functionality is one fix, if possible.

Using macports-libcxx is another fix, that can work in some cases, but should be actually tested due to possible ABI collisions.

comment:8 Changed 2 years ago by cjones051073 (Chris Jones)

I think this goes somehwat beyond the sort of thing legacy-support should be implementing.

comment:9 Changed 2 years ago by kencu (Ken)

Resolution: fixed
Status: newclosed

yes, as I already did implement it in macports-libcxx, and there is nothing else to be done.

For the OP:

what you are asking for already exists! Add the legacysupport PG and enable macports-libcxx using that PG's options (see the PG code for the exact bit to add).

comment:10 Changed 2 years ago by mascguy (Christopher Nielsen)

@tenzap For the addition of the legacysupport PG, you may want to include that first, before any other portgroup. (Chris/Ken, let us know if that's good advice, and/or if there are cases where one or more other PGs should be included first.)

As for the use of macports-libcxx, I've started using the following convention. The comment itself is important, as it explains to others why it's necessary. You can feel free to supplement and/or modify the comment though, with the specifics surrounding the delete operator.

# Enable use of 'macports-libcxx' for macOS 10.12 and earlier, as port uses
# libcxx features normally only available on 10.13 and later.
legacysupport.use_mp_libcxx \
                        yes

And feel free to let us know how it goes, as well as if you encounter any issues!

Last edited 2 years ago by mascguy (Christopher Nielsen) (previous) (diff)

comment:11 Changed 2 years ago by mascguy (Christopher Nielsen)

p.s. Note that you'll specifically need to use legacysupport 1.1, as 1.0 doesn't include the macports-libcxx functionality.

comment:12 Changed 2 years ago by tenzap

I did as you suggest, it works fine. Thanks.

https://github.com/macports/macports-ports/pull/13280

comment:13 Changed 2 years ago by tenzap

Owner: set to tenzap

In e40ed89b12050e0f0f0d940a424da20cbe89c5a1/macports-ports (master):

KeePassXC: & -devel: enable sized-deallocation, update to latest

KeePassXC & KeePassXC-devel

  • enable sized-deallocation on macOS < 10.12
    • remove patch: patch-sized_deallocation.diff
    • use legacysupport PG & macports-libcxx Closes: #64055

KeePassXC-devel

  • update to latest
  • upgrade to c++ 2017
  • remove merged patches
Note: See TracTickets for help on using tickets.