NetBSD Problem Report #51970

From www@NetBSD.org  Tue Feb 14 23:34:19 2017
Return-Path: <www@NetBSD.org>
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 "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 47D5A7A1F8
	for <gnats-bugs@gnats.NetBSD.org>; Tue, 14 Feb 2017 23:34:19 +0000 (UTC)
Message-Id: <20170214233417.824A37A295@mollari.NetBSD.org>
Date: Tue, 14 Feb 2017 23:34:17 +0000 (UTC)
From: rokuyama@rk.phys.keio.ac.jp
Reply-To: rokuyama@rk.phys.keio.ac.jp
To: gnats-bugs@NetBSD.org
Subject: Ethernet (libpcap) support not compiled in emulators/simh (4.0.0.20161218)
X-Send-Pr-Version: www-1.0

>Number:         51970
>Category:       pkg
>Synopsis:       Ethernet (libpcap) support not compiled in emulators/simh (4.0.0.20161218)
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    pkg-manager
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Feb 14 23:35:00 +0000 2017
>Closed-Date:    Tue Mar 14 04:58:45 +0000 2017
>Last-Modified:  Tue Mar 14 04:58:45 +0000 2017
>Originator:     Rin Okuyama
>Release:        7.99.59 + pkgsrc-current
>Organization:
Faculty of Science and Technology, Keio University
>Environment:
NetBSD latipes 7.99.59 NetBSD 7.99.59 (LATIPES) #0: Thu Feb  9 04:05:21 JST 2017  rin@latipes:/var/build/src/sys/arch/amd64/compile/LATIPES amd64
>Description:
Ethernet support of simh-4.0.0.20161218 does not work:

  % /usr/pkg/bin/simh-vax
  MicroVAX 3900 simulator V4.0-0 Beta        git commit id: 7964e2b7        Build: Unsupported=include+lib
  sim> show eth
  ETH devices:
    network support not available in simulator
  sim> attach xq tap:tap0
  Command not allowed
  sim> q
  Goodbye

It seems that libpcap support is lacking:

  % strings /usr/pkg/bin/simh-vax | grep libpcap
  on the local LAN, the libpcap development package must be installed on

Strangely enough, if gmake manually in the working directory created by
pkgsrc, the resulting binary works just fine:

  % BIN/vax
  MicroVAX 3900 simulator V4.0-0 Beta        git commit id: 7964e2b7
  sim> show eth
  ETH devices:
   eth0   tap:tapN                             (Integrated Tun/Tap support)
   eth1   nat:{optional-nat-parameters}        (Integrated NAT (SLiRP) support)
   eth2   udp:sourceport:remotehost:remoteport (Integrated UDP bridge support)
  libpcap version 1.6.2
  sim> attach xq tap:tap0
  Eth: opened OS device tap0
  sim> q
  Goodbye
  Eth: closed tap0
>How-To-Repeat:
Compile and run emulators/simh from pkgsrc-current or 2016Q4.
The binary package also does not work on amd64.
>Fix:
n/a

>Release-Note:

>Audit-Trail:
From: "Maya Rashish" <maya@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/51970 CVS commit: pkgsrc/emulators/simh
Date: Wed, 15 Feb 2017 01:27:01 +0000

 Module Name:	pkgsrc
 Committed By:	maya
 Date:		Wed Feb 15 01:27:01 UTC 2017

 Modified Files:
 	pkgsrc/emulators/simh: Makefile

 Log Message:
 simh: use networking. bump PKGREVISION.
 fixes PR pkg/51970


 To generate a diff of this commit:
 cvs rdiff -u -r1.44 -r1.45 pkgsrc/emulators/simh/Makefile

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: Rin Okuyama <rokuyama@rk.phys.keio.ac.jp>
To: gnats-bugs@NetBSD.org, maya@NetBSD.org
Cc: 
Subject: Re: pkg/51970: Ethernet (libpcap) support not compiled in
 emulators/simh (4.0.0.20161218)
