O_CLOEXEC was not declared in this scope

Bug #980114 reported by Andrew Whalen
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Gearman
Fix Released
Medium
Brian Aker

Bug Description

Here is the error output of 'make' on Mac OS X 10.6.8 while trying to compile gearmand 0.32:

  CXX util/pidfile.o
util/pidfile.cc: In member function ‘bool datadifferential::util::Pidfile::create()’:
util/pidfile.cc:122: error: ‘O_CLOEXEC’ was not declared in this scope
make[1]: *** [util/pidfile.o] Error 1
make: *** [all] Error 2

Here are the configuration options and summary:

./configure --prefix=/usr/local --with-lib-prefix=/opt/local --with-boost=/opt/local

--------------------------------------------------------------
Configuration summary for gearmand version 0.32

   * Installation prefix: /usr/local
   * System type: apple-darwin10.8.0
   * Host CPU: x86_64
   * C Compiler: i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3)
   * Assertions enabled: yes
   * Debug enabled: no
   * Warnings as failure:
   * Building with libsqlite3 yes
   * Building with libdrizzle no
   * Building with libmemcached no
   * Building with libpq no
   * Building with tokyocabinet no
   * Building with libmysql yes

--------------------------------------------------------------

Revision history for this message
Brian Aker (brianaker) wrote : Re: [Bug 980114] [NEW] O_CLOEXEC was not declared in this scope
Download full text (3.2 KiB)

Hi,

Can you grep /usr/include for 10.6 and see where O_CLOEXEC is declared?

It may not have been available (it is in Lion).

Cheers,
 -Brian

On Apr 12, 2012, at 10:54 AM, Andrew Whalen wrote:

> Public bug reported:
>
> Here is the error output of 'make' on Mac OS X 10.6.8 while trying to
> compile gearmand 0.32:
>
> CXX util/pidfile.o
> util/pidfile.cc: In member function ‘bool datadifferential::util::Pidfile::create()’:
> util/pidfile.cc:122: error: ‘O_CLOEXEC’ was not declared in this scope
> make[1]: *** [util/pidfile.o] Error 1
> make: *** [all] Error 2
>
> Here are the configuration options and summary:
>
> ./configure --prefix=/usr/local --with-lib-prefix=/opt/local --with-
> boost=/opt/local
>
> --------------------------------------------------------------
> Configuration summary for gearmand version 0.32
>
> * Installation prefix: /usr/local
> * System type: apple-darwin10.8.0
> * Host CPU: x86_64
> * C Compiler: i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3)
> * Assertions enabled: yes
> * Debug enabled: no
> * Warnings as failure:
> * Building with libsqlite3 yes
> * Building with libdrizzle no
> * Building with libmemcached no
> * Building with libpq no
> * Building with tokyocabinet no
> * Building with libmysql yes
>
> --------------------------------------------------------------
>
> ** Affects: gearmand
> Importance: Undecided
> Status: New
>
> --
> You received this bug notification because you are subscribed to
> Gearman.
> https://bugs.launchpad.net/bugs/980114
>
> Title:
> O_CLOEXEC was not declared in this scope
>
> Status in Gearman Server and Client Libraries:
> New
>
> Bug description:
> Here is the error output of 'make' on Mac OS X 10.6.8 while trying to
> compile gearmand 0.32:
>
> CXX util/pidfile.o
> util/pidfile.cc: In member function ‘bool datadifferential::util::Pidfile::create()’:
> util/pidfile.cc:122: error: ‘O_CLOEXEC’ was not declared in this scope
> make[1]: *** [util/pidfile.o] Error 1
> make: *** [all] Error 2
>
> Here are the configuration options and summary:
>
> ./configure --prefix=/usr/local --with-lib-prefix=/opt/local --with-
> boost=/opt/local
>
> --------------------------------------------------------------
> Configuration summary for gearmand version 0.32
>
> * Installation prefix: /usr/local
> * System type: apple-darwin10.8.0
> * Host CPU: x86_64
> * C Compiler: i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3)
> * Assertions enabled: yes
> * Debug enabled: no
> * Warnings as failure:
> * Building with libsqlite3 yes
> * Building with libdrizzle no
> * Building with libmemcached no
> * Building with libpq no
> * Building with tokyocabinet no
> * Building with libmysql yes
>
> --------------------------------------------------------------
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/gearman...

