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: | Allow the use of environment variables in build environment | ||
---|---|---|---|
Product: | cnd | Reporter: | johanp |
Component: | Toolchain | Assignee: | Alexander Simon <alexvsimon> |
Status: | REOPENED --- | ||
Severity: | normal | ||
Priority: | P3 | ||
Version: | 8.1 | ||
Hardware: | PC | ||
OS: | Mac OS X | ||
Issue Type: | DEFECT | Exception Reporter: |
Description
johanp
2016-06-10 22:42:59 UTC
The only workaround (I finally realized after having some issues of getting NetBeans to accept the commands) is to add some some shell commands as a customized pre-Build: So for example I need to add a hardcoded path such as: /bin/sh -c "export PATH='/usr/local/bin:/bin:/usr/bin'; export XML_CATALOG_FILES="/usr/local/etc/xml/catalog"; ./configure --prefix=/usr/local CC=${IDE_CC} CFLAGS='-g3 -gdwarf-2' " in the pre-Build command dialogue of NetBeans However, I still hink there needs to be an option (in analogue to the run environment possibility). It is also very unclear, to me, on what environment NetBeans is actually using. Hi johanp, Could you clarify how did you start Netbeans? Netbeans should inherit terminal env if you start Netbeans from terminal. If you start Netbeans as application by MAC GUI, env inside Netbeans is initialized in other way. Alexander I start Netbeans from the UI (the normal OS X way for UI applications). Shame to say (and I'm embarrassed..) it hasn't occurred to me to start it from the terminal on OS X (as I do on other systems) since it normally requires specifying the full path under the Application folder and it is a very "un OS X" way to start GUI applications. I tried it and starting from the command line gives (of course) the correct environment. It is only when started from the UI the environment is not set. Not sure on the best way to resolve this. Perhaps when Netbeans start it would be possible to "dummy" start a terminal and run a small script which outputs the environment variables defined and stores them. When the shell is later on directly started one of the Posix calls which allows the environment to be passed in as an argument could be used to start the command shell. Seems like a "clutch"-solution though ... The only other way I can think of is to add a small "start netbeans" script/program which is added to the "/bin" path so that it is easier to start netbeans directly from a terminal and also detach the started Netbeans from it's controlling terminal and put in the background. Inheritance env from parent process (terminal) is a standard way to setup env inside Netbeans. You can also google how to setup env for Mac applications (for example edit *.plist). So it is not a bug. You can reopen the issue as an enhancement. Alexander, that argument is bogus. If that argument was valid, there wouldn't be an option for setting environment variables for the RUN command. What we're asking for is the same setting, but for the BUILD command. And no, it's completely inappropriate to set my user environment and then start netbeans. You know netbeans can have multiple projects and multiple configurations at the same time right? I want that too. I don't want to exit netbeans, change an environment variable and restart netbeans. That's madness. Please come up with a substantially better reason for closing this. (In reply to kpalsson from comment #5) > Alexander, that argument is bogus. If that argument was valid, there > wouldn't be an option for setting environment variables for the RUN command. > What we're asking for is the same setting, but for the BUILD command. Have you tried Launchers? http://wiki.netbeans.org/NewAndNoteworthyNB82#UI_for_Run.2FDebug_launchers Btw, you can open corresponding nbproject/launcher.properties and nbproject/private/launcher.properties to read comments. I think you can specify ENV vars there as well and then you will have submenu in project context menu instead of plain Run/Build Btw, due to https://netbeans.org/bugzilla/show_bug.cgi?id=269165 in build command you need to specify sh -e "your build command using $ENV_VAR" |