Opened 10 years ago

Closed 10 years ago

Last modified 2 years ago

#43203 closed defect (fixed)

dbus not building on 10.6.8. ‘O_CLOEXEC’ undeclared

Reported by: gnurser (George Nurser) Owned by: MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)
Priority: Normal Milestone:
Component: ports Version: 2.2.1
Keywords: Cc: cooljeanius (Eric Gallager), gnw3, mndavidoff (Monte Davidoff), josephaw@…, ballapete (Peter "Pete" Dyballa), mkae (Marko Käning), ptmkenny@…, mp@…
Port: dbus

Description (last modified by ryandesign (Ryan Carsten Schmidt))

~ $ sudo port clean dbus
--->  Cleaning dbus
~ $ sudo port install dbus 
--->  Computing dependencies for dbus
--->  Fetching archive for dbus
Warning: Your DNS servers incorrectly claim to know the address of nonexistent hosts. This may cause checksum mismatches for some ports.
--->  Attempting to fetch dbus-1.8.0_0.darwin_10.x86_64.tbz2 from http://mse.uk.packages.macports.org/sites/packages.macports.org/dbus
--->  Attempting to fetch dbus-1.8.0_0.darwin_10.x86_64.tbz2 from http://lil.fr.packages.macports.org/dbus
--->  Attempting to fetch dbus-1.8.0_0.darwin_10.x86_64.tbz2 from http://nue.de.packages.macports.org/macports/packages/dbus
--->  Fetching distfiles for dbus
--->  Verifying checksums for dbus
--->  Extracting dbus
--->  Applying patches to dbus
--->  Configuring dbus
--->  Building dbus
Error: org.macports.build for port dbus returned: command execution failed
Please see the log file for port dbus for details:
    /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_ports_devel_dbus/dbus/main.log
To report a bug, follow the instructions in the guide:
    http://guide.macports.org/#project.tickets
Error: Processing of port dbus failed

Attachments (2)

main.log (46.8 KB) - added by gnurser (George Nurser) 10 years ago.
patch-bus-dir-watch-kqueue.c.diff (789 bytes) - added by RJVB (René Bertin) 10 years ago.
modified bus/dir-watch-kqueue patch that is transparant on systems having O_CLOEXEC

Download all attachments as: .zip

Change History (29)

Changed 10 years ago by gnurser (George Nurser)

Attachment: main.log added

comment:1 Changed 10 years ago by cooljeanius (Eric Gallager)

O_CLOEXEC is normally defined in fcntl.h, but the fcntl.h from Darwin's Libc is just a wrapper around <sys/fcntl.h>. I am also on Snow Leopard, so I checked my <sys/fcntl.h>, and can confirm that I do not have O_CLOEXEC in mine, either. I tried checking newer versions the Darwin Libc sources on opensource.apple.com, but could not find where <sys/fcntl.h> is located in there... Anyways, the next thing I checked was Gnulib, and Gnulib's fcntl.h defines O_CLOEXEC like this:

#if !defined O_CLOEXEC && defined O_NOINHERIT
/* Mingw spells it 'O_NOINHERIT'.  */
# define O_CLOEXEC O_NOINHERIT
#endif

#ifndef O_CLOEXEC
# define O_CLOEXEC 0
#endif

Gnulib also provides a cloexec.c file and a cloexec.h file that, taken together, actually implement the functionality that the O_CLOEXEC flag represents. dbus could try using these in cases when O_CLOEXEC is not available...

comment:2 Changed 10 years ago by cooljeanius (Eric Gallager)

Cc: egall@… added

Cc Me!

comment:3 Changed 10 years ago by gnw3

Cc: gnwiii@… added

Cc Me!

comment:4 Changed 10 years ago by ryandesign (Ryan Carsten Schmidt)

Description: modified (diff)
Owner: changed from macports-tickets@… to mcalhoun@…
Port: dbus added

Please remember to use WikiFormatting, to fill in the Port field, and to Cc the maintainer of that port. I've assigned the ticket to the maintainer now.

This issue was also discussed on the mailing list today. AFAIK, O_CLOEXEC is not available on 10.6 and earlier, and the developers of dbus need to be informed of this so that they can fix their software to work on older operating systems.

comment:5 Changed 10 years ago by mp@…

Cc: mp@… added

Cc Me!

comment:6 Changed 10 years ago by cooljeanius (Eric Gallager)

comment:7 Changed 10 years ago by mndavidoff (Monte Davidoff)

Cc: md14-macports@… added

Cc Me!

comment:8 Changed 10 years ago by josephaw@…

Cc: josephaw@… added

Cc Me!

comment:9 Changed 10 years ago by cooljeanius (Eric Gallager)

