Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
Bug 89962 - $PATH is corrupted for projects with dependent library projects
$PATH is corrupted for projects with dependent library projects
Status: CLOSED WORKSFORME
Product: cnd
Classification: Unclassified
Component: -- Other --
5.x
All Windows XP
: P2 (vote)
: 6.x
Assigned To: Thomas Preisler
issues@cnd
projectsystem waive
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2006-11-23 15:46 UTC by soldatov
Modified: 2007-12-27 17:24 UTC (History)
0 users

See Also:
Issue Type: DEFECT
:


Attachments
Project (26.03 KB, application/x-compressed)
2007-12-27 15:41 UTC, soldatov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description soldatov 2006-11-23 15:46:20 UTC
IDE clean PATH variable when external console is used and therefore HelloApp
sample project can not be run correctly on Windows (If Netbeans is started not
under cygwin).

Steps:
- Run Netbeans on Windows (not under cygwin)
- Create HelloApp project
- Build project
- Run project
==> Terminal appears with '[Press Enter to close window]' message only!!!
- Switch Console Type to 'Output Window (Input only)'
==> I see in output tab:
--------------------------------
Hello from main...
Hello from hello1...
Hello from hello2...

Arguments:
1: argument1
2: argument2

Run successful. Exit value 0.
--------------------------------
- Switch Console Type to 'Default'
- Find c:\netbeans-5.5\cnd1\dorun.sh script and add 2 strings:
echo $PATH
export PATH=/usr/bin:$PATH
- Run project
==> I see in output tab:
./hello1lib/dist/Debug:./hello2lib/dist/Debug <-- It is all PATH!!!
Hello from main...
Hello from hello1...
Hello from hello2...

Arguments:
1: argument1
2: argument2

Run successful. Exit value 0.
Comment 1 soldatov 2006-11-24 12:13:45 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
Comment 2 soldatov 2006-11-24 12:49:01 UTC
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
Comment 3 _ gordonp 2006-11-29 00:29:10 UTC
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).
Comment 4 soldatov 2007-04-29 12:26:34 UTC
Now all scenarios work correctly
Comment 5 soldatov 2007-12-27 15:40:23 UTC
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
Comment 6 soldatov 2007-12-27 15:41:23 UTC
Created attachment 54529 [details]
Project
Comment 7 soldatov 2007-12-27 17:23:39 UTC
It is not a problem with $Path. Tomorrow I will create a separated issue.
Workaround: build projects with -mno-cygwin option.


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo