Wednesday, January 30, 2019

Re: [ports-gcc] Unbreak x11/grantlee

On Wed, 30 Jan 2019 13:31:26 +0100
Jeremie Courreges-Anglas wrote:

> On Mon, Jan 28 2019, George Koehler <kernigh@gmail.com> wrote:
> > Cc Rafael Sadowksi, who replied to my earlier mail about grantlee.
> >
> > On Mon, 28 Jan 2019 19:16:24 +0100
> > Charlene Wendling <julianaito@posteo.jp> wrote:
> >
> >> Hi ports!
> >>
> >> > http://build-failures.rhaalovely.net/sparc64/2018-12-19/x11/grantlee.log
> >> > http://build-failures.rhaalovely.net/powerpc/2018-12-14/x11/grantlee.log
> >>
> >> With ports-gcc, it needs additional CFLAGS and LDFLAGS.
> >>
> >> It has been tested successfully on macppc [1].
> >>
> >> Charlène.
> >>
> >>
> >> [1] http://ix.io/1zr6
> >>
> >>
> >> Index: Makefile
> >> ===================================================================
> >> RCS file: /cvs/ports/x11/grantlee/Makefile,v
> >> retrieving revision 1.13
> >> diff -u -p -r1.13 Makefile
> >> --- Makefile 24 Oct 2018 14:28:12 -0000 1.13
> >> +++ Makefile 28 Jan 2019 17:50:57 -0000
> >> @@ -2,7 +2,7 @@
> >>
> >> COMMENT = template and text document library for
> >> Qt4 PKG_VERSION = 0.5.1
> >> -REVISION = 4
> >> +REVISION = 5
> >> PLIST_VERSION = ${PKG_VERSION:R}
> >> DISTNAME = grantlee-${PKG_VERSION}
> >> CATEGORIES = devel x11
> >> @@ -36,3 +36,8 @@ CONFIGURE_ARGS = -DCMAKE_DISABLE_FIND_PA
> >> SUBST_VARS = PLIST_VERSION
> >>
> >> .include <bsd.port.mk>
> >> +
> >> +.if ${CHOSEN_COMPILER} == "ports-gcc"
> >> +CXXFLAGS += -pthread
> >> +LDFLAGS += -lpthread
> >> +.endif
> >>
> >
> > Earlier this month, I offered a different diff for x11/grantlee:
> > https://marc.info/?l=openbsd-ports&m=154715527204197&w=2
> >
> > The error is "undefined reference to `pthread_cancel'" when building
> > a shared object (.so). My diff removed -Wl,--no-undefined from
> > flags (in patch-CMakeLists_txt), so the undefined symbol isn't an
> > error. The above diff instead links to libpthread, so the symbol is
> > defined.
> >
> > For comparison, x11/grantlee-qt5/patch*CMake* is now linking .so
> > files to both libc and libpthread.
> >
> > Most .so files in OpenBSD have some undefined symbols because they
> > don't link to libc. The flag -Wl,--no-undefined works in some
> > systems, but causes errors in OpenBSD with libc symbols like memcpy.
> > I know less about pthread_cancel; the call to pthread_cancel seems
> > to be in libgcc, but pthread_cancel might be a symbol in
> > libpthread, a weak symbol in libestdc++, or a weak symbol in libgcc
> > itself.
>
> Could this error be triggered by the fact that those undefined symbols
> are to be found in a .a archive which is linked into a .so?
> (--no-undefined shouldn't error out with missing symbols in a .so)
>
> > My diff (removing -Wl,--no-undefined) might not be correct. When I
> > sent my diff, some dependencies of x11/grantlee were broken (on
> > platforms like macppc), so there was no way to test my diff. I only
> > know that my diff worked with my modified ports tree.
>
> Thanks for sharing your analysis. For now I tend to prefer the
> "remove the -Wl,--no-undefined flag" approach, because ports
> shouldn't have to explicitely specify libs because of whatever weak
> symbols present in whatever system-specific lib. I still feel like
> there's a bug lurking in ld.bfd(1).
>
> Charlene, what do you think? Any preference regarding which approach
> to take?

As i said, setting CXX/LDFLAGS the way i did is quite bad. I've
tested George's diff with the CVS' glib2/poppler fixes and it sure
builds as well, so let's go for it!

Charlène.

> --
> jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE
> 1524 E7EE
>

No comments:

Post a Comment