Bug 240349

Summary: sysutils/lsof: Build fails on 13-CURRENT after base r351594
Product: Ports & Packages Reporter: Yasuhiro Kimura <yasu>
Component: Individual Port(s)Assignee: Larry Rosenman <ler>
Status: Closed Overcome By Events    
Severity: Affects Some People CC: kib, peterj, woodsb02
Priority: --- Keywords: needs-qa, regression
Version: LatestFlags: bugzilla: maintainer-feedback? (ler)
Hardware: Any   
OS: Any   
Attachments:
Description Flags
Patch file none

Description Yasuhiro Kimura freebsd_committer freebsd_triage 2019-09-05 09:59:27 UTC
After base r351594 build fails on 13-CURRENT as following.

===>  Building for lsof-4.93.2_4,8                                                                                           (cd lib; /usr/bin/make DEBUG="-O2" CFGF="-pipe -fstack-protector-strong -fno-strict-aliasing -DNEEDS_BOOL_TYPEDEF -DHASTASKS -DHAS_PAUSE_SBT -DHAS_DUP2 -DHAS_CLOSEFROM -DHASEFFNLINK=i_effnlink -DHASF_VNODE -DHAS_FILEDESCENT -DHAS_TMPFS -DHASWCTYPE_H -DHASSBSTATE -DHAS_KVM_VNODE -DHAS_UFS1_2 -DHAS_NO_IDEV -DHAS_VM_MEMATTR_T -DNEEDS_DEVICE_T -DHAS_CDEV2PRIV -DHAS_NO_SI_UDEV -DHAS_SYS_SX_H -DHASFUSEFS -DHAS_ZFS -DHAS_V_LOCKF -DHAS_LOCKF_ENTRY -DHAS_NO_6PORT -DHAS_NO_6PPCB -DNEEDS_BOOLEAN_T -DHAS_SB_CCC -DHAS_FDESCENTTBL -DFREEBSDV=13000 -DHASFDESCFS=2 -DHASPSEUDOFS -DHASNULLFS -DHASIPv6 -DHASUTMPX -DHAS_STRFTIME -DLSOF_VSTR=\"13.0-CURRENT\"")                                                                                                       cc   -pipe -fstack-protector-strong -fno-strict-aliasing -DNEEDS_BOOL_TYPEDEF -DHASTASKS -DHAS_PAUSE_SBT -DHAS_DUP2 -DHAS_CLOSEFROM -DHASEFFNLINK=i_effnlink -DHASF_VNODE -DHAS_FILEDESCENT -DHAS_TMPFS -DHASWCTYPE_H -DHASSBSTATE -DHAS_KVM_VNODE -DHAS_UFS1_2 -DHAS_NO_IDEV -DHAS_VM_MEMATTR_T -DNEEDS_DEVICE_T -DHAS_CDEV2PRIV -DHAS_NO_SI_UDEV -DHAS_SYS_SX_H -DHASFUSEFS -DHAS_ZFS -DHAS_V_LOCKF -DHAS_LOCKF_ENTRY -DHAS_NO_6PORT -DHAS_NO_6PPCB -DNEEDS_BOOLEAN_T -DHAS_SB_CCC -DHAS_FDESCENTTBL -DFREEBSDV=13000 -DHASFDESCFS=2 -DHASPSEUDOFS -DHASNULLFS -DHASIPv6 -DHASUTMPX -DHAS_STRFTIME -DLSOF_VSTR="13.0-CURRENT" -I/usr/src/sys -O2 -c ckkv.c -o ckkv.o
In file included from ckkv.c:43:
In file included from ./../lsof.h:221:
In file included from ./../dlsof.h:412:
In file included from /usr/src/sys/sys/file.h:44:
In file included from /usr/src/sys/sys/refcount.h:36:
In file included from /usr/src/sys/sys/systm.h:126:
In file included from /usr/src/sys/sys/pcpu.h:223:
/usr/include/machine/pcpu_aux.h:55:55: error: expected expression
        __asm("movq %%gs:%P1,%0" : "=r" (td) : "n" (offsetof(struct pcpu,
                                                             ^ 
/usr/include/machine/pcpu_aux.h:56:6: error: use of undeclared identifier 'pc_curthread'; did you mean '__curthread'?
            pc_curthread)));
            ^
/usr/include/machine/pcpu_aux.h:51:1: note: '__curthread' declared here
__curthread(void)
^
/usr/include/machine/pcpu_aux.h:66:56: error: expected expression
        __asm("movq %%gs:%P1,%0" : "=r" (pcb) : "n" (offsetof(struct pcpu,
                                                              ^
/usr/include/machine/pcpu_aux.h:67:6: error: use of undeclared identifier 'pc_curpcb'; did you mean '__curpcb'?
            pc_curpcb)));
            ^
/usr/include/machine/pcpu_aux.h:62:1: note: '__curpcb' declared here
__curpcb(void)
^
4 errors generated.
*** Error code 1

Stop.
make[2]: stopped in /usr0/freebsd/ports/work/net/freebsd/ports/head/sysutils/lsof/work/lsof-4.93.2/lib
*** Error code 1

Stop.
make[1]: stopped in /usr0/freebsd/ports/work/net/freebsd/ports/head/sysutils/lsof/work/lsof-4.93.2
*** Error code 1

Stop.
make: stopped in /net/freebsd/ports/head/sysutils/lsof
Comment 1 Peter Jeremy freebsd_committer freebsd_triage 2019-09-11 01:40:35 UTC
offsetof() is referenced from the #include chain starting at dlsof.h:412 but is only defined in <stddef.h>, which is included at dlsof.h:698

Adding a #include <stddef.h> to the #include block near the top of dlsof.h appeals to fix the problem.
Comment 2 Larry Rosenman freebsd_committer freebsd_triage 2019-09-11 01:49:01 UTC
Feel free to submit a PR to https://github.com/lsof-org/lsof.

I'm done fighting this battle and getting ZERO help to modernize the KPI/API/etc.
Comment 3 Yasuhiro Kimura freebsd_committer freebsd_triage 2019-09-11 09:51:28 UTC
Created attachment 207374 [details]
Patch file

(In reply to Peter Jeremy from comment #1)

Thanks for suggestion. I applied attached patch and build completed successfully.
Comment 4 Ben Woods freebsd_committer freebsd_triage 2019-10-01 11:35:19 UTC
(In reply to Yasuhiro KIMURA from comment #3)
This patch fixed this for me on FreeBSD 13-CURRENT.
Comment 5 Tobias Kortkamp freebsd_committer freebsd_triage 2019-10-24 07:54:38 UTC
Can we commit this patch?
Comment 6 Ben Woods freebsd_committer freebsd_triage 2019-10-24 10:54:33 UTC
(In reply to Larry Rosenman from comment #2)
Hi Larry,
As a fellow maintainer, I understand your frustration.
That said, would you be happy if I committed this patch for you, and also submitted an upstream pull request?
Regards,
Ben
Comment 7 Yasuhiro Kimura freebsd_committer freebsd_triage 2019-10-29 05:38:04 UTC
The problem is fixed with commit of ports r515923.