comp.lang.ada
 help / color / mirror / Atom feed
* Re: Using Windows GNAT with Cygwin
       [not found] <2m53gtkmvaou7ktac1jfmfmb32iuiernkm@4ax.com>
@ 2001-05-15 21:03 ` Stephen Leake
  2001-05-15 21:24   ` Marin David Condic
       [not found]   ` <hgq3gt8mch5qsmieckv2hkolo3ohbmf64e@4ax.com>
  0 siblings, 2 replies; 4+ messages in thread
From: Stephen Leake @ 2001-05-15 21:03 UTC (permalink / raw)


Thore B. Karlsen <eightbit@cs.utexas.edu> writes:

> I've been looking around for FAQs on this, but to no avail.
> 
> I have Cygwin installed, but I installed the Windows port of GNAT
> because I want to create standalone executables that don't need the
> Cygwin library. The problem is, of course, that GNAT and Cygwin have
> their own sets of compilers. So how would I go about getting gnatmake to
> use its own gcc and other tools, and not Cygwin's tools?

Set PATH appropriately. There is also one registry setting that Cygwin
and GNAT fight over; 

HKEY_LOCAL_MACHINE\SOFTWARE\Free Software Foundation

The simplest way to manage this is to use the Registry Editor to
export this key (to a .reg file) after installing Cygwin, and again
after installing GNAT. Then run the appropriate .reg file when you
need to run the compiler.

This use of the registry is totally inappropriate, as far as I can
tell. It just gets in the way.

You can set PATH and run the .reg file from a batch script; that
simplifies things a bit.

-- 
-- Stephe



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Using Windows GNAT with Cygwin
  2001-05-15 21:03 ` Using Windows GNAT with Cygwin Stephen Leake
@ 2001-05-15 21:24   ` Marin David Condic
       [not found]   ` <hgq3gt8mch5qsmieckv2hkolo3ohbmf64e@4ax.com>
  1 sibling, 0 replies; 4+ messages in thread
From: Marin David Condic @ 2001-05-15 21:24 UTC (permalink / raw)


Having just gone through this, here's another little bit of help: The
following C program was written by Sune Falck to change the registry entries
& can readily be run in an initialization .BAT file. I tweaked the program
ever so slightly from its original design so it may not bit-for-bit match
with the original if you got it from another source.

MDC

/*
 * File:     select_gcc.c
 *
 * Author:   Sune Falck
 *
 * Purpose:  To allow egcs and gnat to coexist by changing the value
 *           GCC under the key LOCAL_MACHINE\Software\Free Software
Foundation
 *           to the installation directory for gnat or egcs.
 *           The installation directories must be manually set up with
 *           REGEDIT in the values GCC_GNAT and GCC_EGCS under the same key.
 *
 * Syntax:   select_gcc gnat|egcs
 *
 * Date:     1999-01-26
 *
 * Changes:  1999-01-27 Sune Falck
 *           Changed protection in RegOpenKeyEx because of ACCESS DENIED
 *           error when running under Windows NT
 *
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define WIN32_LEAN_AND_MEAN
#include <windows.h>

void Test_For_Error (int Error, char *Error_Text);

int main (int argc, char **argv)
{
   LONG rc;                                     /* Return code */
   HKEY Key;                                    /* Key handle  */
   char *Prefix = "GCC_";
   char Name [256];                             /* Constructed key name */
   char Value [256];

   DWORD Value_Type;
   DWORD Value_Length;

   fprintf (stderr, "\n\n argv[0] %s argv[1] %s\n\n", argv[0], argv[1]);

   Test_For_Error (argc != 2, "-I-No parameter given.");

   /* Create a value name from GCC_ and the command parameter */
   strcpy (Name, Prefix);
   strcat (Name, argv [1]);
   Value_Length = sizeof (Value);

   rc = RegOpenKeyEx (HKEY_LOCAL_MACHINE, "Software\\Free Software
Foundation",
                      0, KEY_READ|KEY_SET_VALUE, &Key);
   Test_For_Error (rc != ERROR_SUCCESS, "-E-Can't open registry key "
                   "\"HKLM\\Software\\Free Software Foundation\".");

   rc = RegQueryValueEx (Key, Name, 0, &Value_Type, Value, &Value_Length);
   Test_For_Error (rc != ERROR_SUCCESS,
                   "-E-No saved value GCC_XXXX for given configuration.");

   rc = RegSetValueEx (Key, "GCC", 0, Value_Type, Value, Value_Length);
   Test_For_Error (rc != ERROR_SUCCESS,
                   "-E-New value for GCC could not be stored.");
   RegCloseKey (Key);
   return EXIT_SUCCESS;
}

