Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Problem with builder settings using workspace_loc on Linux(workspace_loc not resolved correctly on Linux installs of Eclipse)
Problem with builder settings using workspace_loc on Linux [message #795755] Fri, 10 February 2012 22:27 Go to next message
Josh Davidson is currently offline Josh DavidsonFriend
Messages: 14
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 22:28]

Report message to a moderator

Re: Problem with builder settings using workspace_loc on Linux [message #797414 is a reply to message #795755] Mon, 13 February 2012 13:06 Go to previous messageGo to next message
Axel Mueller is currently offline Axel MuellerFriend
Messages: 1973
Registered: July 2009
Senior Member
No Problem here (Eclipse Indigo on Linux). The variable is correctly resolved. As far as I remember this worked on Eclipse Helios, too.
Is SimCommon a project in your workspace and has the subfolders src/Python (case sensitive!)?


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 #797512 is a reply to message #797414] Mon, 13 February 2012 15:32 Go to previous messageGo to next message
Josh Davidson is currently offline Josh DavidsonFriend
Messages: 14
Registered: July 2009
Junior Member
They 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.
Re: Problem with builder settings using workspace_loc on Linux [message #797572 is a reply to message #797512] Mon, 13 February 2012 16:57 Go to previous messageGo to next message
David Wegener is currently offline David WegenerFriend
Messages: 1445
Registered: July 2009
Senior Member
Have you tried using resource_loc instead of workspace_loc? since the project isn't in the workspace, workspace_loc may have a hard time calculating the actual location. Resource_loc should resolve using the linked path.
Re: Problem with builder settings using workspace_loc on Linux [message #797594 is a reply to message #797572] Mon, 13 February 2012 17:19 Go to previous messageGo to next message
Josh Davidson is currently offline Josh DavidsonFriend
Messages: 14
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 17: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 08:44 Go to previous messageGo to next message
Axel Mueller is currently offline Axel MuellerFriend
Messages: 1973
Registered: July 2009
Senior Member
Josh Davidson wrote on Mon, 13 February 2012 16:32
They 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 #798357 is a reply to message #798095] Tue, 14 February 2012 15:25 Go to previous messageGo to next message
Josh Davidson is currently offline Josh DavidsonFriend
Messages: 14
Registered: July 2009
Junior Member
Axel Mueller wrote on Tue, 14 February 2012 03:44
Josh Davidson wrote on Mon, 13 February 2012 16:32
They 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.


Is the environment variable you're using inside of Eclipse doing ${workspace_loc}/blah/blah or ${workspace_loc:/blah/blah}. If the former, it should be working. If it's the latter, would you mind pasting in how you're setting it that is keeping Eclipse from splitting the value at the colon prior to performing the variable substitution.
Re: Problem with builder settings using workspace_loc on Linux [message #798988 is a reply to message #798357] Wed, 15 February 2012 10:03 Go to previous messageGo to next message
Axel Mueller is currently offline Axel MuellerFriend
Messages: 1973
Registered: July 2009
Senior Member
I am using ${workspace_loc:/tools}
"tools" is a project in my workspace. The variable is set in Project Properties-> C/C++ Build->Environment


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 22:48 Go to previous messageGo to next message
Josh Davidson is currently offline Josh DavidsonFriend
Messages: 14
Registered: July 2009
Junior Member
Axel Mueller wrote on Wed, 15 February 2012 05:03
I 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 22: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 16:46 Go to previous messageGo to next message
Axel Mueller is currently offline Axel MuellerFriend
Messages: 1973
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 12:41 Go to previous messageGo to next message
Axel Mueller is currently offline Axel MuellerFriend
Messages: 1973
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
delimiter=\:

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
delimiter=;

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
Re: Problem with builder settings using workspace_loc on Linux [message #808144 is a reply to message #808128] Mon, 27 February 2012 13:00 Go to previous message
Axel Mueller is currently offline Axel MuellerFriend
Messages: 1973
Registered: July 2009
Senior Member
Quote:
Two lines above you see the parameter
delimiter=\:

which also belongs to your variable and denotes the path delimiter symbol (I am not sure about the meaning of this parameter).

OK, it is not a path delimiter but a list delimiter. I found the info here
https://bugs.eclipse.org/bugs/show_bug.cgi?id=284843


Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
Previous Topic:Error in compailing shared object project
Next Topic:How does CDT get type info in Variable View
Goto Forum:
  


Current Time: Fri Mar 29 08:50:45 GMT 2024

Powered by FUDForum. Page generated in 0.02922 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top