Date: Wed, 15 Feb 2017 21:40:44 +0900

 Thank you, maya, for your rapid response. However, unfortunately, it
 still does not work properly:

    % /usr/pkg/bin/simh-vax
    MicroVAX 3900 simulator V4.0-0 Beta        git commit id: 7964e2b7        Build: Unsupported=include+lib
    sim> show eth
    ETH devices:
     eth0   tap:tapN                             (Integrated Tun/Tap support)
     eth1   nat:{optional-nat-parameters}        (Integrated NAT (SLiRP) support)
     eth2   udp:sourceport:remotehost:remoteport (Integrated UDP bridge support)
    sim> attach xq tap:tap0
    Eth: opened OS device tap0
    Wed Feb 15 20:09:58 2017
    Sockets: eth_reader(tap):  error 35 - Operation would block
    Wed Feb 15 20:09:59 2017
    Sockets: eth_reader(tap):  error 35 - Operation would block
    sim> q
    Goodbye
    Eth: closed tap0

 In addition, with your patch which adds -DUSE_NETWORK to CFLAGS, simh-vax
 is linked to libpcap, but binary generated by manually executed gmake, is
 not linked:

    % ldd /usr/pkg/bin/simh-vax | grep libpcap
            -lpcap.5 => /usr/lib/libpcap.so.5
    % ldd BIN/vax | grep libpcap
    %

 The latter dynamically loads libpcap when it is necessary, as its
 makefile says:

    21  # Dynamic loading of libpcap is the preferred default behavior if pcap.h
    22  # is available at build time.  Support to statically linking against libpcap
    23  # is deprecated and may be removed in the future.  Static linking against
    24  # libpcap can be enabled if GNU make is invoked with USE_NETWORK=1 on the
    25  # command line.

From: coypu@SDF.ORG
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/51970: Ethernet (libpcap) support not compiled in
Date: Wed, 15 Feb 2017 23:00:23 +0000

 Hmm, on my end it tries to open /dev/bpf and complains about
 permissions - does it really require root? seems excessive.

From: Rin Okuyama <rokuyama@rk.phys.keio.ac.jp>
To: gnats-bugs@NetBSD.org, coypu@SDF.ORG, hans@NetBSD.org
Cc: 
Subject: Re: pkg/51970: Ethernet (libpcap) support not compiled in
Date: Thu, 16 Feb 2017 22:05:51 +0900

 On 2017/02/16 8:05, coypu@SDF.ORG wrote:
 >  Hmm, on my end it tries to open /dev/bpf and complains about
 >  permissions - does it really require root? seems excessive.

 It requires the read and write permissions of /dev/bpf when it uses
 the Berkeley packet filter... Maya, I must say, please do not commit
 anything you cannot test by yourself (although I really appreciate
 your contributions to NetBSD).

 Anyway, It seems that environment variables INCLUDES and LIBRARIES
 confuse simh to fail to detect what libraries we have. By reverting
 partially Makefile r1.44 (and r1.45), I obtained binaries with
 working network support on NetBSD. But these environment variables
 are necessary for other platforms? Hans, how do you think about it?

 Thanks,
 rin

 Index: Makefile
 ===================================================================
 RCS file: /cvs/cvsroot/pkgsrc/emulators/simh/Makefile,v
 retrieving revision 1.45
 diff -u -r1.45 Makefile
 --- Makefile	15 Feb 2017 01:27:00 -0000	1.45
 +++ Makefile	16 Feb 2017 12:44:28 -0000
 @@ -2,7 +2,7 @@

   DISTNAME=	simh-4.0.0
   PKGNAME=	simh-4.0.0.20161218
 -PKGREVISION=	1
 +PKGREVISION=	2
   CATEGORIES=	emulators
   MASTER_SITES=	${MASTER_SITE_GITHUB:=simh/}
   GITHUB_PROJECT=	simh
 @@ -33,24 +33,9 @@
   CFLAGS.SunOS+=	-DBSD_COMP
   LDFLAGS.SunOS+=	-lm

 -CFLAGS+=		-DUSE_NETWORK
 -LDFLAGS+=		-lpcap
 -
   INSTALLATION_DIRS=	bin share/simh share/doc/simh

   MAKE_FILE=		makefile
 -INCLUDES=		${PREFIX:Q}/include:\
 -			${BUILDLINK_PREFIX.SDL_ttf:Q}/include/SDL:\
 -			${BUILDLINK_PREFIX.libpcap:Q}/include/pcap:\
 -			${BUILDLINK_PREFIX.pcre:Q}/include/pcre:\
 -			${BUILDLINK_PREFIX.png:Q}/include
 -LIBRARIES=		${PREFIX:Q}/lib:\
 -			${BUILDLINK_PREFIX.SDL_ttf:Q}/lib${LIBABISUFFIX}:\
 -			${BUILDLINK_PREFIX.libpcap:Q}/lib${LIBABISUFFIX}:\
 -			${BUILDLINK_PREFIX.pcre:Q}/lib${LIBABISUFFIX}:\
 -			${BUILDLINK_PREFIX.png:Q}/lib${LIBABISUFFIX}
 -MAKE_ENV+=		INCLUDES=${INCLUDES:Q}
 -MAKE_ENV+=		LIBRARIES=${LIBRARIES:Q}
   MAKE_ENV+=		GCC=${CC:Q}
   MAKE_ENV+=		OS_LDFLAGS=${LDFLAGS:Q} CFLAGS_O=${CFLAGS:Q}


