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 150099 - Cygwin: 'Clean and Build' broke project
Summary: Cygwin: 'Clean and Build' broke project
Status: VERIFIED FIXED
Alias: None
Product: cnd
Classification: Unclassified
Component: Project (show other bugs)
Version: 6.x
Hardware: All Windows XP
: P2 blocker (vote)
Assignee: Alexey Vladykin
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-10-14 14:57 UTC by soldatov
Modified: 2009-02-19 20:30 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Project (120.00 KB, application/x-tar)
2008-10-14 15:43 UTC, soldatov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description soldatov 2008-10-14 14:57:26 UTC
Windows XP, Cygwin
Scenario:
- Create file.h file in C:\test directory
- Create 'New C/C++ project' in C:\test_projects directory
- Add 'C:/test' into 'Include Directories' property
- Add '#include <file.h>' line into C++ file
- Press 'Clean and Build'
==> ok
- Press 'Clean and Build' again
==> build failed

Running "C:\util\cygwin\bin\make.exe  -f Makefile CONF=Debug clean" in C:\test_projects\Application_1

/usr/bin/make -f nbproject/Makefile-Debug.mk SUBPROJECTS= .clean-conf
make[1]: Entering directory `/cygdrive/c/test_projects/Application_1'
build/Debug/Cygwin-Windows/newmain.o.d:1: *** несколько образцов цели.  Останов.
make[1]: Leaving directory `/cygdrive/c/test_projects/Application_1'
make: *** [.clean-impl] Ошибка 2

Clean failed. Exit value 2.
Comment 1 Alexey Vladykin 2008-10-14 15:38:40 UTC
Please attach here the following files after the failure:
- nbproject/Makefile-${CONF}.mk
- build/Debug/Cygwin-Windows/newmain.o.d
Comment 2 soldatov 2008-10-14 15:43:20 UTC
Created attachment 71775 [details]
Project
Comment 3 Alexey Vladykin 2008-10-14 17:56:44 UTC
I've analyzed the attached project. The line that causes make's complaints is:
build/Debug/Cygwin-Windows/newmain.o: newmain.cpp C:/test/file.h

Indeed it's incorrect. Colon in path should be escaped:
build/Debug/Cygwin-Windows/newmain.o: newmain.cpp C\:/test/file.h

Or the path should be in another form:
build/Debug/Cygwin-Windows/newmain.o: newmain.cpp /cygdrive/c/test/file.h

Those *.d files are generated by gcc, not NetBeans, so this looks like Cygwin gcc bug. The problem does not reproduce in
MinGW.
Comment 4 soldatov 2008-10-15 09:01:24 UTC
We hadn't such problem in NB6.1, therefore I think it can be showstopper.
Comment 5 Alexey Vladykin 2008-10-15 13:07:49 UTC
The solution could be to pass all paths to gcc in "/cygdrive/c/..." form.
Comment 6 Alexander Pepin 2008-10-15 13:37:13 UTC
The root cause is that the path to include files is stored as absolute. So the workaround is to transform the path to
relative manually in project properties. The problem can not be resolved in a such way only when include directory is on
another disk. 
Comment 7 Alexey Vladykin 2008-10-23 11:21:44 UTC
Hmm, I see that MinGW is also affected.

For Cygwin the workaround is to transform include directories from windows-style path to cygwin-style path, so that
C:\test becomes /cygdrive/c/test. It can be done automatically when writing Makefile.

For MinGW I'd like to have similar workaround: change C:\test to /c/test. There is some evidence in the Internet that it
should work, but it doesn't for me. So a not-so-nice workaround for MinGW is to disable dependency generation when
absolute include paths are used.
Comment 8 Alexey Vladykin 2008-10-29 15:11:36 UTC
1. The problem can be triggered by absolute source file paths as well, not only by absolute include directory paths.
2. Same thing happens on Linux: gcc does not escape ':' when generating dependency files, so that make fails to parse
those files. But on Linux colon is not a common symbol in paths.
Comment 9 Alexey Vladykin 2008-10-30 14:44:18 UTC
Previously Cygwin's make used to handle Windows paths with colons (with --win32 argument or MAKE_MODE=win32 env
variable), but this support has been removed. See http://www.cygwin.com/ml/cygwin-announce/2006-07/msg00008.html
MinGW make is recommended if Makefile contains Windows paths. For us it means MSYS make, because we recommend to replace
MinGW make with MSYS make :)

Configuring toolchains for both Cygwin and MinGW to use MSYS make solves the problem.
Comment 10 Alexey Vladykin 2008-10-30 18:23:35 UTC
See also issue 110752
Comment 11 Alexey Vladykin 2008-11-28 16:34:23 UTC
Fixed in http://hg.netbeans.org/main/rev/0b947aac9fa9
Comment 12 Quality Engineering 2008-11-30 17:10:57 UTC
Integrated into 'main-golden', will be available in build *200811301401* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/0b947aac9fa9
User: Alexey Vladykin <alexey_vladykin@netbeans.org>
Log: Fixed #150099 & #153308
Comment 13 Alexander Pepin 2008-12-10 15:17:11 UTC
Fix failed in build 200812080201. Now the second "Clean&Build" fails on "Clean"
/usr/bin/make -f nbproject/Makefile-Debug.mk SUBPROJECTS= .clean-conf
make[1]: Entering directory `/cygdrive/c/working/nb_trunk_working/issue150099'
build/Debug/Cygwin-Windows/_ext/C_/temp/welcome.o.d:1: *** target pattern contains no `%'.  Stop.
make[1]: Leaving directory `/cygdrive/c/working/nb_trunk_working/issue150099'
make: *** [.clean-impl] Error 2
CLEAN FAILED (exit value 2, total time: 3s)
Comment 14 Alexey Vladykin 2008-12-10 16:19:20 UTC
The absolute source path should be normalized in one more place. Fixed with changeset
http://hg.netbeans.org/main/rev/89559fd07d56
Comment 15 Alexander Pepin 2008-12-15 15:25:14 UTC
verified in build 200812150201
Comment 16 Alexander Pepin 2008-12-15 15:33:55 UTC
Sorry, marked as verified by mistake
Comment 17 Alexander Pepin 2008-12-15 15:37:44 UTC
It seems that the fix is not integrated yet
Comment 18 Alexander Pepin 2008-12-15 18:38:35 UTC
fix failed in build 200812150201 with provided org-netbeans-modules-cnd-makeproject.jar
The second Clean&Build gives:

/usr/bin/make -f nbproject/Makefile-Debug.mk SUBPROJECTS= .clean-conf
make[1]: Entering directory `/cygdrive/c/working/nb_trunk_working/issue150099'
build/Debug/Cygwin-Windows/_ext/C_/temp/welcome.o.d:1: *** target pattern contains no `%'.  Stop.
make[1]: Leaving directory `/cygdrive/c/working/nb_trunk_working/issue150099'
make: *** [.clean-impl] Error 2
CLEAN FAILED (exit value 2, total time: 987ms)
Comment 19 Alexander Pepin 2008-12-15 18:52:09 UTC
sorry once again the issue has been fixed in trunk.
For verifying the tested project should be recreated. Fix does not work for old projects.
Comment 20 Alexander Pepin 2008-12-15 18:52:33 UTC
verified in build 200812150201
Comment 21 jinb 2009-01-14 18:59:12 UTC
Cumulative backport of fix of IZ 150099, 153308 in release65_fixes branch:
http://hg.netbeans.org/release65_fixes/rev/3870929f513a
Comment 22 Alexander Pepin 2009-01-19 16:36:54 UTC
verified in patch2