Opened 10 years ago

Closed 7 months ago

Last modified 7 months ago

#44232 closed enhancement (wontfix)

patch to have cmake use -dynamiclib in CMAKE_SHARED_MODULE_CREATE

Reported by: RJVB (René Bertin) Owned by: michaelld (Michael Dickens)
Priority: Normal Milestone:
Component: ports Version:
Keywords: haspatch Cc: cooljeanius (Eric Gallager), NicosPavlov
Port: cmake

Description (last modified by mf2k (Frank Schima))

Re: ticket:40188

There is an open issue with cmake: it uses the obsolete -bundle option instead of -dynamiclib when creating a shared module (AKA bundle or plugin). When -bundle is used (at least in x86_64 mode), the linker will refuse to pull in the resulting objects if they're also used as linker input. Using -dynamiclib reenables that, and appears to be without any side-effects on the other intended use of the resulting shared modules. As mentioned in ticket #40188, this affects certain python extensions, but also the Calligra suite (not yet in MacPorts).

Attached are a patchfile to add to the cmake port to tackle the issue, as well as a Portfile diff.

Attachments (2)

cmake-portfile-diff.patch (579 bytes) - added by RJVB (René Bertin) 10 years ago.
portfile diff
patch-SHARED_BUNDLE_flag.diff (4.0 KB) - added by RJVB (René Bertin) 10 years ago.
patch to replace -bundle with -dynamiclib

Download all attachments as: .zip

Change History (9)

Changed 10 years ago by RJVB (René Bertin)

Attachment: cmake-portfile-diff.patch added

portfile diff

Changed 10 years ago by RJVB (René Bertin)

patch to replace -bundle with -dynamiclib

comment:1 Changed 10 years ago by mf2k (Frank Schima)

Description: modified (diff)
Keywords: haspatch added
Owner: changed from macports-tickets@… to css@…
Type: submissionenhancement
Version: 2.3.1

In the future, please Cc the port maintainers (port info --maintainers cmake).

comment:2 Changed 10 years ago by NicosPavlov

Cc: nicos@… added

Cc Me!

comment:3 Changed 10 years ago by NicosPavlov

Cc: egall@… added

Supersedes #42840.

comment:4 Changed 9 years ago by kurthindenburg (Kurt Hindenburg)

Owner: changed from css@… to michaelld@…

comment:5 Changed 9 years ago by RJVB (René Bertin)

Let me repeat here what I've already tried to indicate elsewhere about a year ago, namely that this is a "fix" that "upstreams" had apparently good reason to reject (http://public.kitware.com/Bug/view.php?id=15126). Even the related trac ticket (#40188) was closed as "wontfix" because software should not rely on being able to use plugins (".bundle objects") as shared libraries.

In my original submission I said there were no side-effects, but IIRC I did run into one that made me remove the patch from my own CMake port last year. I cannot remember the exact details, but it most likely had to do with the extension used for the resulting plugins. With -dynamiclib that'd usually be .dylib, whereas most software originally written for Linux will expect (and typically hardcode) a .so extension.

In practice there are only very few projects out there that have the bad habit of trying to use plugins as shared libraries, and all examples I've seen do that in auto/unittest scenarios. In all those cases the simplest fix has been to skip building the test(s) in question.

I'm pretty sure I apologised for proposing this patch, let me repeat that here too. My apologies!

comment:6 Changed 7 months ago by kencu (Ken)

Resolution: wontfix
Status: newclosed

this appears to be no longer a valid isdue

comment:7 Changed 7 months ago by RJVB (René Bertin)

10 years is a long time to give issues the chance to fix themselves ...

Note: See TracTickets for help on using tickets.