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 246837 - PATH not adequately setup by Netbeans for mingw/msys2
Summary: PATH not adequately setup by Netbeans for mingw/msys2
Status: RESOLVED FIXED
Alias: None
Product: cnd
Classification: Unclassified
Component: Debugger (show other bugs)
Version: 8.1
Hardware: PC Other
: P3 normal with 1 vote (vote)
Assignee: Maria Tishkova
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-09-03 00:43 UTC by adipose
Modified: 2017-08-29 08:23 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Prepends compiler path when running or debugging (4.19 KB, application/octet-stream)
2014-09-03 00:43 UTC, adipose
Details

Note You need to log in before you can comment on or make changes to this bug.
Description adipose 2014-09-03 00:43:09 UTC
Created attachment 149014 [details]
Prepends compiler path when running or debugging

The recommended setup for Netbeans using mingw suggests setting the global PATH variable in windows to the mingw/bin path.  This is inadequate for some applications which depend on shared libraries in that path.

For example, using msys2, it is possible to have both 32-bit and 64-bit toolchains.  It is preferable to have the 32-bit path for one toolchain, and the 64-bit path for the other.  Using the global Windows PATH does not satisfy this need.

When running a process, Netbeans appends the compiler path, which partially solves the issue of DLL dependencies.  Unfortunately, the DLLs required by the executable may have older versions already in the path.  Many programs which add themselves to the path have mingw DLLs in their binary directory.  I solve this issue by prepending the compiler path instead of appending it.

When debugging a process, Netbeans does not add the compiler path at all.  This results in programs which can actually run (provided there are no DLL conflicts as I discuss above), but cannot be debugged.  The path set by Netbeans for DEBUG is not equivalent to that used by RUN.  I solve this issue by prepending the compiler path when debugging, as well.

A better solution might be to allow a PATH environment variable in the project settings.  In my experience, the included "enviroment" panel is not adequate.  Setting the PATH in there had no effect on my executable's PATH.  But ideally, it would prepend the PATH, both when running and debugging.

I included a patch which solves the problems, at least for mingw dlls and any other shared libraries that are in the compiler path (for msys2, for example, the Qt dlls are placed in the bin folder).
Comment 1 adipose 2014-09-03 18:52:20 UTC
I have discovered the issue with setting the PATH through the environment panel.  This could be considered another bug.

If you spell it "PATH", it does not update the Windows "Path".  Technically, "Path" on Windows is spelled with a capital P and lower case "ath".  However, if you do "set PATH=..." in Windows it is supported.  In other words, Windows has a case-insensitive environment variable.  Netbeans, however, does not support this case insensitivity, and will fail to set the "Path" when you specify "PATH" in the Netbeans run environment.

If you spell it "right" ("Path"), it works.
Comment 2 soldatov 2014-11-19 13:42:26 UTC
small discussion on forum: http://forums.netbeans.org/topic61925.html
Comment 3 Maria Tishkova 2017-08-29 08:23:12 UTC
Please see 
http://wiki.netbeans.org/NewAndNoteworthyNB82#Modifying_a_PATH_var:_prepending_or_appending_a_toolchain_path
http://wiki.netbeans.org/NewAndNoteworthyNB82#UI_for_Run.2FDebug_launchers


I think that launchers and possibility to control appending/prepending toolchain to the PATH solves this problem fully.