[comp.windows.x] alloca error building X11R4 on a Sparc 2

palmer@gateway.mitre.ORG (Forrest Palmer) (06/13/91)

Hi,

   I've just built X11R4 (pl. 18) on a Sparc 2 running 4.1.1. There
were no errors but when I start any X program I get the following
error :

ld.so: call to undefined procedure _alloca from 0xf772302c

A test program I wrote that used alloca worked fine.

   I unsetenv'd LD_LIBRARY_PATH, ran `ldconfig' in /usr/lib and made
certain that I didn't link against existing X libraries as it says in
FAQ #89, but no luck. Any ideas? The 4.1.1 was the preinstalled
version if that makes a difference.  

Thanks,
------------------------------------------------------
Forrest Palmer                        (703) 883-5668
Internet Engineering Testbed Administrator 
The MITRE Corp. - Washington Center
MS W425, McLean, VA 22102

palmer@mitre.org
------------------------------------------------------

djones@megatest.UUCP (Dave Jones) (06/16/91)

From article <9106131454.AA12581@gateway.mitre.org>, by palmer@gateway.mitre.ORG (Forrest Palmer):
> 
> Hi,
> 
>    I've just built X11R4 (pl. 18) on a Sparc 2 running 4.1.1. There
> were no errors but when I start any X program I get the following
> error :
> 
> ld.so: call to undefined procedure _alloca from 0xf772302c

On my SPARC machine, alloca is not named alloca. It's named "__builtin_alloca".
(YOU figure it out. I can't. The compiler has to give special treatment to
alloca calls made as parameters to functions, so maybe they changed the name
so that the compiler can "know" whether the alloca refered to is the system
alloca or a user-defined one. Who knows. The bottom line is that your code
is now broke.)

There's an include-file called "alloca.h" that has the following macro in it:

#if defined(sparc)
# define alloca(x) __builtin_alloca(x)
#endif

> A test program I wrote that used alloca worked fine.

Perhaps you included the file and they did not?

Put this at the head of every file that uses alloca, ahead of any extern
declaration of alloca.


#if defined(sparc)
#	include <alloca.h>
#endif