Skip to main content



      Home
Home » Language IDEs » C / C++ IDE (CDT) » (CDT 3.1 RC2 managed build) Switch between mingw and cygwin toolchains
(CDT 3.1 RC2 managed build) Switch between mingw and cygwin toolchains [message #170624] Thu, 01 June 2006 21:00 Go to next message
Eclipse UserFriend
I just started using eclipse CDT 3.1 RC2 with a managed C++ project and I
am trying to figure out how to easily switch between different toolchains.
The problem is I have mingw, cygwin, and a specialized linux powerpc
toolchain all installed on my windows machine. All of these toolchains
are gcc based and they use the same commands (gcc, g++, ar, etc) so I
don't really need a custom managed builder for each. The only real
difference is that each toolchain is located in a different directory.

I tried to force CDT to use the cygwin compiler by prepending
"c:\cygwin\bin;" to the "PATH" environment variable under the
properties->C/C++ Build->Environemnt tab. But that didn't work. CDT
still is using the mingw g++ since mingw is the only toolchain that adds
itslef to the windows system PATH. What is the recomended way to switch
compilers?

On the same subject, I noticed that whenever I create a new managed make
project, all of the mingw standard include paths are automatically added
to the include folder in the project tree. What If I wanted to use the
standard includes from cygwin or our linux powerpc toolchain instead?
What are these paths really used for anyway? I never explicitly add
standard header paths using the g++ -I option since the compiler typically
knows where its standard headers are located.

Doug
Re: (CDT 3.1 RC2 managed build) Switch between mingw and cygwin toolchains [message #170684 is a reply to message #170624] Fri, 02 June 2006 12:19 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: newsgroups.snipah.com

Hi Doug,

Switching between toolchains in one project is not possible I think.
You can create different projects and link the source folder in each
project.

But you can also use different configurations like the already existing
"Debug" and "Release". Simply create new one like "Cywin-Debug"
"Mingw-Debug" etc..

Then you can overwrite the PATH in the Environment of the configuration
in the project properties for the new created configurations.

In case this is not working you can also force the compiler executable
to the absolute path of the gcc in the Tool Setting "C:\cygwin\bin\gcc" ...
Make also sure you are also using the right make command! You can
overwrite it in the build-setting.

The automated generated include directory which is shown in the project
folder is generated using the default "gcc" command from the PATH and is
hard coded in the gnu cdt plugin.xml. You cannot change it I think.

I did not tried it with mingw but with a cross compiler gcc's and this
works fine for me. Maybe only the auto generated "Include" folder is
shown wrong but the cross compiler use the right one.

I hope that was helpful for you. ;)

ciao
Enrico
Re: (CDT 3.1 RC2 managed build) Switch between mingw and cygwin toolchains [message #170690 is a reply to message #170684] Fri, 02 June 2006 12:39 Go to previous messageGo to next message
Eclipse UserFriend
I think there is a bug with setting the PATH environemnt variable under
the environemnt tab in the build settings. If I change the compiler
command in the build settings to c:\cygwin\bin\g++ then the build
correctly uses the cygwin compiler. But if I prepend the path variable
with c:\cygwin\bin; and leave the compiler command as g++ then the build
still uses mingw. I have tried modifying the path under the configuration
specific and project tabs, but I get the same behavior in both cases.
Re: (CDT 3.1 RC2 managed build) Switch between mingw and cygwin toolchains [message #170702 is a reply to message #170690] Fri, 02 June 2006 13:14 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: newsgroups.snipah.com

Maybe try set the path unix like:
/cygdrive/C/cygwin/bin

or in quotes "C:\cygwin\bin"
All case sensitive of cause.

Make also sure you use the cygwin make command.

you can also try the following trick to show the used path.
go to the Properties/Build-Steps and write:
echo $(PATH)
to the Pre-Build-Step command.

rebuild you project and then the path which is used should be shown in
the console.

For me the environment builder works fine, also with cygwin.

ciao
Enrico
Re: (CDT 3.1 RC2 managed build) Switch between mingw and cygwin toolchains [message #170748 is a reply to message #170624] Sun, 04 June 2006 20:10 Go to previous messageGo to next message
Eclipse UserFriend
Hello Doug,

> I tried to force CDT to use the cygwin compiler by prepending
> "c:\cygwin\bin;" to the "PATH" environment variable under the
> properties->C/C++ Build->Environemnt tab.

How did you get CDT to use mingw as the default build system? I have big
problems getting Eclipse NOT to use cygwin. Even in 3.1.0RC2, CDT
automatically finds and prepends the path to cygwin to the system PATH, and
I have to manually override it in Project properties|C/C++ Build|Environment
to get rid of it for each and every configuration... basically the problems
described in
http://dev.eclipse.org/newslists/news.eclipse.tools.cdt/msg0 9133.html

> What are these paths really used for anyway? I never explicitly add
> standard header paths using the g++ -I option since the compiler typically
> knows where its standard headers are located.

I think they're for CDT's code completion & related functionality.

Kim
Re: (CDT 3.1 RC2 managed build) Switch between mingw and cygwin toolchains [message #170777 is a reply to message #170748] Mon, 05 June 2006 11:37 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mblok.interecho.com

When I need to use CDT with mingw instead of cygwin
I simply change cygwin directory name into something else
like for example cygwin_. CDT seems still to assume that cygwin is
in the previous path so mingw is used instead. When I need
cygwin I change directory name back.

This is rough solution, but it works for me well enough.

Marek Blok


U
Re: (CDT 3.1 RC2 managed build) Switch between mingw and cygwin toolchains [message #170816 is a reply to message #170777] Mon, 05 June 2006 22:10 Go to previous messageGo to next message
Eclipse UserFriend
> like for example cygwin_. CDT seems still to assume that cygwin is
> in the previous path so mingw is used instead.

Thanks, that works. Actually, CDT seems to pull the cygwin path from the
registry upon restart - HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus
Solutions\Cygwin\mounts v2 (at least it doesn't search all the drives for
it).

So, after searching through the documentation for cygwin (particulary
http://cygwin.com/faq/faq.setup.html#faq.setup.registry), I found that
you're able to remove or change the information in the registry using
cygwin's mount.

You can "trick" eclipse unto using different toolchains by manipulating the
cygwin mountpoints with a batch file:
c:\cygwin\bin\mount -f -s -b "C:\msys\1.0/bin" "/usr/bin"
c:\cygwin\bin\mount -f -s -b "C:\msys\1.0/lib" "/usr/lib"
c:\cygwin\bin\mount -f -s -b "C:\msys\1.0" "/"

There are some small problems with this approach, but nothing that isn't
possible to fix:
* using mingw without msys - mingw's make is called mingw32-make, so you
won't be able to transparently switch between projects (and if you do
provide a make.exe as a copy or link to mingw32-make.exe, you could get into
troubles when you want to use msys later on)
* using msys alone isn't enough, you have to provide the path to mingw as
well. Fortunately, CDT is "dumb" and prepends everything it finds in the
registry to the path so you can simply write
c:\cygwin\bin\mount -f -s -b "C:\msys\1.0\bin;c:\MinGW\bin" "/usr/bin"
* You need to restart Eclipse for the changes to take effect
* I have no idea what manipulating mountpoints does to services running
under cygwin, so if you're using cygwin heavily for real work (and not just
for the ocassional bash session), this might not be for you.

Hope someone will find this useful,
Kim
Re: (CDT 3.1 RC2 managed build) Switch between mingw and cygwin toolchains [message #170827 is a reply to message #170624] Tue, 06 June 2006 06:09 Go to previous message
Eclipse UserFriend
Originally posted by: balaraman.objectechnology.com

Hi Doug,

You have to go and edit "Environment Variables" under Windows. You delete
MinGW32 path and add cygwin path. Hope you cygwin variable paths!

Balaraman
Previous Topic:Show all characters
Next Topic:Data input to C program
Goto Forum:
  


Current Time: Thu May 29 02:05:18 EDT 2025

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

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

Back to the top