Bug 100978 - Undefined references: gbm_bo_map and _unmap on Mali
Summary: Undefined references: gbm_bo_map and _unmap on Mali
Alias: None
Product: piglit
Classification: Unclassified
Component: infrastructure (show other bugs)
Version: unspecified
Hardware: ARM Linux (All)
: medium normal
Assignee: Dylan Baker
QA Contact: Piglit Mailing List
Depends on:
Reported: 2017-05-09 20:41 UTC by Daniel Díaz
Modified: 2017-07-09 03:03 UTC (History)
0 users

See Also:
i915 platform:
i915 features:

[patch] Define GBM_BO_MAP only when symbol is found (1.90 KB, patch)
2017-05-10 19:15 UTC, Daniel Díaz
Details | Splinter Review

Description Daniel Díaz 2017-05-09 20:41:56 UTC
When "Linking C executable ../../../../bin/point-sprite", the following errors
are thrown:

  ../../../../lib/libpiglitutil_gl.so.0: undefined reference to `gbm_bo_unmap'
  ../../../../lib/libpiglitutil_gl.so.0: undefined reference to `gbm_bo_map'
  collect2: error: ld returned 1 exit status
  make[2]: *** [bin/point-sprite] Error 1

This is due to CMakeList.txt assuming that gbm >= 12.1 includes gbm_bo_map and
gbm_bo_unmap, but that is not the case with Mali drivers (Mali-T628, Mali-T624, Mali-450, Mali-T760). GPU drivers can be publicly found here:

Instead of checking for GBM_VERSION >= 12.1, it should be possible to 
Comment 1 Dylan Baker 2017-05-09 20:47:51 UTC
Does arm provide libgbm with mali?
Comment 2 Rob Clark 2017-05-10 15:45:24 UTC
(In reply to Dylan Baker from comment #1)
> Does arm provide libgbm with mali?

some versions do, but probably not current with mesa's libgbm.. gbm_bo_map/unmap() are a bit newish..
Comment 3 Andrey Konovalov 2017-05-10 18:26:22 UTC
E.g. mali450r6p001rel0linux1arm64tar.gz from https://developer.arm.com/products/software/mali-drivers/user-space has libgbm.so which is a link to libMali.so:

mali450-userland-drm-r6p0-01rel0-release$ ls -l usr/lib/libgbm*
lrwxrwxrwx 1 ynk ynk 11 Feb  5  2016 usr/lib/libgbm.so -> libgbm.so.1
lrwxrwxrwx 1 ynk ynk 10 Feb  5  2016 usr/lib/libgbm.so.1 -> libMali.so

And libMali.so has only the following gbm_bo_* symbols:

mali450-userland-drm-r6p0-01rel0-release$ objdump -t usr/lib/libMali.so |grep gbm_bo_
000000000017a960 l     F .text	000000000000003c              _ZL20gbm_bo_update_statusP6gbm_bo13gbm_bo_status
00000000002af498 l     O .rodata	000000000000000e              _ZZ13gbm_bo_importE8__func__
000000000017beb8 g     F .text	0000000000000058              gbm_bo_set_user_data
000000000017bcf0 g     F .text	000000000000002c              gbm_bo_get_device
000000000017b734 g     F .text	000000000000050c              gbm_bo_import
000000000017bcc4 g     F .text	000000000000002c              gbm_bo_get_format
000000000017bf3c g     F .text	000000000000001c              gbm_bo_destroy
000000000017bd1c g     F .text	0000000000000034              gbm_bo_get_handle
000000000017bc6c g     F .text	000000000000002c              gbm_bo_get_height
000000000017bc98 g     F .text	000000000000002c              gbm_bo_get_stride
000000000017bc40 g     F .text	000000000000002c              gbm_bo_get_width
000000000017bd50 g     F .text	000000000000002c              gbm_bo_get_fd
000000000017bd7c g     F .text	000000000000013c              gbm_bo_write
000000000017bf10 g     F .text	000000000000002c              gbm_bo_get_user_data
000000000017b2b0 g     F .text	0000000000000124              gbm_bo_unref
000000000017b258 g     F .text	0000000000000058              gbm_bo_ref
000000000017b550 g     F .text	00000000000001e4              gbm_bo_create
Comment 4 Andrey Konovalov 2017-05-10 18:54:52 UTC
(In reply to Andrey Konovalov from comment #3)

Oops.. For my comment above I took an older version of the drivers. But the current one differs only in the paths inside the tarball, and the symbol's offsets. libgbm.so is the link to libMali.so, and the gbm_bo_* are the same set in the both versions.
Comment 5 Daniel Díaz 2017-05-10 19:15:43 UTC
Created attachment 131300 [details] [review]
[patch] Define GBM_BO_MAP only when symbol is found
Comment 6 Dylan Baker 2017-05-11 19:04:26 UTC
Please send the patch to the piglit mailing list using git-send-email. Feel
free to CC me on it.
Comment 7 Daniel Díaz 2017-07-09 03:03:53 UTC
This has been fixed in git rev 2217871.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.