This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 133260

Summary: Include files not found
Product: cnd Reporter: jarome <jarome>
Component: -- Other --Assignee: Thomas Preisler <thp>
Status: VERIFIED FIXED    
Severity: blocker CC: mitesh2016, Ptomaine, sustaining
Priority: P2    
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:
Attachments: My project

Description jarome 2008-04-19 15:48:54 UTC
I am doing a C project in NB 6.1RC1 on WinXP with the MinGW tools.

When I compile anything, the include directories are not found! For example, here is the start of some code (GPC_WIN and
GPC_MinGW are defined):

#include "comp.h"
#include <stdio.h>
#include <memory.h>
#ifdef GPC_WIN
#define JAVA_LOCATION "\"c:\\Program Files\\Java\\jre1.6.0_05\\bin\\java\""
#define TP_LOCATION "C:\\NetBeansProjects\\tekplot\\tekplot\\dist\\tekPlot.jar"
#include <process.h>
#ifdef GPC_CYGWIN
#include <w32api/winsock2.h>
#endif
#ifdef GPC_MinGW
#include <winsock2.h>
#endif
#include <time.h>
#include <errno.h>
#include <windows.h>
#endif

#ifdef GPC_UNX
#define GPC_OSX
#define JAVA_LOCATION "/usr/bin/java"

#ifdef GPC_OSX
#define TP_LOCATION "/Users/jar/Tekdraw2/tekPlot/dist/tekPlot.jar"
#else
// Note: unable to use ~ here
#define TP_LOCATION "/home/jar/Tekdraw2/tekPlot/dist/tekPlot.jar"
#endif

// Note:Only include the main include directory in NetBeans C options
#include <unistd.h>
#include <errno.h>
#include <netdb.h>
#include <sys/socket.h>
#include <netinet/in.h>
#endif

NetBeans "sees" the comp.h include file because the #ifdefs are properly colored. But when I try to compile the code,
make cannot seem to find any of my include files. comp.h is in C:\nbprojects\graphic2dll\trunk\include

mkdir -p build/Windows-Debug/MinGW-Windows/src
gcc.exe    -c -g -IC\:/nbprojects/graphic2dll/trunk/include -IC\:/MinGW/include -o
build/Windows-Debug/MinGW-Windows/src/tkfPush.o src/tkfPush.c
src/tkfPush.c:9:18: comp.h: No such file or directory
src/tkfPush.c: In function `tkfpush':
src/tkfPush.c:60: error: storage size of 'addr' isn't known
src/tkfPush.c:61: error: storage size of 'inputaddress' isn't known
Comment 1 jarome 2008-04-19 15:52:21 UTC
GPC_WIN and GPC_MinGW are defined in comp.h
Comment 2 jarome 2008-04-19 16:22:01 UTC
The problem is the MinGW make. When I used cygwin's make, this worked. why? If the MinGW make is no good, you should
warn people it that, or else modify the make files accordingly.
Comment 3 soldatov 2008-04-19 17:12:31 UTC
Although compiler settings are changed in NetBeans 6.1, I recommend to read this tutorial:
http://wiki.sergio-lopes.org/index.php?n=Rabble.NetbeansCinW#ideconfig6
Comment 4 Jesse Grodnik 2008-04-19 17:59:50 UTC
This issue suggests a usability issue in the product. Escalated to P2.
Comment 5 jarome 2008-04-19 18:31:09 UTC
I followed all of those setup instructions. But the old version does not let you specify make. The new one does. I used
c:\MinGW\bin\mingw32-make.exe.
That did not work. 
Using c:\cygwin\bin\make.exe
did work.

Why??

Yes it sure is a usability issue. It wasted 2 days for me too.

And I have the newest version of the released MinGW tools installed too. 
Comment 6 soldatov 2008-04-19 19:26:08 UTC
Why? I don't know. It is old bug. (issue 79512 : "MinGW mingw32-make.exe not supported")
Instead of 'mingw32-make.exe' need to use 'C:/msys/1.0/bin/make.exe' ('make' from MSYS).
Comment 7 jarome 2008-04-19 19:36:26 UTC
I think the issue is that MinGW's make tries to imitate Microsoft's nmake. So, if you allow users to specify the MinGW
make, you need to create a different sort of Makefile. If you cannot do that, you need to warn users not to use the
MinGW make in the GUI.
Comment 8 soldatov 2008-04-19 20:47:55 UTC
I agree. Need to warn users not to use the MinGW make in the GUI.
Also I think your problem should be resolved in the future. IDE generates strange string
('-IC\:/nbprojects/graphic2dll/trunk/include' instead of '-IC:/nbprojects/graphic2dll/trunk/include').
Comment 9 jarome 2008-04-19 22:14:00 UTC
This from MinGW:
> >Comment By: Keith Marshall (keithmarshall)
Date: 2008-04-19 20:43

Message:
Logged In: YES 
user_id=823908
Originator: NO

This has nothing to do with `make' -- the issue is with GCC's resolution
of your include file paths.

