Bug 210429 - sysutils/smartmontools: incomplete type variable declaration leads to build failure
Summary: sysutils/smartmontools: incomplete type variable declaration leads to build f...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Many People
Assignee: freebsd-ports-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-06-21 10:51 UTC by bkazemi
Modified: 2016-07-09 00:15 UTC (History)
3 users (show)

See Also:
vlad-fbsd: maintainer-feedback+


Attachments
proposed patch (2.02 KB, patch)
2016-07-04 15:33 UTC, Gleb Smirnoff
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description bkazemi 2016-06-21 10:51:54 UTC
When updating to the latest smartmontools (6.5_1), I run into this error:

c++ -DHAVE_CONFIG_H -I.  -DBUILD_INFO='"(local build)"' -DSMARTMONTOOLS_SYSCONFDIR='"/usr/local/etc"' -DSMARTMONTOOLS_SMARTDSCRIPTDIR='"/usr/local/etc"' -DSMARTMONTOOLS_DRIVEDBDIR='"/usr/local/share/smartmontools"'        -O2 -pipe -fstack-protector -fno-strict-aliasing  -Wall -W -c -o smartd.o smartd.cpp
/bin/sh ./config.status --file=update-smart-drivedb
/bin/sh ./config.status --file=smartd_warning.sh
os_freebsd.cpp:552:26: error: variable has incomplete type
      'struct nvme_pt_command'
  struct nvme_pt_command pt;
                         ^
os_freebsd.cpp:552:10: note: forward declaration of 'nvme_pt_command'
  struct nvme_pt_command pt;
         ^
os_freebsd.cpp:567:32: error: invalid application of 'sizeof' to an incomplete
      type 'struct nvme_pt_command'
  int status = ioctl(get_fd(), NVME_PASSTHROUGH_CMD, &pt);
                               ^~~~~~~~~~~~~~~~~~~~
./freebsd_nvme_ioctl.h:32:30: note: expanded from macro 'NVME_PASSTHROUGH_CMD'
#define NVME_PASSTHROUGH_CMD    _IOWR('n', 0, struct nvme_pt_command)
                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/sys/ioccom.h:61:48: note: expanded from macro '_IOWR'
#define _IOWR(g,n,t)    _IOC(IOC_INOUT, (g), (n), sizeof(t))
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
/usr/include/sys/ioccom.h:55:16: note: expanded from macro '_IOC'
        ((inout) | (((len) & IOCPARM_MASK) << 16) | ((group) << 8) | (num)))
                      ^~~
os_freebsd.cpp:552:10: note: forward declaration of 'nvme_pt_command'
  struct nvme_pt_command pt;
         ^
Comment 1 bkazemi 2016-06-21 11:07:56 UTC
(In reply to bkazemi from comment #0)
Upon further investigation, it looks like the problem is that there is a CPP conditional in ``freebsd_nvme_ioctl.h'' that removes the definition of struct nvme_pt_command (amongst others) when __FreeBSD_version < 1100110. My version is 1100111.
Comment 2 Peter Wemm freebsd_committer freebsd_triage 2016-07-04 06:47:54 UTC
Is there any progress on this?  This is causing pain on the freebsd.org cluster.
Comment 3 Oleksii Samorukov freebsd_committer freebsd_triage 2016-07-04 09:19:28 UTC
I will provide patch in the few next days, apologize for the delay
Comment 4 Peter Wemm freebsd_committer freebsd_triage 2016-07-04 09:48:14 UTC
I discovered an error in our build jail updating process. I *thought* I was running later build jails than I actually was.  It appears to build on HEAD, as of r302331 at least.

I apologize for the noise.
Comment 5 Gleb Smirnoff freebsd_committer freebsd_triage 2016-07-04 15:05:13 UTC
The freebsd_nvme_ioctl.h should include system wide nvme.h for newer versions of FreeBSD. I can provide patch in couple of minutes. Need ports committer to commit it.
Comment 6 Gleb Smirnoff freebsd_committer freebsd_triage 2016-07-04 15:33:20 UTC
Created attachment 172105 [details]
proposed patch

We should either include system wide nvme.h, or on older versions local copy.
Comment 7 Gleb Smirnoff freebsd_committer freebsd_triage 2016-07-05 23:28:23 UTC
It looks like with most recent head the smartmontools is again buildable without any patch to the port required.
Comment 8 Gleb Smirnoff freebsd_committer freebsd_triage 2016-07-05 23:29:07 UTC
bkazemi, can you please confirm that problem is fixed with recent FreeBSD 11 so that we can close the bug?
Comment 9 bkazemi 2016-07-06 05:39:58 UTC
(In reply to Gleb Smirnoff from comment #8)
Alright, went from r302243 to r302361 and smartmontools compiled fine.