相关文章推荐
坚强的拖把  ·  postgresql数据库sql-阿里云·  9 月前    · 
慷慨大方的蘑菇  ·  javascript - ...·  2 年前    · 
沉着的米饭  ·  Unable to execute ...·  2 年前    · 
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

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?

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

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.

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? – Legendre Oct 5, 2012 at 20:27 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. – Penghe Geng Oct 5, 2012 at 20:56 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! – Legendre Oct 6, 2012 at 10:03 Thank you! I would never find that I use MinGW compiler instead of cygwin-gcc without your answer. Thanks! – Roman Rader Aug 9, 2013 at 15:11 @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. – Rapnar Oct 8, 2015 at 16:05

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.

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.

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.