Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » How do I integrate custom compilers and linkers?
How do I integrate custom compilers and linkers? [message #1011840] Wed, 20 February 2013 10:47 Go to next message
Johnny Snail is currently offline Johnny SnailFriend
Messages: 6
Registered: December 2012
Junior Member
Hi all,

I (eclipse newbie) have a problem which seemed very easy to me, but now I can't achieve what I want.

I still have the need to compile programs for DOS, but I'd like to use a modern IDE / editor for writing my code. Therefore, I have the plan to use Eclipse for writing my code and to call my compilers, linkers and other tools from within eclipse. I know the correct command lines for these tools. But I am unsure how to integrate these into Eclipse.

Therefore, a few questions:

- I have downloaded the newest version of Eclipse with CDT. Since CDT by default works with GCC, I am not sure if this is the right starting point. What edition of Eclipse should I use if I want to use my own toolchain?

- In other IDEs, it's common to say "compile files having the extension .cpp with this tool and these command line switches, compile files having the extension .asm with ...". I did not find such possibility in Eclipse; I have played around with defining a builder, but it seems that this is the wrong way as well.

- It seems that I could try two things: Create a C/C++ project and try to exchange the toolchain (at least, after having created a C/C++ project, I have a menu item "C/C++ build" in the properties of the project), or create a "general" project and try to define my own toolchain (but I wasn't able to do so).

What's the recommended way to achieve what I want? I can't imagine that I have to write a plugin for such a simple task (I don't need to configure my compilers using the GUI, it would be sufficient to always use the same command line options).

Could someone, in the most simple words possible, show me a starting point?

Thank you very much!

[Updated on: Wed, 20 February 2013 10:48]

Report message to a moderator

Re: How do I integrate custom compilers and linkers? [message #1011875 is a reply to message #1011840] Wed, 20 February 2013 12:07 Go to previous messageGo to next message
Sebastian Wagner is currently offline Sebastian WagnerFriend
Messages: 13
Registered: June 2010
Junior Member
There are 2 possibilities I know:

1) indeed, you can create a plugin for your toolchain

2) You can create a new project called "Makefile Project with Existing Code". This means you need to write an external makefile to build the software. You can develop the software inside Eclipse and at build it will call "make" using this makefile.
Re: How do I integrate custom compilers and linkers? [message #1015266 is a reply to message #1011840] Wed, 27 February 2013 23:00 Go to previous messageGo to next message
Ivan Galicia is currently offline Ivan GaliciaFriend
Messages: 17
Registered: September 2012
Junior Member
did you try changing the "build command" field in the builder setting and probably we will need to check the "behavior" tab

regards
Re: How do I integrate custom compilers and linkers? [message #1015316 is a reply to message #1015266] Thu, 28 February 2013 08:27 Go to previous messageGo to next message
Johnny Snail is currently offline Johnny SnailFriend
Messages: 6
Registered: December 2012
Junior Member
Sebastian and Ivan, thanks for your help.

In the meantime, I have spent quite a lot of effort into making this work, but to no avail. Either Eclipse's bugs bite me (amongst other problems, dependencies can't be resolved, half of my code is red although the editor knows about the symbols (can jump to the correct place where they are declared)), or the Borland command line linker produces idiotic error messages (doesn't seem to be able to process command lines which are longer than 50 chars or so).

Despite the problems with the Borland command line tools, I am seeing no way to make Eclipse satisfyingly work with another toolchain than GCC. I even doubt that an own plugin could solve the problems with the unresolved symbols / red code in the editor; besides that, I am not a Java person, and right now, I don't have the time to write one.

Therefore, I am currently trying out Code::Blocks with the Openwatcom toolchain (which still has support for DOS targets). It looks like that this is what I've searched for.

Regards,

Johnny the Snail
Re: How do I integrate custom compilers and linkers? [message #1015611 is a reply to message #1015316] Fri, 01 March 2013 11:30 Go to previous messageGo to next message
Andrey Eremchenko is currently offline Andrey EremchenkoFriend
Messages: 8
Registered: July 2009
Junior Member
Johnny Snail wrote on Thu, 28 February 2013 03:27
I am seeing no way to make Eclipse satisfyingly work with another toolchain than GCC

Currently using Eclipse+CDT for developing project with MSVC 2010 build system. After correct configuration the indexer gives this numbers:
Quote:

Indexed 'project' (169 sources, 1,319 headers) in 85.19 sec: 192,110 declarations; 546,501 references; 0 unresolved inclusions; 91 syntax errors; 227 unresolved names (0.03%)

All system headers are from MSVC 2010, also Qt used in this project. Almost everything is resolved, navigation features work very good (a lot better than inside MSVC+VisualAssist). But no debugging inside Eclipse, so debugging is only available in MSVC.

[Updated on: Fri, 01 March 2013 11:37]

Report message to a moderator

Re: How do I integrate custom compilers and linkers? [message #1015769 is a reply to message #1015611] Sat, 02 March 2013 15:04 Go to previous messageGo to next message
Johnny Snail is currently offline Johnny SnailFriend
Messages: 6
Registered: December 2012
Junior Member
Andrey Eremchenko wrote on Fri, 01 March 2013 06:30

Currently using Eclipse+CDT for developing project with MSVC 2010 build system. After correct configuration the indexer gives this numbers:
Quote:

Indexed 'project' (169 sources, 1,319 headers) in 85.19 sec: 192,110 declarations; 546,501 references; 0 unresolved inclusions; 91 syntax errors; 227 unresolved names (0.03%)

All system headers are from MSVC 2010, also Qt used in this project. Almost everything is resolved, navigation features work very good (a lot better than inside MSVC+VisualAssist). But no debugging inside Eclipse, so debugging is only available in MSVC.


Thanks for your answer!

That's very interesting. I did everything I can imagine: at first RTFM and Google, then look at every possible option, give it all paths at every possible place, read forum posts until the eyes bleed and so on. After two days, I gave up.

I still don't know what was going on. But from reading forum posts, I know that there are many guys out there who have exactly the same problem and who were not able to solve it, too.

I should have mentioned that I wasn't using the "C/C++" kind of project (because of other problems which made it unusable in my case), but a "general" project (as far as I remember, that was the name - I have removed Eclipse in the meantime) with a custom makefile. I believe that Eclipse doesn't work correctly in this case.

The most obvious proof for the existence of bugs which relate to this matter is the following: The navigation in the code and the parameter completion was working without problems. From within my code, I could get to the declaration or definition of every symbol with a mouse click even if these were some directory levels away. Nevertheless, the respective symbols had been marked as not resolvable - the half of my code was "red". So, if it can't resolve the symbol, how can it navigate to it's declaration or definition without any problem?

I suppose that you have used the "C/C++" project template or that Eclipse is specially prepared somehow to handle the MS toolchain. Are you using a special plugin?

By the way, Code::Blocks worked very well from the beginning on, and it has good support for the OpenWatcom toolchain and others (although I have to use custom makefiles there as well). I was surprised how easily it can be configured and how reliably it works.

Regards,

Johnny the Snail

[Updated on: Sat, 02 March 2013 15:15]

Report message to a moderator

Re: How do I integrate custom compilers and linkers? [message #1016352 is a reply to message #1015769] Wed, 06 March 2013 07:48 Go to previous messageGo to next message
Tamas Csabina is currently offline Tamas CsabinaFriend
Messages: 28
Registered: November 2012
Junior Member
Hi,

It is pretty easy to achieve what you are up to:

- install the latest CDT and mingw (if you haven`t done yet)
- create a new Executable/Hello World ANSI C Project (File->New->C Project)
- in the Project Properties->C/C++ Build->Settings, modify the Command field for the Assembler (if you use it), for the compiler and for the linker. By default, it is gcc for this project type, just add your compiler and linker
- modify the Miscellaneous field of the Tools for all the command line parameters for your tools
- add your sources to the project


We are using Eclipse this way to develop a project for a non x86 target computer, using the target`s own assembler, compiler and linker. I am not 100% sure about the project type (as the project itself was created years ago), but what is sure that the configuration id of the project is: cdt.managedbuild.config.gnu.mingw.exe. (this is visible in the .cproject file).

Note: this mingw toolchain have some command line options for the compiler that you cannot ommit. The Optimization flag (-O) will be added to the command line. Your compiler has to deal with it (either use it, or ignore it).



You have mentioned Borland linker. Are you using the free command line tools from Borland? Or why can`t you use Borland`s (Embarcadero now days) own IDE, which is one of the best IDE out there?

[Updated on: Wed, 06 March 2013 07:49]

Report message to a moderator

Re: How do I integrate custom compilers and linkers? [message #1017287 is a reply to message #1016352] Mon, 11 March 2013 13:45 Go to previous messageGo to next message
Johnny Snail is currently offline Johnny SnailFriend
Messages: 6
Registered: December 2012
Junior Member
Tamas,

thank you very for your reply which is very informative. Nevertheless, there are problems:

Tamas Csabina wrote on Wed, 06 March 2013 02:48
[...]
- create a new Executable/Hello World ANSI C Project (File->New->C Project)
- in the Project Properties->C/C++ Build->Settings, modify the Command field for the Assembler (if you use it), for the compiler and for the linker. By default, it is gcc for this project type, just add your compiler and linker
- modify the Miscellaneous field of the Tools for all the command line parameters for your tools
- add your sources to the project
[...]

This is what I did in the first place. Unfortunately, there is a lot of inline assembler code in my C/C++ sources. Since this code had been written using Borland C++ 5.02, its syntax is completely incompatible with GCC's. Therefore, half of my code was red in some modules because the "normal" C/C++ projects in Eclipse / CDT only know about GCC's (MINGW's) inline assembly syntax and not about Borland's inline assembly syntax.

Quote:
[...]
Note: this mingw toolchain have some command line options for the compiler that you cannot ommit. The Optimization flag (-O) will be added to the command line. Your compiler has to deal with it (either use it, or ignore it).
[...]

That's another thing I couldn't live with. Nearly all compilers know about the -O flag (and don't have a flag to disable recognition of the -O flag Smile), and maybe other flags are added, too. To make a long story short, for this project, I could not accept that any flags would be given to the various components of the toolchain besides the flags I explicitly have set.

Quote:
[...]
You have mentioned Borland linker. Are you using the free command line tools from Borland? Or why can`t you use Borland`s (Embarcadero now days) own IDE, which is one of the best IDE out there?
[...]

1) Borland and its successors have made the Borland 5.5 compilers / binutils freely available, but only the command line versions. I got the impression that these compilers / binutils are highly respected, and I would have used them if they could produce code for DOS / 16-bit; unfortunately, that is not the case.

2) For the reason mentioned above, I have decided to use the Borland compilers / binutils 5.2; they are included in Borland C++ 5.02. I have used these for many years and know them very well. Since I am doing some dirty low-level assembler tricks in this project, I considered it essential to use compatible compilers and assemblers which could handle these tricks and produce compatible code (stack frames etc.).

3) Unfortunately, it turned out that Borland's linker was failing with idiotic messages if its command line got longer than 50 chars or so. This was far too short for us. I know I could write a command file (configuration file) for the linker and put all switches into that file instead of putting them directly onto the command line. But in the end I have lost my trust in Borland's tools due to that behavior.

Note: Interestingly enough, there never was any problem with building that very same project from within the original Borland IDE. Either the IDE has integrated its own version of the linker, or it generates a linker file on the fly while building and uses a short command line plus the commands in the linker file for linking.

4) Due to reasons mentioned above, I decided to switch to the OpenWatcom toolchain and to search for an IDE which could handle it. Code::Blocks and OpenWatcom are working like a charm; it took me 10 minutes to change the error parser for the assembler because I am using JWasm instead of the original Wasm - that was the only "problem".

Of course, I had to change some assembler code after having switched to OpenWatcom, but the result was very well worth the effort. I had to put roughly 1 week into changing assembler code and into learning about the differences in the code generated, the calling conventions and so on. But now I have a modern toolchain which should satisfy my needs for the next few years of DOS development.

5) Could you please tell me if the Embardacero IDE is free? I got the impression that it is not, and I got also the impression that it does not support Borland's old compilers which are able to generate 16-bit DOS code. Did I misunderstand this?

Regards,

Johnny the Snail

Re: How do I integrate custom compilers and linkers? [message #1017689 is a reply to message #1011840] Tue, 12 March 2013 10:35 Go to previous message
Tamas Csabina is currently offline Tamas CsabinaFriend
Messages: 28
Registered: November 2012
Junior Member
Hi,

Although I understand the Eclipse and its toolchains are now out from the picture, I will answer, maybe that helps someone else Wink.


Errors in red:
You can change/modify or completely disable that in Window menu->Preferences->General->Editors->Text Editors->Annotations.

The -O switch:
Bug #398483 was raised in January, no action taken yet (https://bugs.eclipse.org/bugs/show_bug.cgi?id=398483).

Embarcadero IDE:
No, it is not free (and relatively expensive, I would say Smile), and they are not capable of generating 16bit code.

Previous Topic:Unable to open a workspace
Next Topic:Industrial
Goto Forum:
  


Current Time: Fri Apr 26 00:42:33 GMT 2024

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

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

Back to the top