From: coypu@SDF.ORG
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/51970: Ethernet (libpcap) support not comp
Date: Thu, 16 Feb 2017 14:37:17 +0000

 I use about 150 packages and just one OS. if I limited myself
 to those then I wouldn't be responding to any pkg bug reports,
 most of which are to do with bugs on other operating systems.

 I try to match my testing to the change. I don't usually
 update packages which I don't know how to use and don't have
 tests, but linking in libpcap is pretty minor and didn't
 fail to build or a quick smoke test.

 In this case it probably would've been better to send a patch.

From: Hans Rosenfeld <hans@NetBSD.org>
To: Rin Okuyama <rokuyama@rk.phys.keio.ac.jp>
Cc: gnats-bugs@NetBSD.org, coypu@SDF.ORG
Subject: Re: pkg/51970: Ethernet (libpcap) support not compiled in
Date: Tue, 21 Feb 2017 17:41:02 +0100

 I've tested that patch on OmniOS, and with those changes the simh build
 will neither detect pcap for networking nor SDL or pcre. As it's
 currently in CVS it will build correctly except for SDL_ttf.

 Are you sure that this patch really works on NetBSD? That is, it
 actually detects and uses all the libraries it is supposed to? Can you
 send me the output of the first build step, where the makefile prints
 what it detected and what it will build?


 Hans



 On Thu, Feb 16, 2017 at 10:05:51PM +0900, Rin Okuyama wrote:
 > On 2017/02/16 8:05, coypu@SDF.ORG wrote:
 > >  Hmm, on my end it tries to open /dev/bpf and complains about
 > >  permissions - does it really require root? seems excessive.
 > 
 > It requires the read and write permissions of /dev/bpf when it uses
 > the Berkeley packet filter... Maya, I must say, please do not commit
 > anything you cannot test by yourself (although I really appreciate
 > your contributions to NetBSD).
 > 
 > Anyway, It seems that environment variables INCLUDES and LIBRARIES
 > confuse simh to fail to detect what libraries we have. By reverting
 > partially Makefile r1.44 (and r1.45), I obtained binaries with
 > working network support on NetBSD. But these environment variables
 > are necessary for other platforms? Hans, how do you think about it?
 > 
 > Thanks,
 > rin

 -- 
 %SYSTEM-F-ANARCHISM, The operating system has been overthrown

From: Rin Okuyama <rokuyama@rk.phys.keio.ac.jp>
To: Hans Rosenfeld <hans@NetBSD.org>
Cc: gnats-bugs@NetBSD.org, coypu@SDF.ORG
Subject: Re: pkg/51970: Ethernet (libpcap) support not compiled in
Date: Wed, 22 Feb 2017 05:50:23 +0900

 On 2017/02/22 1:41, Hans Rosenfeld wrote:
 > I've tested that patch on OmniOS, and with those changes the simh build
 > will neither detect pcap for networking nor SDL or pcre. As it's
 > currently in CVS it will build correctly except for SDL_ttf.
 >
 > Are you sure that this patch really works on NetBSD? That is, it
 > actually detects and uses all the libraries it is supposed to? Can you
 > send me the output of the first build step, where the makefile prints
 > what it detected and what it will build?

 My patch works just fine on NetBSD. The output of first build step reads:

 lib paths are: /usr/lib /usr/pkg/lib /usr/X11R7/lib
 include paths are: /usr/include /usr/pkg/include /usr/X11R7/include
 using libm: /usr/lib/libm.so
 using librt: /usr/lib/librt.so
 using libpthread: /usr/lib/libpthread.so /usr/include/pthread.h
 using libpcreposix: /usr/pkg/lib/libpcreposix.so /usr/pkg/include/pcreposix.h
 using libdl: /usr/include/dlfcn.h
 using mman: /usr/include/sys/mman.h
 using libSDL: /usr/pkg/include/SDL/SDL.h
 using libpcap: /usr/include/pcap.h
 ***
 *** all Simulators being built with:
 *** - compiler optimizations and no debugging support. GCC Version: 5.4.0.
 *** - dynamic networking support using NetBSD provided libpcap components.
 *** - Local LAN packet transports: PCAP TAP NAT(SLiRP)
 *** - video capabilities provided by libSDL (Simple Directmedia Layer).
 ***
 *** git commit id is 7964e2b72d9cad0309afa7da08dd7e5e2336cd37.
 ***
 font paths are:
 font names are: DejaVuSans.ttf LucidaSansRegular.ttf FreeSans.ttf AppleGothic.ttf tahoma.ttf
 ***
 *** No font file available, BESM-6 video panel disabled.
 ***
 *** To enable the panel display please specify one of:
 ***          a font path with FONTNAME=path
 ***          a font name with FONTNAME=fontname.ttf
 ***          a font file with FONTFILE=path/fontname.ttf
 ***
 *** No SDL ttf support available.  BESM-6 video panel disabled.
 ***

 Here, I've uploaded full script(1) log of the building and test run:

    http://www.netbsd.org/~rin/simh_20160222.txt

 Here, 192.168.10.128 is the IP address of host. That is, the guest
 successfully communicates with the host via tap(4).

 Thanks,
 rin

