From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,35c6c40592f00b46 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1994-12-04 14:25:25 PST Newsgroups: comp.lang.ada Path: bga.com!news.sprintlink.net!pipex!uunet!intrepid!vladimir From: vladimir@Intrepid.COM (Vladimir Vukicevic) Subject: Re: Error compiling GNAT 2.00 on Linux Organization: Intrepid Technology, Inc. Date: Sun, 4 Dec 1994 22:06:37 GMT Message-ID: X-Newsreader: TIN [version 1.2 PL2] References: <3br0dh$rme@lastactionhero.rs.itd.umich.edu> Date: 1994-12-04T22:06:37+00:00 List-Id: 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 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 #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);