| Problem with builder settings using workspace_loc on Linux [message #795755] |
Fri, 10 February 2012 17:27  |
Josh Davidson Messages: 12 Registered: July 2009 |
Junior Member |
|
|
Our build scripts need to have a couple crucial environment variables configured, which we set in C/C++ Build->Environment.
As one example, we set PYTHONPATH to ${workspace_loc:/SimCommon/src/Python}
This works wonderfully on Windows, but on linux the colon is detected as the path separator and the variable adds two separate entries to PYTHONPATH:
* ${workspace_loc
* /SimCommon/srcPython}
I tried escaping, but to no avail. I can't simply use ${WorkspaceDirPath} since it assumes that all projects are physically located in the workspace directory which is often not the case.
[Updated on: Fri, 10 February 2012 17:28] Report message to a moderator
|
|
|
|
|
|
| Re: Problem with builder settings using workspace_loc on Linux [message #797594 is a reply to message #797572] |
Mon, 13 February 2012 12:19   |
Josh Davidson Messages: 12 Registered: July 2009 |
Junior Member |
|
|
I'm not sure how resource_loc since I'm trying to set variables in one project to paths in others.
> workspace_loc may have a hard time calculating the actual location
This is exactly what workspace_loc is for. Going back to my early post,
${workspace_loc:/SimCommon}
${workspace_loc:/SimulationInterface}
would resolve to:
/disk01/data/davidsj2/repos/SimCommon
/disk01/data/davidsj2/repos/ast/SimulationInterface
respectively. It works find on Windows, but the reason it doesn't work on Linux (AFAICT) is the colon (:) in the variable is the path separator, and the code that resolves all of these variables appears to "split" the entire list before it performs variable lookup. So what ends up happening, is something like: ${workspace_loc:/SimCommon} is first split in half, then Eclipse performs variable replacement (no longer needed since neither "${workspace_loc" nor "/SimCommon" are valid variables).
EDIT:
${workspace_loc:<resource path>} - The absolute path on the system's hard drive to the specified resource. The <resource path> is the full path of the resource relative to the workspace root. For example ${workspace_loc:/MyProject/MyFile.txt}. Note that the expanded result of this variable is not the same as ${workspace_loc}/MyProject/MyFile.txt if the project's contents directory for MyProject is outside the workspace directory.
[Updated on: Mon, 13 February 2012 12:33] Report message to a moderator
|
|
|
| Re: Problem with builder settings using workspace_loc on Linux [message #798095 is a reply to message #797512] |
Tue, 14 February 2012 03:44   |
Axel Mueller Messages: 1827 Registered: July 2009 |
Senior Member |
|
|
Josh Davidson wrote on Mon, 13 February 2012 16:32They are projects in the workspace, but they are not physically located in the workspace directory. They were imported in. This is the whole reason I need to use workspace_loc instead of WorkspaceDirPath.
/disk01/data/davidsj2/workspace <- This is the workspace directory
/disk01/data/davidsj2/repos/SimCommon <- One project
/disk01/data/davidsj2/repos/ast/SimulationInterface <- Another project
I'm surprised it's working for you.
Are you actually printing out the value of the variable as part of the build process?
Are you specifying the value as ${workspace_loc:/<Project>/blah/blah}? If you're doing ${workspace_loc}/<Project>/blah/blah that *will* work, but it assumes the project is physically located in the workspace directory.
My projects are all inside the workspace. The environment variables are used by our external build tool which would indicate an error if the path would be invalid.
Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
|
|
|
|
|
| Re: Problem with builder settings using workspace_loc on Linux [message #801093 is a reply to message #798988] |
Fri, 17 February 2012 17:48   |
Josh Davidson Messages: 12 Registered: July 2009 |
Junior Member |
|
|
Axel Mueller wrote on Wed, 15 February 2012 05:03I am using ${workspace_loc:/tools}
"tools" is a project in my workspace. The variable is set in Project Properties-> C/C++ Build->Environment
So, I created a project called "tools" and allowed it to be stored directly in my workspace directory. Then, under C/C++ Build->Environment, I added two variables:
zomg = ${workspace_loc:/tools}
blah = ${workspace_loc}/tools
As part of my build, I printed what the environment variabes are set to. Here are the results:
$zomg=${workspace_loc:/tools}
$blah=/disk01/data/davidsj2/workspace/tools
As you can see, "zomg" wasn't set correctly. I'm wondering if you either are setting the variable as part of your standard environment or if whatever you're invoking doesn't require the variable.
In my previous post, I said it appeared as if Eclipse was splitting the variables using ${workspace_loc:/<proj>} syntax before performing varible lookup. That was incorrect. Since the variable I was setting is multi-valued, the script in my build that uses the variable splits it based on the system path separator. Well, since Eclipse isn't doing any variable substitution when using this syntax, my script got the variable as-is and proceeded to split.
[Updated on: Fri, 17 February 2012 17:52] Report message to a moderator
|
|
|
| Re: Problem with builder settings using workspace_loc on Linux [message #802909 is a reply to message #801093] |
Mon, 20 February 2012 11:46   |
Axel Mueller Messages: 1827 Registered: July 2009 |
Senior Member |
|
|
Quote:I'm wondering if you either are setting the variable as part of your standard environment or if whatever you're invoking doesn't require the variable.
As I said before I am setting the variable in Project Properties-> C/C++ Build->Environment. Just to be sure it works as excpected I changed the value of the variable and then my build tool did not work anymore. After resetting the variable to the original value it worked again.
Which Eclipse version are you using? Which plugins are installed besides CDT?
Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
|
|
|
| Re: Problem with builder settings using workspace_loc on Linux [message #808128 is a reply to message #802909] |
Mon, 27 February 2012 07:41   |
Axel Mueller Messages: 1827 Registered: July 2009 |
Senior Member |
|
|
Finally, I found out why it was working on my side but not in your setup.
Open the file org.eclipse.cdt.core.prefs in the (hidden) folder .settings in your project folder. There you will your defined environment variables
...value=${workspace_loc\:/tools}
Two lines above you see the parameter
which also belongs to your variable and denotes the path delimiter symbol (I am not sure about the meaning of this parameter).
If you open this file with a text editor and change the above line to
resolving of ${workspace_loc:/tools} will work as expected.
Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
|
|
|
|
Powered by
FUDForum. Page generated in 0.01879 seconds