MinGW's GCC can't understand POSIX paths, even when you use MSYS.  If you
must specify absolute include file paths within your source code, then you
*must* specify them in *native* Windows syntax, (although you *may* use
normal slashes, in preference to backslashes, as the directory separators).
 Most projects avoid this issue, by using *relative* include file paths.

Cygwin's GCC *can* understand POSIX paths, WRT it's own emulated POSIX
mapping of the file system; this is why it does work in Cygwin.

I'm closing this as `invalid' for now.  If you feel I've misinterpreted
your problem, please feel free to add a follow-up comment, and I'll reopen
it.

----------------
So, you need to change the make file if the user uses MinGW or MSYS. Hence, I think this is a real bug.
Comment 10 jarome 2008-04-21 14:49:00 UTC
I am now thinking that when I use the cygwin make.exe, it also calls the cygwin gcc. That would agree with what the
MinGW people said.

In this case, the C/C++ settings page is very wrong for Windows. What I have concluded is that you MUST use the MinGW
libraries and include files if you want to do anything that "plays with" Windows, e.g., a dll. If you look at the
include files in cygwin vs MinGW, you will see that the latter have all the correct Windows declarations. But, unless NB
changes the Makefile, you MUST use the cygwin tools. So neither the cygwin nor the MinGW tools setting will work.

The GUI needs to explain this to users properly and prevent them from doing the wrong thing.

I think this is a NB6.1 blocker.
Comment 11 soldatov 2008-04-22 08:04:01 UTC
Yes. I cannot build project by 'mingw32-make.exe'. But I replaced this utility on 'c:\msys\1.0\bin\make.exe' and I have
not problem with build. At least I cannot understand you problem. Can you attach your 
project?
-------------------------------------------------------------------------------
Running "C:\msys\1.0\bin\make.exe  -f Makefile CONF=Debug" in C:\tmp\mingw

/usr/bin/make -f nbproject/Makefile-Debug.mk SUBPROJECTS= .build-conf
make[1]: Entering directory `/c/tmp/mingw'
mkdir -p build/Debug/MinGW-Windows
gcc.exe    -c -g -IC\:/nbprojects/graphic2dll/trunk/include -o build/Debug/MinGW-Windows/tkfPush.o tkfPush.c
mkdir -p dist/Debug/MinGW-Windows
gcc.exe     -o dist/Debug/MinGW-Windows/mingw build/Debug/MinGW-Windows/tkfPush.o  
make[1]: Leaving directory `/c/tmp/mingw'

Build successful. Exit value 0.
Comment 12 jarome 2008-04-22 14:53:41 UTC
Created attachment 60558 [details]
My project
Comment 13 jarome 2008-04-22 15:01:44 UTC
Here is the issue as I see it:
1) If you use the cygwin include files and libraries, your executable will only run in the cygwin environment. This
should be noted in the GUI.
2) If you want your executable to run in Windows directly, you must use the MinGW includes and libraries.
3) If what the MinGW people say is true, the problem is the gcc compiler, not the version of make. But it is actually
the Makefile that is the problem. If the user opts to use the MinGW tools, the Makefile needs to use windows \ path
separators. If the user chooses the cygwin tools, it needs to use the / separator, or maybe either.
4) I think that the cygwin make must launch the cygwin gcc. That would explain why it works using the cygwin make.exe.
5) To fix this, NetBeans should
-> Make a different Makefile for each chosen toolset
-> Document the issues raised above, preferably in the GUI itself.
-> If NB does not want to create a separate Makefile for MinGW, the GUI needs to disallow the use of the MinGW
mingw32-make.exe.

I really think this needs fixing before the 6.1 release!
Comment 14 Thomas Preisler 2008-04-22 21:50:07 UTC
We will disallow mingw32-make.exe in the tool set and provide an error dialog explaining why if the user attempts to select the MinGW make.
Comment 15 Thomas Preisler 2008-04-23 04:09:00 UTC
Added a check to disallow mingw32-make.exe.