From: Hans Rosenfeld <hans@NetBSD.org>
To: Rin Okuyama <rokuyama@rk.phys.keio.ac.jp>
Cc: gnats-bugs@NetBSD.org, coypu@SDF.ORG
Subject: Re: pkg/51970: Ethernet (libpcap) support not compiled in
Date: Wed, 22 Feb 2017 17:09:57 +0100

 Thanks Rin. 

 Can you please add the output of the "show ethernet" command in simh?
 IIRC tap networking doesn't use pcap at all, and on a system with real
 pcap networking that command will list the available devices that pcap
 can use. This is what it looks like in a zone on my OmniOS system:

 sim> show ethernet
 ETH devices:
  eth0   pkgsrc0                              (No description available)
  eth1   nat:{optional-nat-parameters}        (Integrated NAT (SLiRP) support)
  eth2   udp:sourceport:remotehost:remoteport (Integrated UDP bridge support)

 Here pkgsrc0 is the name of an interface, a vnic in this case.


 Apart from that it's interesting that the simh makefile detects all the
 other stuff on NetBSD. Perhaps we should patch the makefile to simplify
 this for all platforms. I'm not sure I have time for that now, so
 perhaps you could make those variables conditional on the operating
 system instead of ripping them out?


 -- 
 %SYSTEM-F-ANARCHISM, The operating system has been overthrown

From: Rin Okuyama <rokuyama@rk.phys.keio.ac.jp>
To: Hans Rosenfeld <hans@NetBSD.org>
Cc: gnats-bugs@NetBSD.org, coypu@SDF.ORG
Subject: Re: pkg/51970: Ethernet (libpcap) support not compiled in
Date: Thu, 23 Feb 2017 03:26:33 +0900

 On 2017/02/23 1:09, Hans Rosenfeld wrote:
 > Can you please add the output of the "show ethernet" command in simh?

 sim> show ethernet
 ETH devices:
   eth0   wm0                                  (No description available)
   eth1   tap0                                 (No description available)
   eth2   tap1                                 (No description available)
   eth3   tap:tapN                             (Integrated Tun/Tap support)
   eth4   nat:{optional-nat-parameters}        (Integrated NAT (SLiRP) support)
   eth5   udp:sourceport:remotehost:remoteport (Integrated UDP bridge support)
 libpcap version 1.6.2

 > Apart from that it's interesting that the simh makefile detects all the
 > other stuff on NetBSD. Perhaps we should patch the makefile to simplify
 > this for all platforms. I'm not sure I have time for that now, so
 > perhaps you could make those variables conditional on the operating
 > system instead of ripping them out?

 I examined logic in makefile related to INCLUDES and LIBRARIES, and
 found that they do not search /usr/include (/usr/lib) when (1)
 INCLUDES (LIBRARIES) is specified and (2) /usr/include (/usr/lib) is
 not explicitly included in it.

 For NetBSD with Makefile r1.44 and r1.45, /usr/include is excluded
 from INCLUDES. Therefore, simh cannot find pthread.h, dlfcn.h, and
 mman.h. This is why ethernet support does not work (libpcap cannot
 be loaded dynamically).

 With the attached patch, it works fine on NetBSD. Can you please
 test it on OmniOS? If there's no problem, I will commit it!

 Thanks,
 rin
 ====
 Index: Makefile
 ===================================================================
 RCS file: /cvs/cvsroot/pkgsrc/emulators/simh/Makefile,v
 retrieving revision 1.45
 diff -u -r1.45 Makefile
 --- Makefile	15 Feb 2017 01:27:00 -0000	1.45
 +++ Makefile	22 Feb 2017 17:39:19 -0000
 @@ -2,7 +2,7 @@

   DISTNAME=	simh-4.0.0
   PKGNAME=	simh-4.0.0.20161218
 -PKGREVISION=	1
 +PKGREVISION=	2
   CATEGORIES=	emulators
   MASTER_SITES=	${MASTER_SITE_GITHUB:=simh/}
   GITHUB_PROJECT=	simh
 @@ -33,18 +33,17 @@
   CFLAGS.SunOS+=	-DBSD_COMP
   LDFLAGS.SunOS+=	-lm

 -CFLAGS+=		-DUSE_NETWORK
 -LDFLAGS+=		-lpcap
 -
   INSTALLATION_DIRS=	bin share/simh share/doc/simh

   MAKE_FILE=		makefile
 -INCLUDES=		${PREFIX:Q}/include:\
 +INCLUDES=		/usr/include:\
 +			${PREFIX:Q}/include:\
   			${BUILDLINK_PREFIX.SDL_ttf:Q}/include/SDL:\
   			${BUILDLINK_PREFIX.libpcap:Q}/include/pcap:\
   			${BUILDLINK_PREFIX.pcre:Q}/include/pcre:\
   			${BUILDLINK_PREFIX.png:Q}/include
 -LIBRARIES=		${PREFIX:Q}/lib:\
 +LIBRARIES=		/usr/lib:\
 +			${PREFIX:Q}/lib:\
   			${BUILDLINK_PREFIX.SDL_ttf:Q}/lib${LIBABISUFFIX}:\
   			${BUILDLINK_PREFIX.libpcap:Q}/lib${LIBABISUFFIX}:\
   			${BUILDLINK_PREFIX.pcre:Q}/lib${LIBABISUFFIX}:\

