On Thu, 2017-05-11 at 14:17 -0500, Daniel Díaz wrote:
> gbm_bo_map() and _unmap() have been added recently to Mesa,
> and this update may not have reached all implementations of
> GBM, such as the one provided by Mali r6, where said
> definitions can be found in the header file but not in the
> library itself. This leads to errors like the following when
> linking:
>   ../../../../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
> 
> Instead of relying on the header file, actually try to link
> using that symbol to determine if PIGLIT_HAS_GBM_BO_MAP
> should be defined.
> 
> Signed-off-by: Daniel Díaz <daniel.d...@linaro.org>
> ---
>  CMakeLists.txt | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/CMakeLists.txt b/CMakeLists.txt
> index a4ff99e..136cc21 100644
> --- a/CMakeLists.txt
> +++ b/CMakeLists.txt
> @@ -141,10 +141,14 @@ IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
>       if(GBM_FOUND)
>               set(PIGLIT_HAS_GBM True)
>               add_definitions(-DPIGLIT_HAS_GBM)
> -             if (GBM_VERSION VERSION_EQUAL "12.1" OR GBM_VERSION 
> VERSION_GREATER "12.1")
> -                     set(PIGLIT_HAS_GBM_BO_MAP True)
> +             set(OLD_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
> +             set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} gbm)
> +             CHECK_FUNCTION_EXISTS(gbm_bo_map PIGLIT_HAS_GBM_BO_MAP)
> +             if (PIGLIT_HAS_GBM_BO_MAP)
>                       add_definitions(-DPIGLIT_HAS_GBM_BO_MAP)
>               endif()
> +             set(CMAKE_REQUIRED_LIBRARIES ${OLD_REQUIRED_LIBRARIES})
> +

wouldn't it be cleaner to use CheckSymbolExists(gbm_bo_map GBM_HEADERS
PIGLIT_HAS_GBM_BO_MAP)
instead of the autostyle detection?

Jan


>       endif(GBM_FOUND)
>  
>       pkg_check_modules(WAYLAND QUIET wayland-client wayland-egl)

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to