Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 69575 - [Managed Build] gcc needs a space between -o and the outfile
Summary: [Managed Build] gcc needs a space between -o and the outfile
Status: RESOLVED DUPLICATE of bug 70788
Alias: None
Product: CDT
Classification: Tools
Component: cdt-build (show other bugs)
Version: 2.0   Edit
Hardware: Macintosh Mac OS X - Carbon (unsup.)
: P3 normal with 2 votes (vote)
Target Milestone: 2.1   Edit
Assignee: Sean Evoy CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 70547 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-07-08 04:06 EDT by Dylan Schell CLA
Modified: 2004-11-01 14:38 EST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dylan Schell CLA 2004-07-08 04:06:31 EDT
Trying to build a simple managed make project failes since the link command line is

gcc  -ooutput src/c/object.o

If I manually call:

gcc -o output src/c/object.o

Then it works as expected
Comment 1 Alain Magloire CLA 2004-07-16 11:59:22 EDT
I believe Sean dealt with this already.
But resubmitting in the right category.
Comment 2 Sean Evoy CLA 2004-07-16 17:28:29 EDT
We already know about the problem with 'ld' on MacOS. Unfortunately, it is the 
only implementation of ld that has this limitation. I will put a copy of the 
steps to work-around this problem on MacOS below.

The work-around is to modify the output extension for linker tool so that it 
generates '--output=<program_name>' instead of '-o<program_name>'.

To fix projects that already exist in the workspace
1. Switch to the Navigator view
2. Open the .cdtbuild file for the offending project
3. Find any XML entry that starts something like <toolReference 
id="cdt.managedbuild.tool.gnu.cpp.linker" (make sure you get them all)
4. Modify the outputFlag attribute so that it contains '--output=' 
5. Close and reopen the project to force the build info to update
6. Rebuild


To make this fix permanent (assuming it worked on your version of 'ld'), you 
have to edit the plugin file that specs the GCC toolchain.
Make sure you actually have the SDK version of the CDT because we are modifying 
source. I haven't tested this method with the standard install. I did my 
editing from the Plug-in Development View, but it isn't necessary to do so. 

1. Import > External Plug-ins and Fragments
2. Import As "Projects with source folders" > Next
3. Select org.eclipse.cdt.managedbuilder.ui > Add > Finish 
4. Open the "plugin.xml" file in the project that was created during the import
5. Select the "Extensions" tab in the plug-in editor
6. Expand the org.eclipse.cdt.managedbuilder.core.ManagedBuildInfo point
7. By default, two linkers are defined (it will either have the name "GCC C 
Linker (tool)" or "GCC C++ Linker (tool)"). Select one of these two.
8. Change the value of "outputFlag" from -o to --output= for both definitions.
9. Save 
10. Copy <workbench_location>/org.eclipse.cdt.managedbuilder.ui/plugin.xml to 
<eclipse_location>/plugins/org.eclipse.cdt.managedbuilder.ui_2.0.0
11. You can fully delete the plugin project you imported. 
12. Here comes the tricky part. I found that I had to disable and renable the 
Eclipse C/C++ Development Tooling SDK for the change to get picked up. You can 
do this from the Help > Software Updates > Managed Configuration ... dialog. 
The only pointer I can give you here is to make sure you have clicked the "Show 
Disabled Features" menu button (3rd from left) so that when you reenable the 
CDT, you can actually see the feature in the list.

Comment 3 Doug Schaefer CLA 2004-07-18 19:21:49 EDT
Why not just add a space in the definition for the option, i.e. "-o "?
Comment 4 Sean Evoy CLA 2004-07-19 09:19:48 EDT
Because XML strips out trailing spaces in the file. 
Comment 5 Sean Evoy CLA 2004-07-21 11:55:50 EDT
*** Bug 70547 has been marked as a duplicate of this bug. ***
Comment 6 Sean Evoy CLA 2004-07-21 14:21:13 EDT
We may be able to retarget this to 2.0.1 if there is time and if we can come 
up with a syntax to handle whitespaces in XML specs (i.e. //s)
Comment 7 josh walker CLA 2004-07-25 18:29:55 EDT
I created a managed build project and tried to fix it using the steps outlined in comment 2, but when I 
came to this item:

3. Find any XML entry that starts something like <toolReference 
id="cdt.managedbuild.tool.gnu.cpp.linker" (make sure you get them all)

I find there is no entry with that name, or indeed any reference to a linker.  I changed all occurrences of 
"outputFlag='-o'" to "outputFlag='--output='", but I still get the error.
Comment 8 Sean Evoy CLA 2004-07-28 10:11:04 EDT
If your ".cdtbuild" file does not have a reference to the linker, it's because 
you have not overridden any linker settings. In that case, the build model will 
be using the defaults from the linker defined in the plugin.xml file. 
Comment 9 Sean Evoy CLA 2004-11-01 14:38:30 EST

*** This bug has been marked as a duplicate of 70788 ***