void Test_For_Error (int Error, char *Error_Text)
{
   if (Error) {
      fprintf (stderr, "select_gcc%s\n\n", Error_Text);
      fprintf
         (stderr,
          "Switch between gnat and egcs by modifying registry\n\n"
          "Manually set up the values GCC_GNAT and GCC_EGCS to the\n"
          "installation directories for gnat and egcs with REGEDIT\n"
          "for the key LOCAL_MACHINE\\Software\\Free Software Foundation.\n"
          "Use select_gcc with gnat or egcs as parameter to switch\n"
          "between the compilers - the path must also be adjusted.\n");
      exit (EXIT_FAILURE);
   }
}


--
Marin David Condic
Senior Software Engineer
Pace Micro Technology Americas    www.pacemicro.com
Enabling the digital revolution
e-Mail:    marin.condic@pacemicro.com
Web:      http://www.mcondic.com/


"Stephen Leake" <stephen.a.leake.1@gsfc.nasa.gov> wrote in message
news:u3da6nx40.fsf@gsfc.nasa.gov...
> Set PATH appropriately. There is also one registry setting that Cygwin
> and GNAT fight over;
>
> HKEY_LOCAL_MACHINE\SOFTWARE\Free Software Foundation
>
> The simplest way to manage this is to use the Registry Editor to
> export this key (to a .reg file) after installing Cygwin, and again
> after installing GNAT. Then run the appropriate .reg file when you
> need to run the compiler.
>
> This use of the registry is totally inappropriate, as far as I can
> tell. It just gets in the way.
>
> You can set PATH and run the .reg file from a batch script; that
> simplifies things a bit.
>
> --
> -- Stephe





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Using Windows GNAT with Cygwin
       [not found]   ` <hgq3gt8mch5qsmieckv2hkolo3ohbmf64e@4ax.com>
@ 2001-05-16 19:41     ` Stephen Leake
  2001-05-16 19:51       ` Ed Falis
  0 siblings, 1 reply; 4+ messages in thread
From: Stephen Leake @ 2001-05-16 19:41 UTC (permalink / raw)


Thore B. Karlsen <eightbit@cs.utexas.edu> writes:

> On 15 May 2001 17:03:27 -0400, Stephen Leake
> <stephen.a.leake.1@gsfc.nasa.gov> wrote:
> 
> >> I've been looking around for FAQs on this, but to no avail.
> >> 
> >> I have Cygwin installed, but I installed the Windows port of GNAT
> >> because I want to create standalone executables that don't need the
> >> Cygwin library. The problem is, of course, that GNAT and Cygwin have
> >> their own sets of compilers. So how would I go about getting gnatmake to
> >> use its own gcc and other tools, and not Cygwin's tools?
> 
> >Set PATH appropriately. There is also one registry setting that Cygwin
> >and GNAT fight over; 
> >
> >HKEY_LOCAL_MACHINE\SOFTWARE\Free Software Foundation
> >
> >The simplest way to manage this is to use the Registry Editor to
> >export this key (to a .reg file) after installing Cygwin, and again
> >after installing GNAT. Then run the appropriate .reg file when you
> >need to run the compiler.
> 
> Thanks. I added the GNAT bin dir to the Windows path, but I guess I need
> to add it to the Cygwin path as well, before /bin. I was just hoping
> there would be a more elegant solution.

What would be more elegant?

> >This use of the registry is totally inappropriate, as far as I can
> >tell. It just gets in the way.
> 
> Most use of the registry is totally inappropriate, in my opinion. I
> never use it myself, and I wish the whole registry concept a quick
> death.

Well, I would not go that far. It is useful for install, update
install, and uninstall information. It is also useful for global id
stuff for DCom.

I just think things that might need to be different in different
processes should not be in the registry, or should at least be
overridden by environment variables.

Certainly two incompatible products should not use the same registry
entry, which is what is happening here!

-- 
-- Stephe



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Using Windows GNAT with Cygwin
  2001-05-16 19:41     ` Stephen Leake
@ 2001-05-16 19:51       ` Ed Falis
  0 siblings, 0 replies; 4+ messages in thread
From: Ed Falis @ 2001-05-16 19:51 UTC (permalink / raw)


Stephen Leake wrote:

>
> Certainly two incompatible products should not use the same registry
> entry, which is what is happening here!
>

We're changing the entry we use.

- Ed
ACT



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2001-05-16 19:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <2m53gtkmvaou7ktac1jfmfmb32iuiernkm@4ax.com>
2001-05-15 21:03 ` Using Windows GNAT with Cygwin Stephen Leake
2001-05-15 21:24   ` Marin David Condic
     [not found]   ` <hgq3gt8mch5qsmieckv2hkolo3ohbmf64e@4ax.com>
2001-05-16 19:41     ` Stephen Leake
2001-05-16 19:51       ` Ed Falis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox