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
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.
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.
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.
(In reply to Yasuhiro KIMURA from comment #3) This patch fixed this for me on FreeBSD 13-CURRENT.
Can we commit this patch?
(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
The problem is fixed with commit of ports r515923.