Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » How to change the standard include paths for a cross compile project
How to change the standard include paths for a cross compile project [message #176667] Thu, 14 September 2006 12:20 Go to next message
Eclipse UserFriend
Originally posted by: mschnell.lumino.de

Hi Experts,

I set up a cross compile project and it does seem to compile my test
source file to an elf. But when I look at the project properties I find
include paths to the libraries of the host system (plus an include path
explicitly given as "-I" in CFLAGS in the make file). How do I change
the standard include and library paths to point to the cross environment ?

-Michael
Re: How to change the standard include paths for a cross compile project [message #176702 is a reply to message #176667] Thu, 14 September 2006 18:14 Go to previous messageGo to next message
Dan Sperka is currently offline Dan SperkaFriend
Messages: 23
Registered: July 2009
Junior Member
I recently set up a cross-compile project. My setup may not be the same
as yours, however. In my case I created a new build configuration to
build for i686 (I'm doing this on x86_64). I modified the "Command" line
under managed make's Tool Settings tabs (for the compiler and linker) to
use the cross compiler. I also modified the environment for that
particular configuration to prepend the path to that compiler executable.

Given that setup there was no need to do anything. The cross compiler
knew where its standard include files were, and they were automatically
included correctly. The extra includes I add are also there, but I never
had to add in the system include files.

Now, I created my cross compiler using crosstool (great tool, builds
cross compilers automagically for many configurations -- mostly linux
based however). IIRC crosstool actually downloads and builds the
compiler and C libs under a folder on your system. Within that structure
you end up with compiler, binutils and all the #includes you could
ever want.

Hope this helps,

Dan

Michael Schnell wrote:
> Hi Experts,
>
> I set up a cross compile project and it does seem to compile my test
> source file to an elf. But when I look at the project properties I find
> include paths to the libraries of the host system (plus an include path
> explicitly given as "-I" in CFLAGS in the make file). How do I change
> the standard include and library paths to point to the cross environment ?
>
> -Michael
Re: How to change the standard include paths for a cross compile project [message #176813 is a reply to message #176667] Mon, 18 September 2006 06:59 Go to previous messageGo to next message
Norbert Plött is currently offline Norbert PlöttFriend
Messages: 233
Registered: July 2009
Senior Member
Michael,

> source file to an elf. But when I look at the project properties I find
> include paths to the libraries of the host system (plus an include path

is this actually "project properties" or are you talking about the contents
of the "Includes" container under the project node in the C/C++ Projects
view?
If this is the case, this container is filled by the scanner discovery
mechanism and there is no way from the UI for managed make projects to set
the correct include paths.

There is a remedy, but before I detail this please give me feedback whether
my diagnosis is correct :-)


Cheers,


Norbert
Re: How to change the standard include paths for a cross compile project [message #176846 is a reply to message #176813] Mon, 18 September 2006 12:55 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mschnell.lumino.de

Norbert Ploett wrote:
> Michael,
>
>> source file to an elf. But when I look at the project properties I find
>> include paths to the libraries of the host system (plus an include path
>
> is this actually "project properties" or are you talking about the contents
> of the "Includes" container under the project node in the C/C++ Projects
> view?

Hi Norbert,

Many thanks for answering.

Sorry for being unclear, but I'm quite new to this and I still am very
uncertain about what is what on the Eclipse surface.

I see these paths both on the left side of the main window ("C/C++
project") in "includes" and in "Project -> properties -> C/C++ project
paths -> Path containers -> discovered Paths -> include Paths". So, yes,
I do suppose they are detected by the indexer.


> If this is the case, this container is filled by the scanner discovery
> mechanism and there is no way from the UI for managed make projects to set
> the correct include paths.

At the moment this is not a managed project, but a "Standard Make
Project, so maybe I need to modify the make file (that I created from a
working cross compile make file that was not used with eclipse but just
"native".

But the goal of my efforts is to create a sample (I'm just doing "Hello
World" right now) of an Eclipse "Managed Make Project" for this cross
environment (ARM). The goal is porting a quite complex program
containing some 100 *h and *c source files to Linux, so I think I am
better off with a Managed project when I add them one by one.

I suppose I need to create, find or modify a make file template or
something like that, to have Eclipse write the make files correctly from
the information the Indexer collects.

>
> There is a remedy, but before I detail this please give me feedback whether
> my diagnosis is correct :-)
>

It would be great if you could help me to first get the "Standard Make
Project" work correctly and then find a way to do a "Managed Project".


Thanks again,
-Michael
Re: How to change the standard include paths for a cross compile project [message #176961 is a reply to message #176846] Wed, 20 September 2006 20:56 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: norbert.ploett.fen-net.de

Michael,

> It would be great if you could help me to first get the "Standard Make
> Project" work correctly and then find a way to do a "Managed Project".

it took a little while because I am not so familiar with standard make.

Try this: Go to project properties -> C/C++ Make Project -> Discovery
Options. From the Discovery Profile combo select GCC per project scanner
info profile and then change the "Compiler invocation command" from
"gcc" (the default) to invoke your cross compiler instead.

And this should also change the contents of the Includes container.

Helpful?



Norbert
Re: How to change the standard include paths for a cross compile project [message #177054 is a reply to message #176667] Thu, 21 September 2006 17:35 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: andrejohn.mas.com.gmail

Hi,

I don't know if my experience is worth mentioning. Take from this anything
you might find useful:

Where I am we develop for an embedded platform using eCos on an a PowerPC
8xx based card and we are using Windows XP as the development platform.
This comes with a modified CDT 3.0, but for one reason or other we decided
to migrate to Eclipse 3.2 with the standard CDT 3.1 release.

The eCos developer's kit comes with a modified gcc environment. The first
thing we did is ensure that the gcc they provided was accessible in the
Windows search path. We the created a managed make project, since no one
really had much experience in standard make files. The project type we
selected was "Executable (Gnu)", though it turns out that "Executable (Gnu
on Windows)" should have been selected instead, since the latter supports
converting of Cygwin unix type paths to Windows type paths - other than
issues with the indexer we didn't experience any other issues, so we just
left things the way they are.

Next, since the the gcc command was prefixed with 'powerpc-eabi-' we added
it as a prefix to 'Command' field in the C, C++ and linker sections, in
the project sections. Then in the miscalleneous section of the C compiler
and C++ compiler sections of the project added the necessary flags:

-c -fmessage-length=0 -msoft-float -mcpu=860 -Wpointer-arith -Winline
-Wundef
-Woverloaded-virtual -ffunction-sections -fdata-sections -D_REENTRANT

We then added the necessary include paths. We didn't specify any extra
libraries in the 'Libraries' option of the linker, but this is the place
to specify them if you need them. We simply added what we needed in the
miscallaneous section:

-nostdlib -L $(ECOS_INSTALL_DIR)/lib -Ttarget.ld -msoft-float -mcpu=860 -g
-O1 -Wl,--gc-sections -Wl,-static

Andre
Re: How to change the standard include paths for a cross compile project [message #177131 is a reply to message #176961] Fri, 22 September 2006 11:28 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mschnell.lumino.de

> it took a little while because I am not so familiar with standard make.
>

Norbert, thanks a lot !!!

As I am out of office for a week I'm going to try this as soon as I am
back.

Do you have suggestions how to set up a managed make project with this
cross compile environment ? I suppose I need to create template make
files or something like this, to enable Eclipse to write the make files
needed to compile the project from the indexer information. How to start ?

Thanks again,
-Michael
Re: How to change the standard include paths for a cross compile project [message #177138 is a reply to message #177054] Fri, 22 September 2006 11:38 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mschnell.lumino.de

Andre-John, thanks for answering.

So you did not need to provide any make file templates but just set some
appropriate options ? Great !

I'll try to create a new "managed project" from scratch when I'm back in
the office.


> -nostdlib -L $(ECOS_INSTALL_DIR)/lib -Ttarget.ld -msoft-float -mcpu=860 -g

Where did you set the actual value for the environment setting
ECOS_INSTALL_DIR ?

Thanks,
- Michael
Re: How to change the standard include paths for a cross compile project [message #177152 is a reply to message #177138] Fri, 22 September 2006 14:17 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: andrejohn.mas.com.gmail

Michael Schnell wrote:

>> -nostdlib -L $(ECOS_INSTALL_DIR)/lib -Ttarget.ld -msoft-float -mcpu=860 -g

> Where did you set the actual value for the environment setting
> ECOS_INSTALL_DIR ?

Under the Environment tab in the project settings. It is definetly there
in the
managed make project.

Andre
Re: How to change the standard include paths for a cross compile project [message #177224 is a reply to message #177131] Mon, 25 September 2006 08:56 Go to previous messageGo to next message
Norbert Plött is currently offline Norbert PlöttFriend
Messages: 233
Registered: July 2009
Senior Member
Michael,

> Do you have suggestions how to set up a managed make project with this
> cross compile environment ? I suppose I need to create template make files
> or something like this, to enable Eclipse to write the make files needed
> to compile the project from the indexer information. How to start ?

for managed make I would suggest that you define your own project types.
There is online documentation on this, so open the help browser and go to
CDT Plug-in Developer Guide -> Programmer's Guide -> Managed Build System
Extensibility Document

Try the tutorial and come back with specific questions.


Cheers,


Norbert
Re: How to change the standard include paths for a cross compile project [message #177939 is a reply to message #177224] Thu, 05 October 2006 14:55 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mschnell.lumino.de

(back from holiday)

> for managed make I would suggest that you define your own project types.
> There is online documentation on this, so open the help browser and go to
> CDT Plug-in Developer Guide -> Programmer's Guide -> Managed Build System
> Extensibility Document
>
> Try the tutorial and come back with specific questions.

I'll do this as soon as I can. I hope that this will not involve any
Java, as with that I'm lost.

I am astonished that there is not a standard way to set up a managed C
cross compile project in Eclipse. This seems like a thing needed very often.

Thanks again,

-Michael
Re: How to change the standard include paths for a cross compile project [message #177947 is a reply to message #177152] Thu, 05 October 2006 14:57 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mschnell.lumino.de

> Under the Environment tab in the project settings. It is definetly there
> in the managed make project.


Thanks, I'll take a look, soon
-Michael
Re: How to change the standard include paths for a cross compile project [message #177962 is a reply to message #177939] Thu, 05 October 2006 15:38 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dmsubs.NOSPAM.consertum.com

You can do this in a number of ways.

1. If you have just Eclipse+CDT, the default compiler for managed make projects
is called 'gcc'. You can rename this (e.g. arm-elf-gcc) by editing the project
properties. You will also need to do this for the assembler and linker.
Unfortunately, you will need to do the same for each new project you create.

2. Using the MBS, you can define your own project types. You will need to create
a plugin, but to rename the compilation tools, you only need to write a bit of
XML. This would allow you to create projects with your compiler (and default
options) set automatically. For some clues how to do this, look at
https://bugs.eclipse.org/bugs/show_bug.cgi?id=95110

--
Derek


Michael Schnell wrote:
> (back from holiday)
>
>> for managed make I would suggest that you define your own project
>> types. There is online documentation on this, so open the help browser
>> and go to CDT Plug-in Developer Guide -> Programmer's Guide -> Managed
>> Build System Extensibility Document
>>
>> Try the tutorial and come back with specific questions.
>
> I'll do this as soon as I can. I hope that this will not involve any
> Java, as with that I'm lost.
>
> I am astonished that there is not a standard way to set up a managed C
> cross compile project in Eclipse. This seems like a thing needed very
> often.
>
> Thanks again,
>
> -Michael
Re: How to change the standard include paths for a cross compile project [message #177970 is a reply to message #177947] Thu, 05 October 2006 15:38 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: bb.ncp.de

Michael Schnell schrieb:
>> Under the Environment tab in the project settings. It is definetly
>> there in the managed make project.
>
>
> Thanks, I'll take a look, soon
> -Michael

Hi together,

sorry Michael I do not want to hijack your thread, but I think it
belongs together. I have the same question with more details. My system:
WinXP
MinGW
CDT: Latest

I am using a standard c++ project. With a simple test.h file. I tried
the following things to include the file in the system to get the
comfort of the indexer:
1. Set Include path of my own h-files to Winxp-PATH -> nothing changed
2. Set a Env-Variable for Makefiles in CDT C_INCLUDES_PATH for the
compiler -> Nothing changed
3. add the path to includes&symbols under Project -> nothing changed
4. Changed the makefile with the option g++ -o"HelloWorld.exe"
-I"d:\project\c++\includes" main.cpp -> nothing changed
5. Changes from point 4. + changing the main file from #include <test>
to #include <test.h> -> indexing and building works -> strange thing is
the indexer couldn?t find tokens from <iostream>

The only includes which I can use without any trouble are the standards
from mingw ...


Maybe someone can explain how all the variables, settings work together?
Thanks ahead.

Boris
Re: How to change the standard include paths for a cross compile project [message #178001 is a reply to message #177970] Fri, 06 October 2006 11:54 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mschnell.lumino.de

>
> sorry Michael I do not want to hijack your thread, but I think it
> belongs together. I have the same question with more details. My system:
> WinXP
> MinGW

Of course I am eager to learn how all this works, but I'm not intending
to deal with the additional complexity of using Cygwin and friends to
make the Linux based GNU tools work on Windows.

-Michael
Re: How to change the standard include paths for a cross compile project [message #178018 is a reply to message #177962] Fri, 06 October 2006 12:09 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mschnell.lumino.de

Derek, thanks for jumping in

> 1. If you have just Eclipse+CDT, the default compiler for managed make
> projects is called 'gcc'. You can rename this (e.g. arm-elf-gcc) by
> editing the project properties. You will also need to do this for the
> assembler and linker. Unfortunately, you will need to do the same for
> each new project you create.

OK, but I as I wrote in the thread subject, besides using the correct
gcc and friends (which I at the moment do in a standard make project by
creating the make file appropriately) I suppose this method will not
solve the problem of making gcc and eclipse aware of the the include
(and link library) paths of the cross compile environment.

>
> 2. Using the MBS, you can define your own project types. You will need
> to create a plugin, but to rename the compilation tools, you only need
> to write a bit of XML. This would allow you to create projects with your
> compiler (and default options) set automatically. For some clues how to
> do this, look at
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=95110
>

What is MBS ?

As I am completely new to this I would need to find out lots of stuff
here: what kind of plugin is needed here ? How to create/modify a plugin
? What XML files ? What does the XML file contain ? ...?

As supposedly cross compiling a Linux program in a Linux environment is
a very common thing in the industry I hoped that there would be an easy
way to set up an appropriate Eclipse environment for this.

-Michael
Re: How to change the standard include paths for a cross compile project [message #178025 is a reply to message #177224] Fri, 06 October 2006 13:21 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mschnell.lumino.de

> There is online documentation on this, so open the help browser and go to
> CDT Plug-in Developer Guide -> Programmer's Guide -> Managed Build System
> Extensibility Document
>

What is the "Help browser" regarding Eclipse/CDT?

Thanks,
-Michael
Re: How to change the standard include paths for a cross compile project [message #178039 is a reply to message #178018] Sat, 07 October 2006 16:28 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dmsubs.NOSPAM.consertum.com

MBS == Managed Build System. There is a document called the Managed Build
Systems Extensibility Document provided in the CDT help system.

[Having re-read this, it sounds like a lecture. It is not meant to be. I am just
trying to point out why Eclipse/CDT does not support every combination of tools
that you might want it to]

Eclipse is a generic framework. CDT is a (series of) plugins that adds generic
awareness of C/C++ development to Eclipse. There are many (hundreds?) of
combinations of C/C++ compilers/debuggers for different targets/platforms.

CDT itself, does not attempt to address the issue of supporting a specific
compiler/debugger on a specific host, targeting a specific target. That is why
there is such a good plugin architecture.

Don't forget that this is 'free' software. As with most 'free' software, it may
not support exactly what you want to do, but can be made to do what you want
with a little effort.

It is possible (without writing any plugins) to support different host/target
platforms, although it does require configuring Eclipse/CDT for each new project.

With a little up-front effort, plugins can be written to do that 'automatically'.

However, most people do not have the time or expertise to do this. This is where
the commercial products, based around Eclipse/CDT, come into play. There are
many different commercial C/C++ tools based on Eclipse/CDT, each supporting
different combinations of host/target development.

HTH
--
Derek


Michael Schnell wrote:
> Derek, thanks for jumping in
>
>> 1. If you have just Eclipse+CDT, the default compiler for managed make
>> projects is called 'gcc'. You can rename this (e.g. arm-elf-gcc) by
>> editing the project properties. You will also need to do this for the
>> assembler and linker. Unfortunately, you will need to do the same for
>> each new project you create.
>
> OK, but I as I wrote in the thread subject, besides using the correct
> gcc and friends (which I at the moment do in a standard make project by
> creating the make file appropriately) I suppose this method will not
> solve the problem of making gcc and eclipse aware of the the include
> (and link library) paths of the cross compile environment.
>
>>
>> 2. Using the MBS, you can define your own project types. You will need
>> to create a plugin, but to rename the compilation tools, you only need
>> to write a bit of XML. This would allow you to create projects with
>> your compiler (and default options) set automatically. For some clues
>> how to do this, look at
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=95110
>>
>
> What is MBS ?
>
> As I am completely new to this I would need to find out lots of stuff
> here: what kind of plugin is needed here ? How to create/modify a plugin
> ? What XML files ? What does the XML file contain ? ...?
>
> As supposedly cross compiling a Linux program in a Linux environment is
> a very common thing in the industry I hoped that there would be an easy
> way to set up an appropriate Eclipse environment for this.
>
> -Michael
Re: How to change the standard include paths for a cross compile project [message #178070 is a reply to message #178039] Mon, 09 October 2006 09:19 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mschnell.lumino.de

Derek Morris wrote:
> MBS == Managed Build System. There is a document called the Managed
> Build Systems Extensibility Document provided in the CDT help system.
>

OK. I've yet to find the "CDT help system".

> [Having re-read this, it sounds like a lecture. It is not meant to be. I
> am just trying to point out why Eclipse/CDT does not support every
> combination of tools that you might want it to]


No problem.

>
> Eclipse is a generic framework. CDT is a (series of) plugins that adds
> generic awareness of C/C++ development to Eclipse. There are many
> (hundreds?) of combinations of C/C++ compilers/debuggers for different
> targets/platforms.

Of course. That is why I supposed that there might be an "official" or
"central" document on how to set up such a cross compile environment
with Eclipse/CDT/MBS (while the "native" compile system is what is
created by the default installation).

>
> CDT itself, does not attempt to address the issue of supporting a
> specific compiler/debugger on a specific host, targeting a specific
> target. That is why there is such a good plugin architecture.

OK, but I don't suppose the different Cross environments for different
CPUs (all with GNU tools) each need different plugins. I _suppose_, a
single set of plugins should be able to create a GNU cross compile and
debug environment with Eclipse/CDT/MBS and the names of the CPU specific
GNU-Tools can be configure somewhere (with cross-compile make files is
just a "prefix" variable extending the GNU tool file names (something
like "XXXXgcc" and friends"), that needs to be set somewhere).

>
> Don't forget that this is 'free' software. As with most 'free' software,
> it may not support exactly what you want to do, but can be made to do
> what you want with a little effort.

At the moment I already did read a lot about this but am still
completely lost, though I think I am decently experienced with embedded
software. I do know, that I can buy an environment that is said to do
exactly what I want and offers a year of free support for some €3000,
but I still do hope that I can get this working with the help of this
group and learn more about all this in the process.

>
> It is possible (without writing any plugins) to support different
> host/target platforms, although it does require configuring Eclipse/CDT
> for each new project.

Does "project" mean something like "set of source and target files" here
? That should not be much of a problem, especially as I seem to remember
that it's possible to create a project based on an existing project.

>
> With a little up-front effort, plugins can be written to do that
> 'automatically'.

I suppose writing plugins is beyond my scope at the moment. I might
consider doing this once I got something productive running with Eclipse
at all. I do see that the possibility of creating your own plugins is a
major beauty of Eclipse's, but for the time being I do hope, Eclipse is
at least useful for me without it.

>
> However, most people do not have the time or expertise to do this. This
> is where the commercial products, based around Eclipse/CDT, come into
> play. There are many different commercial C/C++ tools based on
> Eclipse/CDT, each supporting different combinations of host/target
> development.
>

I do know this, but at the moment my task is doing recherches on how the
project in question (porting a large firmware system to Linux) can be
handled (e.g. with or without Eclipse). And so I can't spend a lot of
money to buy a tool an dump it later. I need to find out if Eclipse is
really helpful before, and to do this I need to actually use it decently
with a small example project. If I somehow can get hold of a "hallo
world" project, I can compile for and debug on my ARM board, I suppose I
can do a decision that might include shelling out money for support that
could get me up to speed faster once the decision for Eclipse is done.

-Micheal
Re: How to change the standard include paths for a cross compile project [message #178170 is a reply to message #178025] Tue, 10 October 2006 08:51 Go to previous messageGo to next message
Anton Leherbauer is currently offline Anton LeherbauerFriend
Messages: 490
Registered: July 2009
Senior Member
Michael Schnell wrote:
>> There is online documentation on this, so open the help browser and go
>> to CDT Plug-in Developer Guide -> Programmer's Guide -> Managed Build
>> System Extensibility Document
>>
>
> What is the "Help browser" regarding Eclipse/CDT?
>
> Thanks,
> -Michael

It's under Help > Help Contents. Pretty obvious.
BTW, you need to have the CDT SDK installed
to see the mentioned developer guide.

HTH,
Toni

--
Anton Leherbauer
Wind River CDT Team, Austria
Re: How to change the standard include paths for a cross compile project [message #178178 is a reply to message #178170] Tue, 10 October 2006 09:53 Go to previous message
Eclipse UserFriend
Originally posted by: mschnell.lumino.de

Anton Leherbauer wrote:
> Michael Schnell wrote:
>>> There is online documentation on this, so open the help browser and
>>> go to CDT Plug-in Developer Guide -> Programmer's Guide -> Managed
>>> Build System Extensibility Document
>>>
>>
>> What is the "Help browser" regarding Eclipse/CDT?
>>
>> Thanks,
>> -Michael
>
> It's under Help > Help Contents. Pretty obvious.
> BTW, you need to have the CDT SDK installed
> to see the mentioned developer guide.


Ahh,

so I need to find and install the "CDT SDK". Supposedly right now I just
have the runtime. Learning something new every day, here....

-Michael
Previous Topic:Gathering File Statistics Information
Next Topic:Breakpoints ignored
Goto Forum:
  


Current Time: Sat Apr 27 03:41:33 GMT 2024

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

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

Back to the top