From: Hans Rosenfeld <hans@NetBSD.org>
To: Rin Okuyama <rokuyama@rk.phys.keio.ac.jp>
Cc: gnats-bugs@NetBSD.org, coypu@SDF.ORG
Subject: Re: pkg/51970: Ethernet (libpcap) support not compiled in
Date: Thu, 23 Feb 2017 00:16:00 +0100

 Thanks, that seems to work. Perhaps it would make sense to move those
 directories to the end of the search path, so that pkgsrc paths are
 looked up first? Or do the wrappers take care of reordering?

 Also, I wouldn't make that /usr/lib but /usr/lib${LIBABISUFFIX}.


 -- 
 %SYSTEM-F-ANARCHISM, The operating system has been overthrown

From: "Rin Okuyama" <rin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/51970 CVS commit: pkgsrc/emulators/simh
Date: Thu, 23 Feb 2017 10:18:06 +0000

 Module Name:	pkgsrc
 Committed By:	rin
 Date:		Thu Feb 23 10:18:06 UTC 2017

 Modified Files:
 	pkgsrc/emulators/simh: Makefile

 Log Message:
 PR pkg/51970: Ethernet (libpcap) support not compiled in

 Make sure that /usr/include and /usr/lib${LIBABISUFFIX} always appear in the
 search paths for headers and libraries, respectively.

 Fix the broken ethernet support (and etc) on platforms like NetBSD.

 Thanks hans for his valuable suggestions.


 To generate a diff of this commit:
 cvs rdiff -u -r1.45 -r1.46 pkgsrc/emulators/simh/Makefile

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: Rin Okuyama <rokuyama@rk.phys.keio.ac.jp>
To: Hans Rosenfeld <hans@NetBSD.org>
Cc: gnats-bugs@NetBSD.org, coypu@SDF.ORG
Subject: Re: pkg/51970: Ethernet (libpcap) support not compiled in
Date: Thu, 23 Feb 2017 19:20:31 +0900

 On 2017/02/23 8:16, Hans Rosenfeld wrote:
 > Thanks, that seems to work. Perhaps it would make sense to move those
 > directories to the end of the search path, so that pkgsrc paths are
 > looked up first? Or do the wrappers take care of reordering?
 >
 > Also, I wouldn't make that /usr/lib but /usr/lib${LIBABISUFFIX}.

 Thank you for your comments. I revised the patch and committed it.

 rin

State-Changed-From-To: open->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Tue, 14 Mar 2017 04:58:45 +0000
State-Changed-Why:
committed last month


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.