NetBSD Problem Report #53746

From tsutsui@ceres.dti.ne.jp  Mon Nov 26 16:09:46 2018
Return-Path: <tsutsui@ceres.dti.ne.jp>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 368567A18D
	for <gnats-bugs@gnats.NetBSD.org>; Mon, 26 Nov 2018 16:09:46 +0000 (UTC)
Message-Id: <201811261609.wAQG9f6R002427@ceres.dti.ne.jp>
Date: Tue, 27 Nov 2018 01:09:41 +0900 (JST)
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
Reply-To: tsutsui@ceres.dti.ne.jp
To: gnats-bugs@NetBSD.org
Cc: tsutsui@ceres.dti.ne.jp
Subject: pkgsrc/devel/SDL2 on NetBSD/arm 8.0 causes undefined reference
X-Send-Pr-Version: 3.95

>Number:         53746
>Category:       pkg
>Synopsis:       pkgsrc/devel/SDL2 on NetBSD/arm 8.0 causes undefined reference
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    jmcneill
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Nov 26 16:10:00 +0000 2018
>Last-Modified:  Wed Dec 05 10:45:08 +0000 2018
>Originator:     Izumi Tsutsui
>Release:        NetBSD 8.0
>Organization:
>Environment:
System: 
Architecture: earmv6hf
Machine: evbarm RPI3B
>Description:
The "rpi" option in pkgsrc/devel/SDL2/options.mk pulls
pkgsrc/misc/respberrypi-userland to build SDL2 on arm,
but the SDL2 package build with the option causes undefined
reference errors on builds packages that require SDL2, like PC6001VX:

---
 :
