comp.lang.ada
 help / color / mirror / Atom feed
* Error compiling GNAT 2.00 on Linux
@ 1994-12-03 23:53 Daniel Reish
  1994-12-04 21:51 ` Rolf Ebert
  1994-12-04 22:06 ` Vladimir Vukicevic
  0 siblings, 2 replies; 3+ messages in thread
From: Daniel Reish @ 1994-12-03 23:53 UTC (permalink / raw)


While attempting to compile GNAT 2.00 on my Linux machine, I ran into
the following error:

a-misc.o(.text+0x296): undefined reference to `setjmp'

This was after entering the ada/ subdirectory in the main gcc-2.6.2
directory.  The line it stops at is the one in which it links those 30
or 40 object files together into ./gnat1.  Does anyone know what might
be going wrong?  I new to Ada, so I don't really know where to start
looking, myself.  Since I would imagine this is of fairly general
interest, since there isn't a precompiled GNAT 2.00 for Linux yet,
please respond by followup.  Thanks.

________________________________________________________________________
Daniel Reish  <dreish@umich.edu>
R&D Programmer                     Hours: Usually on weekdays, sometimes
Packard Business Systems, Inc.            on weekends, mostly during the
320 S. Main St.                           day.  (No guarantees.)
Ann Arbor, MI  48104            



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

* Re: Error compiling GNAT 2.00 on Linux
  1994-12-03 23:53 Error compiling GNAT 2.00 on Linux Daniel Reish
@ 1994-12-04 21:51 ` Rolf Ebert
  1994-12-04 22:06 ` Vladimir Vukicevic
  1 sibling, 0 replies; 3+ messages in thread
From: Rolf Ebert @ 1994-12-04 21:51 UTC (permalink / raw)


>>>>> "DR" == Daniel Reish <dreish@umich.edu> writes:

DR> While attempting to compile GNAT 2.00 on my Linux machine, I ran
DR> into the following error:

You must apply the patches first, that you should have got with your
last binary distribution. Find the ones for gnat-2.00 at the end of this
post. 

DR> a-misc.o(.text+0x296): undefined reference to `setjmp'

This is the very old and known problem of inconsisties between the
different libc implementations on Linux and SunOS.

DR> This was after entering the ada/ subdirectory in the main
DR> gcc-2.6.2 directory.  The line it stops at is the one in which
DR> it links those 30 or 40 object files together into ./gnat1.
DR> Does anyone know what might be going wrong?  I new to Ada, so I
DR> don't really know where to start looking, myself.  Since I would
DR> imagine this is of fairly general interest, since there isn't a
DR> precompiled GNAT 2.00 for Linux yet, please respond by followup.
DR> Thanks.

I have a running gnat-2.00 on my Linux box. With a UUCP only access to
the internet I cannot upload it directly from my home machine.  Tomorrow
(Monday) morning I'll take 2 floppies to a friends machine, from where
I'll put it on sunsite and tsx-11.  After that I'll send out an
announcement in comp.os.linux.announce.


DR> ________________________________________________________________________
DR> Daniel Reish <dreish@umich.edu> R&D Programmer Hours: Usually on
DR> weekdays, sometimes Packard Business Systems, Inc.  on weekends,
DR> mostly during the 320 S. Main St.  day.  (No guarantees.)  Ann
DR> Arbor, MI 48104

	Rolf

Rolf Ebert			Beratung fuer Energiesysteme und Informatik
Erich Kaestner Str. 17               Conseil en Energetique et Informatique
D - 80797 Muenchen        (Team Ada)               Tel.: +49-89-30.77.88.00
Germany                                            Fax.: +49-89-30.77.91.00

*** a-misc.c.orig	Wed Nov 30 19:38:51 1994
--- a-misc.c	Fri Dec  2 18:43:53 1994
***************
*** 25,30 ****
--- 25,31 ----
  #include "config.h"
  #include <stdio.h>
  #include <string.h>
