Bug 256997

Summary: devel/simavr: Fails to link after graphics/mesa-libs enabled libglvnd support: ld: error: undefined symbol: glGenTextures
Product: Ports & Packages Reporter: pr
Component: Individual Port(s)Assignee: Kevin Bowling <kbowling>
Status: Closed FIXED    
Severity: Affects Many People CC: kbowling, zirias
Priority: --- Flags: zirias: maintainer-feedback+
kbowling: merge-quarterly+
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
Add GL libs for linking
none
Add GL libs for linking
none
Add GL libs for linking none

Description pr 2021-07-05 16:31:17 UTC
devel/simavr does not build after mesa-libs enables libglvnd support as per 
https://reviews.freebsd.org/D30824 https://cgit.freebsd.org/ports/commit/?id=da3162c7c9f01912ba1940e188b253f2b5c7ba77

Extracted from the log:
gmake[3]: Entering directory '/wrkdirs/usr/ports/devel/simavr/work/simavr-1.7/examples/board_ds1338'
AVR-CC atmega32_ds1338.c
    902	      0	      1	    903	    387	atmega32_ds1338.axf
CC ../parts/ac_input.c
CC ../parts/ds1338_virt.c
CC ds1338demo.c
LD obj-aarch64-unknown-freebsd14.0/ds1338demo.elf
ds1338demo done
gmake[3]: Leaving directory '/wrkdirs/usr/ports/devel/simavr/work/simavr-1.7/examples/board_ds1338'
gmake[3]: Entering directory '/wrkdirs/usr/ports/devel/simavr/work/simavr-1.7/examples/board_hd44780'
AVR-CC atmega48_charlcd.c
   2102	     14	      5	   2121	    849	atmega48_charlcd.axf
CC ../parts/ac_input.c
CC ../parts/hd44780.c
CC ../parts/hd44780_glut.c
CC charlcd.c
LD obj-aarch64-unknown-freebsd14.0/charlcd.elf
ld: error: undefined symbol: glGenTextures
>>> referenced by hd44780_glut.c:40 (../parts/hd44780_glut.c:40)
>>>               obj-aarch64-unknown-freebsd14.0/hd44780_glut.o:(hd44780_gl_init)

ld: error: undefined symbol: glBindTexture
>>> referenced by hd44780_glut.c:41 (../parts/hd44780_glut.c:41)
>>>               obj-aarch64-unknown-freebsd14.0/hd44780_glut.o:(hd44780_gl_init)
>>> referenced by hd44780_glut.c:95 (../parts/hd44780_glut.c:95)
>>>               obj-aarch64-unknown-freebsd14.0/hd44780_glut.o:(glputchar)


Full poudriere log available if useful.

Please note this excerpt is from an aach64 CURRENT build, but amd64 12.2 is failing the same way.
Comment 1 Felix Palmen freebsd_committer freebsd_triage 2021-07-07 09:52:06 UTC
I *think* this problem was actually introduced with https://reviews.freebsd.org/D30869 https://cgit.freebsd.org/ports/commit/?id=709148649962c82048858d84a29ffa4ab15a0738

I noticed it a while ago, starting with pkg-fallout mails on 7/1, and there are some successful builds of 1.7_1, so https://reviews.freebsd.org/D30824 probably didn't cause it yet.

Unfortunately, I don't really understand these GL-related changes. Local test builds are running here, I hope to find and fix the problem…
Comment 2 Kevin Bowling freebsd_committer freebsd_triage 2021-07-08 05:08:46 UTC
Created attachment 226291 [details]
Add GL libs for linking

This looks like it used to work due to over-linkage of libGLU transitively adding libGL.  Add specific linkage to libOpenGL instead.  Can you let me know if this patch works for you?
Comment 3 Kevin Bowling freebsd_committer freebsd_triage 2021-07-08 05:10:22 UTC
Created attachment 226292 [details]
Add GL libs for linking

Corrected diff (previous just had an unrelated change)
Comment 4 Kevin Bowling freebsd_committer freebsd_triage 2021-07-08 05:11:15 UTC
Created attachment 226293 [details]
Add GL libs for linking
Comment 5 Kevin Bowling freebsd_committer freebsd_triage 2021-07-08 05:28:59 UTC
The patch above will work but the correct fix is to libGLU's pkgconfig file, https://gitlab.freedesktop.org/mesa/glu/-/merge_requests/9. I will get this pulled back into FreeBSD shortly.
Comment 6 Felix Palmen freebsd_committer freebsd_triage 2021-07-08 07:13:08 UTC
Thanks a lot! Successfully tested the attached patch on 14/amd64.
Comment 7 commit-hook freebsd_committer freebsd_triage 2021-07-15 06:54:56 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=fac2bc519518fc6072e1d042b12cca44afb63568

commit fac2bc519518fc6072e1d042b12cca44afb63568
Author:     Kevin Bowling <kbowling@FreeBSD.org>
AuthorDate: 2021-07-15 06:53:16 +0000
Commit:     Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2021-07-15 06:53:16 +0000

    graphics/libGLU: Switch to meson build

    Fixes an issue I caused with pkgconfig
    https://gitlab.freedesktop.org/mesa/glu/-/commit/225e00a14a9200f11253775a7c7778c1c29c8b23

    PR:             256997

 graphics/libGLU/Makefile                      | 11 ++++++-----
 graphics/libGLU/files/patch-meson.build (new) |  8 ++++++++
 2 files changed, 14 insertions(+), 5 deletions(-)
Comment 8 commit-hook freebsd_committer freebsd_triage 2021-07-15 06:55:57 UTC
A commit in branch 2021Q3 references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=7edc4776cbd8f8b6192c5f1ebddd8f8de6bbbd67

commit 7edc4776cbd8f8b6192c5f1ebddd8f8de6bbbd67
Author:     Kevin Bowling <kbowling@FreeBSD.org>
AuthorDate: 2021-07-15 06:53:16 +0000
Commit:     Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2021-07-15 06:55:24 +0000

    graphics/libGLU: Switch to meson build

    Fixes an issue I caused with pkgconfig
    https://gitlab.freedesktop.org/mesa/glu/-/commit/225e00a14a9200f11253775a7c7778c1c29c8b23

    PR:             256997
    (cherry picked from commit fac2bc519518fc6072e1d042b12cca44afb63568)

 graphics/libGLU/Makefile                      | 11 ++++++-----
 graphics/libGLU/files/patch-meson.build (new) |  8 ++++++++
 2 files changed, 14 insertions(+), 5 deletions(-)
Comment 9 Kevin Bowling freebsd_committer freebsd_triage 2021-07-15 06:56:59 UTC
(In reply to Felix Palmen from comment #6)
Can you let me know if the above works as intended
Comment 10 Felix Palmen freebsd_committer freebsd_triage 2021-07-16 06:41:46 UTC
(In reply to Kevin Bowling from comment #9)
Yes it does, thanks! simavr is building fine without any patch again.
Comment 11 Kevin Bowling freebsd_committer freebsd_triage 2021-07-16 06:59:41 UTC
Thanks for your report!