Bug 237917

Summary: graphics/libGLw: Should glwMDrawingAreaWidgetClass be declared as extern?
Product: Ports & Packages Reporter: Jason W. Bacon <jwb>
Component: Individual Port(s)Assignee: freebsd-x11 (Nobody) <x11>
Status: Closed FIXED    
Severity: Affects Only Me CC: pete, zeising
Priority: --- Flags: bugzilla: maintainer-feedback? (x11)
Version: Latest   
Hardware: Any   
OS: Any   
See Also: https://bugs.freedesktop.org/show_bug.cgi?id=100916
Attachments:
Description Flags
Update libGLw with patches from upstream none

Description Jason W. Bacon freebsd_committer freebsd_triage 2019-05-16 01:33:33 UTC
Error message from SUMA (part of science/afni)

** ERROR: glwMDrawingAreaWidgetClass is NULL
   This might be an error in GLwDrawA.h where the class is
   not referenced using 'extern'.  An alternative is to use
   the local build of libGLws.a.

Adding extern to the declaration in /usr/local/include/GL/GLwDrawA.h did eliminate the error.

Would probably do the same for glwDrawingAreaWidgetClass.
Comment 1 Niclas Zeising freebsd_committer freebsd_triage 2019-05-17 17:24:31 UTC
Hi!
I haven't looked at the details, but assuming this is from mesa, I don't want to change those headers unless it is first changed (or slated to be changed) upstream.
Comment 2 Jason W. Bacon freebsd_committer freebsd_triage 2019-05-18 16:10:11 UTC
Thanks for the feedback.

Out of curiosity, do you see any specific problems with using extern?  It seems like an innocuous change to me, but there might be some nuance I'm overlooking.

It also seems improper to define a variable in a header file without extern, but again I'm open to the possibility that there may be a good reason for it.

Cheers,

   JB
Comment 3 Jason W. Bacon freebsd_committer freebsd_triage 2019-05-18 22:10:07 UTC
Yes, AFNI is a rare application still using Motif.

I think the problem may be a failure of the logic defining GLAPI in /usr/local/include/GL/gl.h.  I think it should expand to "extern" in GLwDrawA.h.

I also think it needs to be defined in GLwDrawA.c if properly declared as extern in the header.

A recursive grep of the code revealed no other definitions.
Comment 4 Jason W. Bacon freebsd_committer freebsd_triage 2019-05-19 00:02:32 UTC
One more thing that might be noteworthy: There appear to be only 5 ports dependent on libGLw:

FreeBSD cray.acadix  bacon ~ 1005: port-grep glw
databases/grass7/Makefile:MOTIF_USE=		GL=glw
databases/grass7/Makefile:MOTIF_CONFIGURE_ON=	--with-motif --with-glw
games/critterding/Makefile:		${WRKSRC}/src/gui/textprinter.cpp ${WRKSRC}/src/gl/glwindow.cpp
graphics/inventor/Makefile:USE_GL=		gl glu glw
graphics/libGLw/Makefile:MASTER_SITES=	ftp://ftp.freedesktop.org/pub/mesa/glw/
graphics/libGLw/Makefile:DISTNAME=	glw-${PORTVERSION}
science/afni/Makefile:USE_GL=		gl glu glw
science/xmakemol/Makefile:USE_GL=		glut glw

The last distfile is from 2012, so I don't think this will be fixed upstream.
Comment 5 Niclas Zeising freebsd_committer freebsd_triage 2019-08-06 14:57:18 UTC
Created attachment 206308 [details]
Update libGLw with patches from upstream

Hi!
Sorry for sitting on this for so long.  Can you try the attached patch, that pulls in two fixes from upstream.

As a side note, libGLw has been deprecated upstream, so support is very limited, and it should probably be deprecated in FreeBSD ports at some point as well.
Comment 6 Jason W. Bacon freebsd_committer freebsd_triage 2019-08-15 01:32:55 UTC
Seems to work now, but I'll continue to use AFNI's bundled GLw since the port may be deprecated soon.

Thanks,

   JB
Comment 7 commit-hook freebsd_committer freebsd_triage 2019-08-15 14:37:59 UTC
A commit references this bug:

Author: zeising
Date: Thu Aug 15 14:37:14 UTC 2019
New revision: 508996
URL: https://svnweb.freebsd.org/changeset/ports/508996

Log:
  graphics/libGLw: Fix extern visibility

  Import upstream patches to graphics/libGLw to fix extern visibility of some
  symbols.  While here, also add a patch to fix a typo.
  These patches pulls libGLw on par with upstream git master.

  PR:		237917
  Reported by:	Jason W. Bacon
  MFH:		2019Q3 (fixes issues in other ports)

Changes:
  head/graphics/libGLw/Makefile
  head/graphics/libGLw/files/
  head/graphics/libGLw/files/patch-b060a07.c
  head/graphics/libGLw/files/patch-c4f7cdf.c
Comment 8 commit-hook freebsd_committer freebsd_triage 2019-08-15 14:44:01 UTC
A commit references this bug:

Author: zeising
Date: Thu Aug 15 14:43:51 UTC 2019
New revision: 508997
URL: https://svnweb.freebsd.org/changeset/ports/508997

Log:
  MFH: r508996

  graphics/libGLw: Fix extern visibility

  Import upstream patches to graphics/libGLw to fix extern visibility of some
  symbols.  While here, also add a patch to fix a typo.
  These patches pulls libGLw on par with upstream git master.

  PR:		237917
  Reported by:	Jason W. Bacon

  Approved by:	ports-secteam (joneum)

Changes:
_U  branches/2019Q3/
  branches/2019Q3/graphics/libGLw/Makefile
  branches/2019Q3/graphics/libGLw/files/