+ #include <setjmp.h>
  #include "tree.h"
  #include "rtl.h"
  #include "expr.h"
*** a-trans3.c~	Fri Dec  2 18:43:56 1994
--- a-trans3.c	Fri Dec  2 18:45:22 1994
***************
*** 593,599 ****
--- 593,603 ----
  #ifdef WINNT
        ("_setjmp", NULL_PTR,
  #else
+ #ifdef __linux__
+       ("__setjmp", NULL_PTR,
+ #else
        ("setjmp", NULL_PTR,
+ #endif
  #endif
         build_function_type (integer_type_node,
  			    tree_cons (NULL_TREE,  jmpbuf_ptr_type, endlink)),
*** gnat1drv.adb~	Fri Dec  2 18:43:54 1994
--- gnat1drv.adb	Fri Dec  2 18:46:00 1994
***************
*** 79,85 ****
           Write_Eol;
           Write_Str ("NYU GNAT Compiler Version ");
           Write_Str (Gnat_Version_String);
!          Write_Str (" (C) Copyright NYU, 1992,1993,1994");
           Write_Eol;
        end if;
  
--- 79,85 ----
           Write_Eol;
           Write_Str ("NYU GNAT Compiler Version ");
           Write_Str (Gnat_Version_String);
!          Write_Str (" Linux pl. 1 (C) Copyright NYU, 1992,1993,1994");
           Write_Eol;
        end if;
  
--
Rolf Ebert			Beratung fuer Energiesysteme und Informatik
Erich Kaestner Str. 17               Conseil en Energetique et Informatique
D - 80797 Muenchen        (Team Ada)               Tel.: +49-89-30.77.88.00
Germany                                            Fax.: +49-89-30.77.91.00
-- 
Rolf Ebert			Beratung fuer Energiesysteme und Informatik
Erich Kaestner Str. 17               Conseil en Energetique et Informatique
D - 80797 Muenchen        (Team Ada)               Tel.: +49-89-30.77.88.00
Germany                                            Fax.: +49-89-30.77.91.00



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

* Re: Error compiling GNAT 2.00 on Linux
  1994-12-03 23:53 Error compiling GNAT 2.00 on Linux Daniel Reish
  1994-12-04 21:51 ` Rolf Ebert
@ 1994-12-04 22:06 ` Vladimir Vukicevic
  1 sibling, 0 replies; 3+ messages in thread
From: Vladimir Vukicevic @ 1994-12-04 22:06 UTC (permalink / raw)


Daniel Reish (dreish@umich.edu) wrote:
> While attempting to compile GNAT 2.00 on my Linux machine, I ran into
> the following error:
>
> a-misc.o(.text+0x296): undefined reference to `setjmp'
>
> This was after entering the ada/ subdirectory in the main gcc-2.6.2
> directory.  The line it stops at is the one in which it links those 30
> or 40 object files together into ./gnat1.  Does anyone know what might
> be going wrong?  I new to Ada, so I don't really know where to start
> looking, myself.  Since I would imagine this is of fairly general
> interest, since there isn't a precompiled GNAT 2.00 for Linux yet,
> please respond by followup.  Thanks.

(I apologize if anyone receives this twice, my news server has been flaky
lately.)

I just compiled gnat 2.0 (gcc 2.6.2) yesterday on my Linux box. Because
of Linux's libc's (brain-dead?) handling of setjmp, sigsetjmp, longjmp,
and siglongjmp, some patches to the gnat source are required. (The reason
is that all these are macros, some as simple as #define setjmp(x) __setjmp(x),
others not so simple.)

Note that sigsetjmp doesn't work in the Ada RTL under Linux, since sigsetjmp
is #define'd as { __sigjmp_save(env, savemask); __setjmp(env[0].__jmpbuf); },
and I'm too lazy to write the equivelent Ada code. It shouldn't be too hard,
tho, if you really need sigsetjmp.

Other than this, gnat 2.0/gcc 2.6.2 compiled cleanly for me using
gnat 1.83/gcc 2.6.0. Also, I think I ran into some problems with installation,
where the 'auxiliary' gnat programs, i.e. gnatbl, gnatbuild, gnatch[o]p, gnatf,
etc. weren't installed correctly. Make sure that these got installed before
you do a make [dist]clean.

	- Vladimir

The following patches should be applied in the directory under gcc-2.6.2,
after the 'ada' dir from gnat-2.0-src/src/ has been moved into gcc-2.6.2/.

diff -u gnat-2.00-src/src/ada/a-misc.c gcc-2.6.2/ada/a-misc.c
--- gnat-2.00-src/src/ada/a-misc.c	Wed Nov 30 10:38:51 1994
+++ gcc-2.6.2/ada/a-misc.c	Sat Dec  3 23:38:05 1994
@@ -44,6 +44,7 @@
 #include "a-misc.h"
 #include "a-rtree.h"
 #include "flags.h"
+#include <setjmp.h>
 
 extern char *xmalloc ();
 extern char *main_input_filename;
diff -u gnat-2.00-src/src/ada/a-trans3.c gcc-2.6.2/ada/a-trans3.c
--- gnat-2.00-src/src/ada/a-trans3.c	Wed Nov 30 10:38:53 1994
+++ gcc-2.6.2/ada/a-trans3.c	Sat Dec  3 23:37:42 1994
@@ -42,6 +42,7 @@
 #include "a-misc.h"
 #include "a-rtree.h"
 #include "convert.h"
+#include <setjmp.h>
 
 #undef  NULL
 #define NULL 0
@@ -590,10 +591,14 @@
      a jmpbuf.  */
   setjmp_decl
     = create_subprog_decl
+#ifdef linux
+      ("__setjmp", NULL_PTR,
+#else
 #ifdef WINNT
       ("_setjmp", NULL_PTR,
 #else
       ("setjmp", NULL_PTR,
+#endif
 #endif
        build_function_type (integer_type_node,
 			    tree_cons (NULL_TREE,  jmpbuf_ptr_type, endlink)),
diff -u gnat-2.00-src/src/ada/i-cporte.adb gcc-2.6.2/ada/i-cporte.adb
--- gnat-2.00-src/src/ada/i-cporte.adb	Wed Nov 30 10:40:20 1994
+++ gcc-2.6.2/ada/i-cporte.adb	Sat Dec  3 23:40:53 1994
@@ -239,7 +239,7 @@
 
    procedure longjmp (env : jmp_buf; val : int) is
       procedure longjmp_base (env : jmp_buf_ptr; val : int);
-      pragma Import (C, longjmp_base, "longjmp");
+      pragma Import (C, longjmp_base, "__longjmp");
 
    begin
       longjmp_base (Address_to_Pointer (env'Address), val);
@@ -267,7 +267,7 @@
 
    procedure setjmp (env : jmp_buf; Result : out Return_Code) is
       function setjmp_base (env : jmp_buf_ptr) return Return_Code;
-      pragma Import (C, setjmp_base, "setjmp");
+      pragma Import (C, setjmp_base, "__setjmp");
 
    begin
       Result := setjmp_base (Address_to_Pointer (env'Address));
@@ -289,6 +289,8 @@
          savemask : int)
          return     Return_Code;
       pragma Import (C, sigsetjmp_base, "sigsetjmp");
+   --  Linux note: sigsetjmp isn't really sigsetjmp. If this is called,
+   --  an undefined symbol error will occur when linking.
 
    begin
       Result := sigsetjmp_base (Address_to_Pointer (env'Address), savemask);





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

end of thread, other threads:[~1994-12-04 22:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1994-12-03 23:53 Error compiling GNAT 2.00 on Linux Daniel Reish
1994-12-04 21:51 ` Rolf Ebert
1994-12-04 22:06 ` Vladimir Vukicevic

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