5

I was trying to install/compile libraries such as igraph and SNAP in Windows 7 using Cygwin (and also tried MinGW-MSYS) and I ran into some problems.

I think I have narrowed down the problem to this error given by ./configure:

checking sys/times.h usability... no
checking sys/times.h presence... no
checking for sys/times.h... no

In Cygwin, /usr/include/sys/times.h actually do exists. I googled about this for MinGW and it seems that sys/times.h is not available for MinGW because "the POSIX/BSD "times" function is not part of the ANSI standard and does not exist under Mingw32 runtime".

As an experiment, I tried compiling this C code in Cygwin using gcc:

#include <stdio.h>
#include <sys/times.h>

int main (void) 
{

      return 0;
}

This does not compile, with the error sys/times.h no such file or directory. This happens even when I change the include to </usr/include/sys/times.h> or <usr/include/sys/times.h>. In the Cygwin command promot /usr/include/sys/times.h work correctly.

Question

How do I get sys/times.h usability and presence? Is there a package or library I can install?

1
  • @H2CO3 - fatal error: /usr/include/sys/times.h: No such file or directory. But I think Jason (below) got the answer. Commented Oct 5, 2012 at 20:23

3 Answers 3

6

Your code compiles with no problem on my Cygwin. Actually /usr/include is one of the default include search paths for gcc, so normally gcc should be able to find sys/times.h.

Perhaps you are using MinGW version of gcc instead of Cygwin gcc? Try which gcc to make sure it's /usr/bin/gcc, and also gcc --version to make sure it does not display like mingw32-gcc.exe (GCC) x.x.x.

You can also try to compile your C file with verbose output:

gcc -v test.c

It shows how gcc searches include files. /usr/include should be one of the search path list if you use Cygwin's gcc.

Sign up to request clarification or add additional context in comments.

5 Comments

which gcc gives /cygdrive/c/Python27/Scripts/gcc! gcc -v test.c shows that its searching in my python27 mingw folders! (?!) Thanks! I think we found the problem. How do I get Cygwin to use the correct version?
Look at your PATH variable: echo $PATH. Make sure /usr/bin comes earlier than /cygdrive/c/Python27/Scripts. If not, you need to modify your Cygwin ~/.bashrc and/or your Windows PATH environment variable. The simpliest way may be just put this line in the top of your ~/.bashrc: export PATH=/usr/bin:$PATH.
I am accepting your answer because it identified the problem. I am still trying to figure out how to edit $PATH, which from what I googled is not easy and will take some time to learn. But thank you so much for your input, I was stuck for so long on this. +1!
Thank you! I would never find that I use MinGW compiler instead of cygwin-gcc without your answer. Thanks!
@Legendre Edit $PATH by going to Control Panel > System > Advanced system settings > Environment Variables. Here you can edit any environment variable including PATH. It actually is quite easy, each variable is just a string of semi-colon separated paths.
2

As I found out, there seems to be some intrinsic problems with this issue, and sys/times.h is not supposed to be used under windows (not supported for some reason).

As I mentioned also here, it's use should actually be removed from the code to make it compile.

Comments

-1

I had this same problem. Delete the folder C:\cygwin64 . Reinstall cygwin. Choose all defaults but when you get to 'Select Packaages', make sure to search and select the following one by one: binutils , make , gcc-g++ . For each one, select the dropdown and change form 'skip' to the newest version. Continue until you complete the installation. Everything worked for me from there.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.