Read more...

Changed in gearmand:
assignee: nobody → Brian Aker (brianaker)
status: New → Incomplete
importance: Undecided → Low
Revision history for this message
Andrew Whalen (78luphr0rnk2nuqimstywepozxn9kl19-launchpad-a811i2i3ytqlsztthjth0svbccw8inm6) wrote :

grep -r -i "O_CLOEXEC" /usr/include

On 10.6 this gives me nothing but some "no such file" warnings.

On 10.7 it gives me this output:

/usr/include/sys/fcntl.h:#define O_CLOEXEC 0x1000000 /* implicitly set FD_CLOEXEC */

Revision history for this message
Oleg (ok-k) wrote :

I've just got the same issue (it's the first time a see such error - we have gearman 0.26 installed currently).
Compilation string is:
CXX=/usr/bin/g++44 CC=/usr/bin/gcc44 ./configure --prefix=/usr --with-boost=/usr/include/ --with-drizzled libdrizzle_CFLAGS="-I/opt/src/drizzle7-2011.11.29/libdrizzle-2.0" libdrizzle_LIBS="-ldrizzle-2.0" --disable-libmemcached --disable-libpq --disable-libtokyocabinet

then i execute make and get the following:
make all-am
make[1]: Entering directory `/opt/src/gearmand-0.32'
  CXX libgearman/libgearman_libgearman_la-actions.lo
  CXX libgearman/libgearman_libgearman_la-aggregator.lo
  CXX libgearman/libgearman_libgearman_la-allocator.lo
....
  CXX bin/gearman.o
  CXX bin/error.o
  CXX util/pidfile.o
util/pidfile.cc: In member function ‘bool datadifferential::util::Pidfile::create()’:
util/pidfile.cc:122: error: ‘O_CLOEXEC’ was not declared in this scope
make[1]: *** [util/pidfile.o] Error 1
make[1]: Leaving directory `/opt/src/gearmand-0.32'
make: *** [all] Error 2

Server is : Linux 2.6.18-274.18.1.el5xen #1 SMP Thu Feb 9 13:27:02 EST 2012 x86_64 x86_64 x86_64 GNU/Linux

Revision history for this message
Brian Aker (brianaker) wrote : Re: [Bug 980114] O_CLOEXEC was not declared in this scope

What distribution/version?

Can you see if this works:

#ifndef O_CLOEXEC
#define O_CLOEXEC
#endif

Place after all include files have been included.

Thanks!

On Apr 13, 2012, at 5:14 AM, Oleg wrote:

> I've just got the same issue (it's the first time a see such error - we have gearman 0.26 installed currently).
> Compilation string is:
> CXX=/usr/bin/g++44 CC=/usr/bin/gcc44 ./configure --prefix=/usr --with-boost=/usr/include/ --with-drizzled libdrizzle_CFLAGS="-I/opt/src/drizzle7-2011.11.29/libdrizzle-2.0" libdrizzle_LIBS="-ldrizzle-2.0" --disable-libmemcached --disable-libpq --disable-libtokyocabinet
>
> then i execute make and get the following:
> make all-am
> make[1]: Entering directory `/opt/src/gearmand-0.32'
> CXX libgearman/libgearman_libgearman_la-actions.lo
> CXX libgearman/libgearman_libgearman_la-aggregator.lo
> CXX libgearman/libgearman_libgearman_la-allocator.lo
> ....
> CXX bin/gearman.o
> CXX bin/error.o
> CXX util/pidfile.o
> util/pidfile.cc: In member function ‘bool datadifferential::util::Pidfile::create()’:
> util/pidfile.cc:122: error: ‘
> O_CLOEXEC’ was not declared in this scope
> make[1]: *** [util/pidfile.o] Error 1
> make[1]: Leaving directory `/opt/src/gearmand-0.32'
> make: *** [all] Error 2
>
> Server is : Linux 2.6.18-274.18.1.el5xen #1 SMP Thu Feb 9 13:27:02 EST
> 2012 x86_64 x86_64 x86_64 GNU/Linux
>
> --
> You received this bug notification because you are a bug assignee.
> https://bugs.launchpad.net/bugs/980114
>
> Title:
> O_CLOEXEC was not declared in this scope
>
> Status in Gearman Server and Client Libraries:
> Incomplete
>
> Bug description:
> Here is the error output of 'make' on Mac OS X 10.6.8 while trying to
> compile gearmand 0.32:
>
> CXX util/pidfile.o
> util/pidfile.cc: In member function ‘bool datadifferential::util::Pidfile::create()’:
> util/pidfile.cc:122: error: ‘O_CLOEXEC’ was not declared in this scope
> make[1]: *** [util/pidfile.o] Error 1
> make: *** [all] Error 2
>
> Here are the configuration options and summary:
>
> ./configure --prefix=/usr/local --with-lib-prefix=/opt/local --with-
> boost=/opt/local
>
> --------------------------------------------------------------
> Configuration summary for gearmand version 0.32
>
> * Installation prefix: /usr/local
> * System type: apple-darwin10.8.0
> * Host CPU: x86_64
> * C Compiler: i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3)
> * Assertions enabled: yes
> * Debug enabled: no
> * Warnings as failure:
> * Building with libsqlite3 yes
> * Building with libdrizzle no
> * Building with libmemcached no
> * Building with libpq no
> * Building with tokyocabinet no
> * Building with libmysql yes
>
> --------------------------------------------------------------
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/gearmand/+bug/980114/+subscriptions

