Community
Participate
Working Groups
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
I believe Sean dealt with this already. But resubmitting in the right category.
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.
Why not just add a space in the definition for the option, i.e. "-o "?
Because XML strips out trailing spaces in the file.
*** Bug 70547 has been marked as a duplicate of this bug. ***
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)
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.
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.
*** This bug has been marked as a duplicate of 70788 ***