gnome-desktop had to deal with this problem in r115812 and r115816, which ended up with the following patch that could be used for reference here: patch-libgnome-destktop-libgsystem.diff

comment:10 in reply to:  1 Changed 10 years ago by ballapete (Peter "Pete" Dyballa)

On PPC Mac OS X 10.5.8 (Leopard) a similar failure happens:

make[2]: Entering directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_devel_dbus/dbus/work/dbus-1.8.0/bus'
  CC       activation.o
  CC       bus.o
  CC       config-parser.o
  CC       config-parser-common.o
  CC       connection.o
  CC       desktop-file.o
  CC       dir-watch-kqueue.o
dir-watch-kqueue.c: In function ‘bus_set_watched_dirs’:
dir-watch-kqueue.c:262: error: ‘O_CLOEXEC’ undeclared (first use in this function)
dir-watch-kqueue.c:262: error: (Each undeclared identifier is reported only once
dir-watch-kqueue.c:262: error: for each function it appears in.)
make[2]: *** [dir-watch-kqueue.o] Error 1
make[2]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_devel_dbus/dbus/work/dbus-1.8.0/bus'

comment:11 Changed 10 years ago by ballapete (Peter "Pete" Dyballa)

Cc: Peter_Dyballa@… added

Cc Me!

comment:12 Changed 10 years ago by mkae (Marko Käning)

Cc: mk@… added

Cc Me!

comment:13 Changed 10 years ago by ptmkenny@…

Cc: ptmkenny@… added

Cc Me!

comment:14 Changed 10 years ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)

Status: newassigned

Has duplicate #43235.

comment:15 Changed 10 years ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)

For the sake of completeness:

In an attempt to fix a bug, the developers of dbus made a one line change to the file dir-watch-kqueue.c with the suggestion that _dbus_fd_set_close_on_exec be used if O_CLOEXEC were not available.

In OS X, O_CLOEXEC was added in Lion.

r118593 is an attempt to follow that suggestion, but I do not have a test machine.

Any feedback?

comment:16 Changed 10 years ago by mkae (Marko Käning)

Your commit r118593 fixed the build problem for me on SL!

(Check out the SL buildbot, it shows a few warnings, but otherwise it's just fine.)

Thanks mcalhoun!!! :-)

Last edited 10 years ago by mkae (Marko Käning) (previous) (diff)

comment:17 Changed 10 years ago by mkae (Marko Käning)

Resolution: fixed
Status: assignedclosed

comment:18 in reply to:  17 Changed 10 years ago by gnurser (George Nurser)

Replying to mk@…: Works now. Many thanks:)

comment:19 Changed 10 years ago by mp@…

Cc: mp@… removed

Cc Me!

comment:20 Changed 10 years ago by mp@…

Cc: mp@… added

Cc Me!

comment:21 Changed 10 years ago by mp@…

Works here on 10.6.8 as well. Thanks.

comment:22 Changed 10 years ago by josephaw@…

Works here for 10.4.11 with warning messages

--->  Configuring dbus
Warning: You have requested an obsolete variant

Thanks.

Last edited 10 years ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:23 in reply to:  22 Changed 10 years ago by mp@…

Replying to josephaw@…:

Works here for 10.4.11 with warning messages

--->  Configuring dbus
Warning: You have requested an obsolete variant

I had it installed with the +startupitem variant, and got the same warning. All that was needed was

port install dbus

instead of upgrade (even though it was already installed) to get rid of the obsolete variant and the warning. At least on 10.6.8.

Last edited 10 years ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:24 Changed 10 years ago by ryandesign (Ryan Carsten Schmidt)

Has duplicate #43370.

comment:25 in reply to:  15 Changed 10 years ago by RJVB (René Bertin)

Replying to mcalhoun@…:

For the sake of completeness:

In an attempt to fix a bug, the developers of dbus made a one line change to the file dir-watch-kqueue.c with the suggestion that _dbus_fd_set_close_on_exec be used if O_CLOEXEC were not available.

r118593 is an attempt to follow that suggestion, but I do not have a test machine.

Any feedback?

Yes, this patch applies to all systems, even those that have O_CLOEXEC, and that's not what's been suggested by the dbus developers. They proposed to test for the presence of O_CLOEXEC in the code, and act accordingly; I'm attaching a modified patch that follows this approach (and that may actually be incorporated into dbus).

Changed 10 years ago by RJVB (René Bertin)

modified bus/dir-watch-kqueue patch that is transparant on systems having O_CLOEXEC

comment:26 Changed 10 years ago by mkae (Marko Käning)

Looks like your patch is the one which should get reported upstream then.

comment:27 Changed 2 years ago by barracuda156

Apparently the problem may be solved by adding legacysupport PortGroup, ref: https://trac.macports.org/ticket/60376

Note: See TracTickets for help on using tickets.