Revision history for this message
Oleg (ok-k) wrote :

Hi Brian!
Here's the release info:
[root@demo gearmand-0.32]# cat /etc/redhat-release
CentOS release 5.7 (Final)

I've tried to include
#ifndef O_CLOEXEC
#define O_CLOEXEC
#endif

into util/pidfile.cc
after all #include

Here's the result of make:
.....
  CXX bin/gearman.o
  CXX bin/error.o
  CXX util/pidfile.o
util/pidfile.cc: In member function ‘bool datadifferential::util::Pidfile::create()’:
util/pidfile.cc:126: error: expected primary-expression before ‘,’ token
make[1]: *** [util/pidfile.o] Error 1
make[1]: Leaving directory `/opt/src/gearmand-0.32'
make: *** [all] Error 2

Also seen some weird strings during make (not sure if it's related to this case):
....
  CXX libgearman/libgearman_libgearman_la-worker.lo
  CXXLD libgearman/libgearman.la
/usr/bin/ld: skipping incompatible /usr/lib/libuuid.so when searching for -luuid
/usr/bin/ld: skipping incompatible /usr/lib/libuuid.a when searching for -luuid
  CXX libtest/libtest_libtest_la-binaries.lo
  CXX libtest/libtest_libtest_la-cmdline.lo
.....

Revision history for this message
Oleg (ok-k) wrote :

I've tried to remove
|O_CLOEXEC
from util/pidfile.cc file at line 121
Previously it was:
if ((file = open(_filename.c_str(), O_CREAT|O_WRONLY|O_TRUNC|O_CLOEXEC, S_IRWXU|S_IRGRP|S_IROTH)) < 0)

Now it's
if ((file = open(_filename.c_str(), O_CREAT|O_WRONLY|O_TRUNC, S_IRWXU|S_IRGRP|S_IROTH)) < 0)

After this modification make goes fine.
Key question is - will this modification have any impact on Gearmand functionality or causes any mistakes/issues?

Revision history for this message
Brian Aker (brianaker) wrote :

No issue should exist for OSX 10.6 that didn't already exist.

Same goes for Centos < 6.

Changed in gearmand:
status: Incomplete → Triaged
Revision history for this message
Keyur (keyurdg) wrote :

Attached a patch to fix the issue. Adds a check to configure to look for O_CLOEXEC and disable if not present.

Revision history for this message
Keyur (keyurdg) wrote :

Actual patch attached. -p2 to import.

Brian Aker (brianaker)
Changed in gearmand:
milestone: none → 0.33
importance: Low → Medium
status: Triaged → In Progress
Brian Aker (brianaker)
Changed in gearmand:
status: In Progress → Fix Committed
Brian Aker (brianaker)
Changed in gearmand:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.