Opened 7 years ago

Closed 6 years ago

#56309 closed defect (fixed)

gpsd: enhance to avoid conflict with mach policy_t type via forthcoming Boost 1.67.0

Reported by: michaelld (Michael Dickens) Owned by: ryandesign (Ryan Carsten Schmidt)
Priority: Normal Milestone:
Component: ports Version:
Keywords: haspatch Cc:
Port: gpsd, boost

Description

gpsd's primary header <gps.h> defines "policy_t" (as a C struct).

<mach/policy.h> defines it too ("typedef int policy_t"); this file is indirectly #include'd via <mach/mach_time.h>.

Boost 1.67.0 changes time handling to include the header <mach/mach_time.h>.

I'm attaching a tarball of a change to gpsd's files that globally does "policy_t" -> "gps_policy_t". This patch changes the API, but it doesn't seem to affect any port that depends on gpsd inside MacPorts, so at least internal to MacPorts this would be a safe change. The global change does actually make some sense for the project, as there are other API variables "gps_*". Getting this fix upstream would be ideal & I will create a ticket on GNU Savanna.

This is the best fix I've come up with for this forthcoming issue (once Boost 1.67.0 is committed). I decided to go the issue route instead of a PR because I think this patch will be controversial & require some discussion.

:info:build In file included from /opt/local/include/boost/thread/shared_mutex.hpp:28:
:info:build In file included from /opt/local/include/boost/thread/pthread/shared_mutex.hpp:14:
:info:build In file included from /opt/local/include/boost/thread/mutex.hpp:16:
:info:build In file included from /opt/local/include/boost/thread/pthread/mutex.hpp:24:
:info:build In file included from /opt/local/include/boost/thread/detail/platform_time.hpp:30:
:info:build In file included from /usr/include/mach/mach_time.h:32:
:info:build In file included from /usr/include/mach/mach_types.h:91:
:info:build In file included from /usr/include/mach/task_info.h:71:
:info:build /usr/include/mach/policy.h:79:17: error: typedef redefinition with different types ('int' vs 'policy_t')
:info:build typedef int                             policy_t;
:info:build                                         ^
:info:build /opt/local/include/gps.h:1905:8: note: previous definition is here
:info:build struct policy_t {
:info:build        ^

Attachments (1)

gpsd.tar.bz2 (4.4 KB) - added by michaelld (Michael Dickens) 7 years ago.

Download all attachments as: .zip

Change History (6)

Changed 7 years ago by michaelld (Michael Dickens)

Attachment: gpsd.tar.bz2 added

comment:1 Changed 7 years ago by michaelld (Michael Dickens)

Owner: set to ryandesign
Status: newassigned

Please note that this issue is really just with any OS using the Mach kernel, so it likely doesn't impact Linux. That said, I think it's wise to fix such type names to be unique for the project, and not something that could easily conflict with type names outside the project.

comment:3 Changed 6 years ago by michaelld (Michael Dickens)

Upstream committed this patch, or something equivalent, to fix the issue. There is no new release yet, so we need to patch locally. I'm going to go ahead and do so by the end of the week unless someone directs me not to. This is a critical building issue with Boost 1.67.0+, and I'm trying to get those dealt with so that I cxan update Boost to 1.68.0.

comment:5 Changed 6 years ago by michaelld (Michael Dickens)

Resolution: fixed
Status: assignedclosed

In ec667ac96dbf111393d59ca8ebb0fdc49392f26e/macports-ports (master):

gpsd: add patch to fix "policy_t" conflict

Closes: #56309

Note: See TracTickets for help on using tickets.