comparing with https://thp:***@hg.netbeans.org/main/
searching for changes
changeset:   78930:0d5b094f36cd
user:        Thomas Preisler <thp@netbeans.org>
date:        Tue Apr 22 20:03:36 2008 -0700
summary:     133260  Include files not found

changeset:   78931:0374d6b5dc38
tag:         tip
user:        Thomas Preisler <thp@netbeans.org>
date:        Tue Apr 22 20:04:52 2008 -0700
summary:     133260  Include files not found
Comment 16 Thomas Preisler 2008-04-23 04:35:46 UTC
Fixed. 

Now disallowing mingw32-make.exe as a make in any compiler set. If the user selects this make, the validation fails and the following error message is 
displayed: mingw32-make.exe is not compatible and is not supported. Use make form MSYS.

The plan is to also document this in the tool chain documentation with a more elaborate explanation why mingw32-make.exe doesn't work with our projects.

Changes pushed to trunk. Waiting for QA to verify so the fix can go into 6.1 patch.


Comment 17 Thomas Preisler 2008-04-23 05:22:56 UTC
changeset 0d5b094f36cd in main
details: http://hg.netbeans.org/main?cmd=changeset;node=0d5b094f36cd
description:
	133260  Include files not found

changeset 0374d6b5dc38 in main
details: http://hg.netbeans.org/main?cmd=changeset;node=0374d6b5dc38
description:
	133260  Include files not found
Comment 18 jarome 2008-04-23 14:12:28 UTC
I would say "use make from MSYS or Cygwin"

I was unable to find an easy way to install MSYS. There is no Windows installer available for it any more.
Comment 19 alexandrov 2008-04-23 14:40:12 UTC
verified in dev build 20080423100942

jarome, latest MSYS you can find here:
http://sourceforge.net/project/downloading.php?group_id=2435&use_mirror=switch&filename=MSYS-1.0.10.exe
this link is derivable from mingw.org
  
Comment 20 Alexander Pepin 2008-04-23 14:40:54 UTC
The link to MSYS installer is
http://sourceforge.net/project/downloading.php?group_id=2435&use_mirror=switch&filename=MSYS-1.0.10.exe&94617889

It is available from the MinGW download area on SourceForge.
Please see http://www.mingw.org/msys.shtml
Comment 21 jarome 2008-04-23 15:07:50 UTC
Thanks for the link. But I was unable to find that link from the MinGW page.

But, however, the cygwin make works properly, and many people have that installed already, so there is no reason not to
suggest using either of them.
Comment 22 jarome 2008-04-23 15:22:57 UTC
I went to http://www.mingw.org/download.shtml and then clicked on the sourceforge download link
http://sourceforge.net/project/showfiles.php?group_id=2435 and see no MSYS executable file there. So I claim this is
hard to find. There are onlt tar.bz2 files.
Comment 23 alexandrov 2008-04-23 15:44:14 UTC
jarome, please use Ctrl-F on your sourceforge page with 'msys' expression. You should look through not only Latest File
Releases but also MSYS Base System below.
Comment 24 jarome 2008-04-23 17:59:53 UTC
It is hidden! You have to click + to find it.

But I still think you should also suggest the cygwin make.exe. Many more people have already installed cygwin so that
they can connect to Linux environments. Why not?
Comment 25 Jesse Grodnik 2008-04-23 18:36:20 UTC
Insofar as possible we'd like to remain toolchain neutral, hence the reluctance to make specific recommendations. The
community (including yourself) is available to help future users who may run into this issue.

Jesse
Comment 26 rbalada 2008-04-29 13:41:47 UTC
I've trnsplanted the changesets http://hg.netbeans.org/main?cmd=changeset;node=0d5b094f36cd and
http://hg.netbeans.org/main?cmd=changeset;node=0374d6b5dc38 into release61_fixes repository as
http://hg.netbeans.org/release61_fixes/rev/b7e78c87abdf resp. http://hg.netbeans.org/release61_fixes/rev/58982d4cd1db

changeset:   77488:b7e78c87abdf
user:        Thomas Preisler <thp@netbeans.org>
date:        Tue Apr 22 20:03:36 2008 -0700
summary:     133260  Include files not found

changeset:   77489:58982d4cd1db
tag:         tip
user:        Thomas Preisler <thp@netbeans.org>
date:        Tue Apr 22 20:04:52 2008 -0700
summary:     133260  Include files not found
Comment 27 Alexander Pepin 2008-05-14 17:36:18 UTC
*** Issue 79512 has been marked as a duplicate of this issue. ***
Comment 28 ilia 2013-10-31 11:43:06 UTC
*** Bug 226706 has been marked as a duplicate of this bug. ***