supplied .pc files link un-needed libraries and also don't link the dependencies of those libraries

Open
#1,013 12 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
42/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Domain
build-system

Research direction

Start by locating the supplied .pc files and reproduce the issue with PKG_CONFIG_LIBDIR=/opt/vc/lib/pkgconfig pkg-config --libs-only-l brcmegl. Check that the generated libraries omit unnecessary dependencies and include pthreads where required, then verify that the Qt EGL build no longer reports the shown undefined semaphore references.

Written by the indexing model from the issue text.

Description

Waiting for internal response

Ask pkg-config how to build a program for brcmegl:

PKG_CONFIG_LIBDIR=/opt/vc/lib/pkgconfig pkg-config --libs-only-l brcmegl

Result:

-lbrcmEGL -lbrcmGLESv2 -lbcm_host -lvchostif -lbcm_host -lvcos -lvchiq_arm

There are two problems with the above output. The first is that brcmEGL and brcmGLESv2 don't need to link bcm_host, vchostif, bcm_host, vcos, or vchiq_arm. The second problem is that if you do link vcoshostif then you must also link pthreads, and this .pc does not. As a result, any build using it will fail:

> /home/al/Source/rpi-ramdisk/packages/sysroot/opt/vc/lib/libvchostif.a(vc_vchi_dispmanx.c.o):vc_vchi_dispmanx.c:function dispmanx_notify_func: error: undefined reference to 'sem_wait'
> /home/al/Source/rpi-ramdisk/packages/sysroot/opt/vc/lib/libvchostif.a(vc_vchi_dispmanx.c.o):vc_vchi_dispmanx.c:function dispmanx_client_callback: error: undefined reference to 'sem_getvalue'
> /home/al/Source/rpi-ramdisk/packages/sysroot/opt/vc/lib/libvchostif.a(vc_vchi_dispmanx.c.o):vc_vchi_dispmanx.c:function dispmanx_client_callback: error: undefined reference to 'sem_post'
> /home/al/Source/rpi-ramdisk/packages/sysroot/opt/vc/lib/libvchostif.a(vc_vchi_dispmanx.c.o):vc_vchi_dispmanx.c:function dispmanx_notify_callback: error: undefined reference to 'sem_getvalue'
> /home/al/Source/rpi-ramdisk/packages/sysroot/opt/vc/lib/libvchostif.a(vc_vchi_dispmanx.c.o):vc_vchi_dispmanx.c:function dispmanx_notify_callback: error: undefined reference to 'sem_post'
> /home/al/Source/rpi-ramdisk/packages/sysroot/opt/vc/lib/libvchostif.a(vc_vchi_dispmanx.c.o):vc_vchi_dispmanx.c:function dispmanx_send_command: error: undefined reference to 'sem_wait'
> /home/al/Source/rpi-ramdisk/packages/sysroot/opt/vc/lib/libvchostif.a(vc_vchi_dispmanx.c.o):vc_vchi_dispmanx.c:function dispmanx_get_handle: error: undefined reference to 'sem_wait'
> /home/al/Source/rpi-ramdisk/packages/sysroot/opt/vc/lib/libvchostif.a(vc_vchi_dispmanx.c.o):vc_vchi_dispmanx.c:function vc_vchi_dispmanx_init: error: undefined reference to 'sem_init'
> /home/al/Source/rpi-ramdisk/packages/sysroot/opt/vc/lib/libvchostif.a(vc_vchi_dispmanx.c.o):vc_vchi_dispmanx.c:function vc_vchi_dispmanx_init: error: undefined reference to 'sem_init'
> /home/al/Source/rpi-ramdisk/packages/sysroot/opt/vc/lib/libvchostif.a(vc_vchi_dispmanx.c.o):vc_vchi_dispmanx.c:function vc_vchi_dispmanx_init: error: undefined reference to 'sem_destroy'
> /home/al/Source/rpi-ramdisk/packages/sysroot/opt/vc/lib/libvchostif.a(vc_vchi_dispmanx.c.o):vc_vchi_dispmanx.c:function vc_vchi_dispmanx_init: error: undefined reference to 'sem_destroy'
> /home/al/Source/rpi-ramdisk/packages/sysroot/opt/vc/lib/libvchostif.a(vc_vchi_dispmanx.c.o):vc_vchi_dispmanx.c:function vc_dispmanx_stop: error: undefined reference to 'sem_getvalue'
> /home/al/Source/rpi-ramdisk/packages/sysroot/opt/vc/lib/libvchostif.a(vc_vchi_dispmanx.c.o):vc_vchi_dispmanx.c:function vc_dispmanx_stop: error: undefined reference to 'sem_post'
> /home/al/Source/rpi-ramdisk/packages/sysroot/opt/vc/lib/libvchostif.a(vc_vchi_dispmanx.c.o):vc_vchi_dispmanx.c:function vc_dispmanx_stop: error: undefined reference to 'sem_destroy'
> /home/al/Source/rpi-ramdisk/packages/sysroot/opt/vc/lib/libvchostif.a(vc_vchi_dispmanx.c.o):vc_vchi_dispmanx.c:function vc_dispmanx_stop: error: undefined reference to 'sem_destroy'
> /home/al/Source/rpi-ramdisk/packages/sysroot/opt/vc/lib/libvchostif.a(vc_vchi_dispmanx.c.o):vc_vchi_dispmanx.c:function vc_dispmanx_query_image_formats: error: undefined reference to 'sem_wait'
> collect2: error: ld returned 1 exit status
> Makefile:67: recipe for target 'egl' failed
> make[2]: *** [egl] Error 1
> make[2]: Leaving directory '/home/al/Source/rpi-ramdisk/packages/qt/qtbase/config.tests/egl'
Dominant language
No language data
Stars
5.6k
Forks
1.7k
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from raspberrypi/firmware

All issues in raspberrypi/firmware

Similar issues

More Build System issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.