Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing/compiling in Cygwin/MinGW - How to set the include "path"? (symbolic link?)

I have been trying to install/compile C libraries in Windows 7 using Cygwin and MinGW. However, I am getting errors like these during make:

sys/resource.h: No such file or directory
sys/times.h: No such file or directory

I previously thought it might be a problem with the specific libraries and asked here: Various issues installing igraph in Visual Studio 2010 and Cygwin/MinGW ("sys/time.h not found"), but after encountering the same error with different libraries, I think the problem lies on my end.

Attempt

cygwin/usr/include/sys/times.h and cygwin/usr/include/sys/resource.h exists. After getting advice regarding symbolic links, I used ln -s /usr/include/sys sys to make sure that sys/times.h worked.

I went to look at the make output for a specific library (igraph). It says it entered a "src" folder. So, I went to the src folder and did the same thing: ln -s /usr/include/sys sys and made sure that sys/times.h worked within the src folder too.

However, I am still getting:

fatal error: sys/times.h: No such file or directory

Question

How do I set the "path" for make to find 'sys/times.h' or other files in the /usr/include/sys folder? What am I missing here?

P.S.

Please bear with me as I am usually a Windows user and not familiar with Linux terminology.

like image 606
Legendre Avatar asked Oct 05 '12 13:10

Legendre


3 Answers

After much investigation, the problem turned out to be that:

  1. MinGW does not have sys/times.h.
  2. Cygwin has it, but my Cyqwin was using the gcc in my python directory, which is MinGW's gcc.

This was discovered while trying to resolve another problem here:

Cannot compile C code with #include <sys/times.h> in Cygwin

So it turns out that my problem had nothing to do with the include path or making symbolic links, but rather, the gcc version/type was wrong. This fact eluded me because I was running a clean installation of Cygwin and didn't know that it would automatically use the MinGW's gcc in my Python folder.

like image 71
Legendre Avatar answered Sep 30 '22 17:09

Legendre


Build libigraph with minGW without having "sys/times.h"

That may be interesting for all building "igraph" and don't want to create it with "cygwin" but with "mingw".

In my "msys / mingw" environment, I have my "source code" in. "C:\msys\1.0\src" directory.
igraph dir. == C:\msys\1.0\src\igraph-0.6

  • Run c:\msys\1.0\msys.bat
  • cd to the top root cd /
  • cd to igraph cd usr/src/igraph-0.6
    Note: There is no usr folder in C:\msys\1.0\. Take care do'nt create a usr folder !!!
  • Type ./configure Now the msys shell look something like

Administrator@drserver-p /usr/src/igraph-0.6
$ ./configure

  • hit "Enter"

it takes a while.

Change of files.

  • goto igraph-0.6\src
  • Open with Notepadd++ or another editor the "Makefile"
    Goto line 832 or search for libf2c_la_CFLAGS =
    Put -DUSE_CLOCK after libf2c_la_CFLAGS =
    Now it looks like libf2c_la_CFLAGS = -DUSE_CLOCK -DSkip_f2c_Undefs ....
  • Open igraph-0.6\src\f2c\uninit.c
  • Goto Line 182 or serach for _control87(EM_DENORMAL
    comment this line /* _control87(EM_DENORMAL ..... */
  • Open igraph-0.6\src\f2c\s_paus.c
    Goto Line 84 or search for pause();
    comment this line /* pause(); */

  • Type make Now the msys shell look something like

Administrator@drserver-p /usr/src/igraph-0.6
$ make

  • hit "Enter"

If it works it takes about 1 hour !

like image 35
moskito-x Avatar answered Sep 30 '22 18:09

moskito-x


see http://mail.kde.org/pipermail/kde-windows/2006-May/000194.html as they say even if the times.h is put there its functions may not be implemented by mingw

when running ./configure i'm getting this(its hard to notice)

so first try copying the times.h and then use ./configure and see if this error isn't there

like image 24
bhathiya-perera Avatar answered Sep 30 '22 19:09

bhathiya-perera