[Coin-discuss] COIN on a Mac

Matthew Saltzman mjs at ces.clemson.edu
Sat Jan 4 18:41:04 EST 2003


On Sat, 4 Jan 2003 ScottWelz at aol.com wrote:

> Matt,
>
> You are correct.   I resolved this issue while I was also working through a
> couple of other issues and forgot to go back and dig deeper on this one.
> Darwin does indeed have the proper time.h header where it is supposed to be.
>
> It turns out that my issue was that the structure "timeval" was not declared.
>   This results in the "rusage" structure (which uses timeval) in resource.h
> not behaving properly.   The "timeval" structure is declared in sys/time.h.
> If I add a line in OsiClpSolverInterface.cpp everything works:
>
> #include <time.h>
> #if defined(_MSC_VER)
> // Turn off compiler warning about long names
> #   pragma warning(disable:4786)
> #else
> #include <sys/time.h>            //   Add this line
> #include <sys/times.h>
> #include <sys/resource.h>
> #include <unistd.h>
> #endif
>
> Any suggestions on a better way to deal with this?

Not sure yet.  What it looks like (at least WRT gcc 3.2) is this:

- rusage is referenced by getrusage() declared in sys/resource.h
- sys/resource.h includes bits/resource.h, which defines struct rusage
- struct rusage contains fields of type struct timeval
- bits/resource.h includes bits/time.h
- bits/time.h defines struct timeval

So the chain is complete in the gcc 3.2 headers (as included in
glibc-devel-2.2.93-5 in Red Hat Linux 8.0).  The bits/*.h headers are the
system-dependent parts of the corresponding sys/*.h files.

What happens if you try to follow the in Darwin?  And which gcc/glibc are
you using?

>
> Scott
>

-- 
		Matthew Saltzman

Clemson University Math Sciences
mjs at clemson.edu
http://www.math.clemson.edu/~mjs




More information about the Coin-discuss mailing list