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.
Summary: | $PATH is corrupted for projects with dependent library projects | ||
---|---|---|---|
Product: | cnd | Reporter: | soldatov <soldatov> |
Component: | -- Other -- | Assignee: | Thomas Preisler <thp> |
Status: | CLOSED WORKSFORME | ||
Severity: | blocker | ||
Priority: | P2 | ||
Version: | 5.x | ||
Hardware: | All | ||
OS: | Windows XP | ||
Issue Type: | DEFECT | Exception Reporter: | |
Attachments: | Project |
Description
soldatov
2006-11-23 15:46:20 UTC
I have same problem when I use any static library. Steps: - Run Netbeans on Windows (but not under cygwin) - Create 'C/C++ Static Library' project - Add into project 2 file: ------------------------------------------------------- #include <stdio.h> int hello() { printf("Hello!!!\n"); printf("%s\n", getenv("PATH")); return 0; } ------------------------------------------------------- /* * File: newfile.h * Author: tester * */ #ifndef _newfile_H #define _newfile_H #ifdef __cplusplus extern "C" { #endif int hello(); #ifdef __cplusplus } #endif #endif /* _newfile_H */ ------------------------------------------------------- - Create 'C/C++ Application' project - Add path to newfile.h into 'Include Directories' property - Add static project into Linker|Libraries|Libraries property ('Add Project' button in 'Libraries' window) - Add file into project: ------------------------------------------------------- #include <stdio.h> #include <stdlib.h> #include "newfile.h" int main(int argc, char** argv) { hello(); return (EXIT_SUCCESS); } ------------------------------------------------------- - Run project ==> Terminal appears with '[Press Enter to close window]' message only - Switch Console Type to 'Output Window (Input only)' ==> Program works correctly And I have problem with PATH variable when I use Dynamic library. Steps: - Create 'C/C++ Dynamic Library' and 'C/C++ Application' projects identical previous sample - Run Netbeans under cygwin - Switch Console Type to 'Output Window (Input only)' - Run main project ==> I see in console: Hello!!! ../Appl1/dist/Debug/GNU-Windows:/usr/local/bin:/usr/bin:/usr/bin:/usr/X11R6/bin:/cygdrive/c/WINDOWS/system32:/cygdrive/c/WINDOWS:/cygdrive/c/WINDOWS/System32/Wbem:/cygdrive/c/forte4j/extbin:/cygdrive/c/Program Files/Reflection/:/usr/bin - Close Netbeans - Run Netbeans not under cygwin - Switch Console Type to 'Default' - Run main project ==> I see in output window: Run failed. Exit value -1073741515. - Add path to dynamic library into 'Project Properties|Running|Run Directory' property ==> I see in output window: Hello!!! /cygdrive/c/WINDOWS/system32:/cygdrive/c/WINDOWS:/cygdrive/c/WINDOWS/System32/Wbem:/cygdrive/c/forte4j/extbin:/cygdrive/c/Program Files/Reflection/:/usr/bin Run successful. Exit value 0. PATH to dynamic library (../Appl1/dist/Debug/GNU-Windows) is missed This bug only manifests when netbeans is started outside the Cygwin enviroment (usually by double clicking the desktop icon or from the Start menu). If you echo $PATH from args (in dorun.sh) its correct. If you echo $PATH from helloapp its wrong. Whats happening is that because helloapp has library project dependencies, the build directories from those projects are prepended to the existing $PATH. However, the PATH lookup is done on Env-PATH instead of env-path. Since Windows uses a case independent variable Env-PATH returns null and the library paths become the entire path. The fix is to look for Env-PATH and if its not found (and the platform is Windows), look for env-path. Then prepend the additional directores (but again, only if they're for dynamic libraries). Now all scenarios work correctly I cannot run project with Dynamic library in Output Window when I am using Cygwin (works correctly with MinGW and in external terminal). Steps: - Run Netbeans - Open the attached projects - Switch Console Type to 'Default' (in Project properties window) ==> program works correctly - Switch Console Type to 'Output Window (Output only)' - Run main project ==> "Hello!!!" message doesn't appears Created attachment 54529 [details]
Project
It is not a problem with $Path. Tomorrow I will create a separated issue. Workaround: build projects with -mno-cygwin option. |