/usr/obj.earmv6hf/pkgsrc/emulators/PC6001VX/work.earmv6hf/.buildlink/lib/libSDL2.a(SDL_rpivideo.o): In function `RPI_VideoInit':
SDL_rpivideo.c:(.text+0x234): undefined reference to `bcm_host_init'
SDL_rpivideo.c:(.text+0x254): undefined reference to `graphics_get_display_size'
SDL_rpivideo.c:(.text+0x274): undefined reference to `vc_tv_get_display_state'
SDL_rpivideo.c:(.text+0x2ec): undefined reference to `vc_dispmanx_display_open'
SDL_rpivideo.c:(.text+0x320): undefined reference to `vc_tv_hdmi_get_property'
/usr/obj.earmv6hf/pkgsrc/emulators/PC6001VX/work.earmv6hf/.buildlink/lib/libSDL2.a(SDL_rpivideo.o): In function `RPI_CreateWindow':
SDL_rpivideo.c:(.text+0x424): undefined reference to `vc_dispmanx_update_start'
SDL_rpivideo.c:(.text+0x45c): undefined reference to `vc_dispmanx_element_add'
SDL_rpivideo.c:(.text+0x474): undefined reference to `vc_dispmanx_update_submit_sync'
SDL_rpivideo.c:(.text+0x500): undefined reference to `vc_dispmanx_vsync_callback'
/usr/obj.earmv6hf/pkgsrc/emulators/PC6001VX/work.earmv6hf/.buildlink/lib/libSDL2.a(SDL_rpivideo.o): In function `RPI_DestroyWindow':
SDL_rpivideo.c:(.text+0x604): undefined reference to `vc_dispmanx_vsync_callback'
/usr/obj.earmv6hf/pkgsrc/emulators/PC6001VX/work.earmv6hf/.buildlink/lib/libSDL2.a(SDL_sysjoystick.o): In function `SDL_SYS_JoystickOpen':
SDL_sysjoystick.c:(.text+0xf8): undefined reference to `hid_get_report_desc'
SDL_sysjoystick.c:(.text+0x23c): undefined reference to `hid_report_size'
SDL_sysjoystick.c:(.text+0x270): undefined reference to `hid_start_parse'
SDL_sysjoystick.c:(.text+0x2bc): undefined reference to `hid_get_item'
SDL_sysjoystick.c:(.text+0x2fc): undefined reference to `hid_usage_in_page'
SDL_sysjoystick.c:(.text+0x394): undefined reference to `hid_end_parse'
/usr/obj.earmv6hf/pkgsrc/emulators/PC6001VX/work.earmv6hf/.buildlink/lib/libSDL2.a(SDL_sysjoystick.o): In function `SDL_SYS_JoystickUpdate':
SDL_sysjoystick.c:(.text+0x630): undefined reference to `hid_start_parse'
SDL_sysjoystick.c:(.text+0x648): undefined reference to `hid_get_item'
SDL_sysjoystick.c:(.text+0x684): undefined reference to `hid_get_data'
SDL_sysjoystick.c:(.text+0x6d4): undefined reference to `hid_get_data'
SDL_sysjoystick.c:(.text+0x724): undefined reference to `hid_end_parse'
SDL_sysjoystick.c:(.text+0x744): undefined reference to `hid_get_data'
/usr/obj.earmv6hf/pkgsrc/emulators/PC6001VX/work.earmv6hf/.buildlink/lib/libSDL2.a(SDL_sysjoystick.o): In function `SDL_SYS_JoystickClose':
SDL_sysjoystick.c:(.text+0x948): undefined reference to `hid_dispose_report_desc'
/usr/obj.earmv6hf/pkgsrc/emulators/PC6001VX/work.earmv6hf/.buildlink/lib/libSDL2.a(SDL_sysjoystick.o): In function `SDL_SYS_JoystickInit':
SDL_sysjoystick.c:(.text+0xab8): undefined reference to `hid_init'
/usr/obj.earmv6hf/pkgsrc/emulators/PC6001VX/work.earmv6hf/.buildlink/lib/libSDL2.a(SDL_rpimouse.o): In function `RPI_WarpMouseGlobal':
SDL_rpimouse.c:(.text+0x78): undefined reference to `vc_dispmanx_update_start'
SDL_rpimouse.c:(.text+0xe0): undefined reference to `vc_dispmanx_element_change_attributes'
SDL_rpimouse.c:(.text+0xf4): undefined reference to `vc_dispmanx_update_submit'
/usr/obj.earmv6hf/pkgsrc/emulators/PC6001VX/work.earmv6hf/.buildlink/lib/libSDL2.a(SDL_rpimouse.o): In function `RPI_MoveCursor':
SDL_rpimouse.c:(.text+0x184): undefined reference to `vc_dispmanx_update_start'
SDL_rpimouse.c:(.text+0x1ec): undefined reference to `vc_dispmanx_element_change_attributes'
SDL_rpimouse.c:(.text+0x200): undefined reference to `vc_dispmanx_update_submit'
/usr/obj.earmv6hf/pkgsrc/emulators/PC6001VX/work.earmv6hf/.buildlink/lib/libSDL2.a(SDL_rpimouse.o): In function `RPI_FreeCursor':
SDL_rpimouse.c:(.text+0x280): undefined reference to `vc_dispmanx_update_start'
SDL_rpimouse.c:(.text+0x28c): undefined reference to `vc_dispmanx_element_remove'
SDL_rpimouse.c:(.text+0x294): undefined reference to `vc_dispmanx_update_submit_sync'
SDL_rpimouse.c:(.text+0x2a4): undefined reference to `vc_dispmanx_resource_delete'
/usr/obj.earmv6hf/pkgsrc/emulators/PC6001VX/work.earmv6hf/.buildlink/lib/libSDL2.a(SDL_rpimouse.o): In function `RPI_ShowCursor':
SDL_rpimouse.c:(.text+0x350): undefined reference to `vc_dispmanx_rect_set'
SDL_rpimouse.c:(.text+0x36c): undefined reference to `vc_dispmanx_rect_set'
SDL_rpimouse.c:(.text+0x374): undefined reference to `vc_dispmanx_update_start'
SDL_rpimouse.c:(.text+0x3c4): undefined reference to `vc_dispmanx_element_add'
SDL_rpimouse.c:(.text+0x3d0): undefined reference to `vc_dispmanx_update_submit_sync'
SDL_rpimouse.c:(.text+0x408): undefined reference to `vc_dispmanx_update_start'
SDL_rpimouse.c:(.text+0x414): undefined reference to `vc_dispmanx_element_remove'
SDL_rpimouse.c:(.text+0x41c): undefined reference to `vc_dispmanx_update_submit_sync'
/usr/obj.earmv6hf/pkgsrc/emulators/PC6001VX/work.earmv6hf/.buildlink/lib/libSDL2.a(SDL_rpimouse.o): In function `RPI_CreateCursor':
SDL_rpimouse.c:(.text+0x4b4): undefined reference to `vc_dispmanx_resource_create'
SDL_rpimouse.c:(.text+0x4d8): undefined reference to `vc_dispmanx_rect_set'
SDL_rpimouse.c:(.text+0x4f0): undefined reference to `vc_dispmanx_resource_write_data'
*** [PC6001VX] Error code 1

make: stopped in /usr/obj.earmv6hf/pkgsrc/emulators/PC6001VX/work.earmv6hf/PC6001VX_3.0.0_src
1 error

make: stopped in /usr/obj.earmv6hf/pkgsrc/emulators/PC6001VX/work.earmv6hf/PC6001VX_3.0.0_src
*** Error code 2

Stop.
make[1]: stopped in /usr/pkgsrc/emulators/PC6001VX
*** Error code 1

Stop.
make: stopped in /usr/pkgsrc/emulators/PC6001VX

---

>How-To-Repeat:
% cd /usr/pkgsrc/emulator/PC6001VX
% make package
on RPI3

>Fix:
It looks these missing symbols are in /usr/pkg/lib/libvchostif.a
from raspberrypi-userland.

Needs to build shared libvchostif.so in raspberrypi-userland package,
or explicitly link these static libraries on SDL2 builds?

>Release-Note:

>Audit-Trail:
From: coypu@sdf.org
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/53746: pkgsrc/devel/SDL2 on NetBSD/arm 8.0 causes undefined
 reference
Date: Mon, 26 Nov 2018 19:18:11 +0000

 The logic SDL2-with-autoconf seems to be using is, in configure.in
 (configure is a generated file)

 CheckRPI()
 {
     AC_ARG_ENABLE(video-rpi,
 AC_HELP_STRING([--enable-video-rpi], [use Raspberry Pi video driver [[default=yes]]]),
                   , enable_video_rpi=yes)
     if test x$enable_video = xyes -a x$enable_video_rpi = xyes; then
         AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
         if test x$PKG_CONFIG != xno && $PKG_CONFIG --exists bcm_host; then
             RPI_CFLAGS=`$PKG_CONFIG --cflags bcm_host brcmegl`
             RPI_LDFLAGS=`$PKG_CONFIG --libs bcm_host brcmegl`
         elif test x$ARCH = xnetbsd; then
             RPI_CFLAGS="-I/usr/pkg/include -I/usr/pkg/include/interface/vcos/pthreads -I/usr/pkg/include/interface/vmcs_host/linux"
             RPI_LDFLAGS="-Wl,-R/usr/pkg/lib -L/usr/pkg/lib -lbcm_host"
         else
             RPI_CFLAGS="-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux"
             RPI_LDFLAGS="-Wl,-rpath,/opt/vc/lib -L/opt/vc/lib -lbcm_host"
         fi

 probably either:
 - Add a pkgconfig element here that includes libvchostif.
 - Amend pkgconfig files to list all required libraries for using brcmegl / bcm_host

From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
To: gnats-bugs@NetBSD.org
Cc: tsutsui@ceres.dti.ne.jp
Subject: Re: pkg/53746: pkgsrc/devel/SDL2 on NetBSD/arm 8.0 causes undefined
	 reference
Date: Wed, 28 Nov 2018 22:12:39 +0900

 It looks upstream of raspberrypi-userland has an issue and
 (rejected) pull request for the vchostif lib:

 https://github.com/raspberrypi/firmware/issues/149
 https://github.com/raspberrypi/userland/pull/304

 ---
 Izumi Tsutsui

From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
To: gnats-bugs@NetBSD.org
Cc: tsutsui@ceres.dti.ne.jp
Subject: Re: pkg/53746: pkgsrc/devel/SDL2 on NetBSD/arm 8.0 causes undefinedreference
Date: Sat, 1 Dec 2018 21:34:26 +0900

 > It looks upstream of raspberrypi-userland has an issue and
 > (rejected) pull request for the vchostif lib:
 > 
 > https://github.com/raspberrypi/firmware/issues/149
 > https://github.com/raspberrypi/userland/pull/304

 The following patch (build libvchostif.so instead of libvchostif.a)
 solves the problem:

 https://gist.github.com/tsutsui/1f6f35610c0d7a51e475a3053c20b879

 Index: PLIST
 ===================================================================
 RCS file: /cvsroot/pkgsrc/misc/raspberrypi-userland/PLIST,v
 retrieving revision 1.4
 diff -u -p -r1.4 PLIST
 --- PLIST	1 Nov 2016 16:45:27 -0000	1.4
 +++ PLIST	1 Dec 2018 11:48:53 -0000
 @@ -243,7 +243,7 @@ lib/libmmal_vc_client.so
  lib/libopenmaxil.so
  lib/libvcfiled_check.a
  lib/libvchiq_arm.so
 -lib/libvchostif.a
 +lib/libvchostif.so
  lib/libvcilcs.a
  lib/libvcos.so
  lib/libvcsm.so
 Index: distinfo
 ===================================================================
 RCS file: /cvsroot/pkgsrc/misc/raspberrypi-userland/distinfo,v
 retrieving revision 1.9
 diff -u -p -r1.9 distinfo
 --- distinfo	16 Apr 2017 19:25:25 -0000	1.9
 +++ distinfo	1 Dec 2018 11:48:53 -0000
 @@ -9,4 +9,5 @@ SHA1 (patch-host__applications_linux_app
  SHA1 (patch-host__applications_linux_apps_tvservice_tvservice.c) = 2cc304252c102d46603f6649eb959984e9d44b1f
  SHA1 (patch-interface_vchiq__arm_vchiq__lib.c) = a9535aa96ba3374f2a559899c6baff9ddc935f3f
  SHA1 (patch-interface_vcos_CMakeLists.txt) = f96c052af9c1d10f3f386efc1b5d0006559e4e67
 +SHA1 (patch-interface_vmcs__host_CMakeLists.txt) = 39640e8a443fb966a1d40e0d8ccfa3a6aa510814
  SHA1 (patch-interface_vmcs__host_linux_vcfiled_CMakeLists.txt) = 29694762b02a75749300ebfb4fe78464f2ac20ff
 --- /dev/null	2018-12-01 19:36:39.062391837 +0900
 +++ patches/patch-interface_vmcs__host_CMakeLists.txt	2018-12-01 14:44:24.414015257 +0900
 @@ -0,0 +1,16 @@
 +$NetBSD$
 +
 +- build libvchostif as shared lib to avoid undefined references
 +  on linking libEGL.so
 +
 +--- interface/vmcs_host/CMakeLists.txt.orig	2017-01-07 08:24:37.000000000 +0000
 ++++ interface/vmcs_host/CMakeLists.txt
 +@@ -9,7 +9,7 @@ add_definitions(-fno-strict-aliasing)
 + 
 + include_directories(${VMCS_TARGET}/vcfiled)
 + 
 +-add_library(vchostif
 ++add_library(vchostif SHARED
 +             ${VMCS_TARGET}/vcfilesys.c ${VMCS_TARGET}/vcmisc.c
 +             vc_vchi_gencmd.c vc_vchi_filesys.c
 +             vc_vchi_tvservice.c vc_vchi_cecservice.c


 ---
 Izumi Tsutsui

Responsible-Changed-From-To: pkg-manager->jmcneill
Responsible-Changed-By: bsiegert@NetBSD.org
Responsible-Changed-When: Wed, 05 Dec 2018 10:45:08 +0000
Responsible-Changed-Why:
Over to Jared for raspberrypi-userland.

Jared, is the proposed patch OK to commit?


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.