[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Failed compile on Fedora 28, x86_64

From: Martin Dorey
Subject: Re: Failed compile on Fedora 28, x86_64
Date: Fri, 24 Aug 2018 21:08:36 +0000

I *thought* we are supposed to avoid alloca in 2018.

Amen brother.

address@hidden:~/download/make-git/src$ sgrep -w alloca | wc -l


I'm building 4.2.1 from the tarball.

You'd have more luck from git, per:


I know I get tied up in autotools knots every time I have to git pull, so there's a patch there too.

From: Bug-make <bug-make-bounces+address@hidden> on behalf of Jeffrey Walton <address@hidden>
Sent: Friday, August 24, 2018 12:06 PM
To: address@hidden
Subject: Failed compile on Fedora 28, x86_64
I'm working on Fedora 28, x86_64 (fully patched). I'm building 4.2.1
from the tarball.

I *thought* we are supposed to avoid alloca in 2018. I guess this is
another reason why.


gcc -DLOCALEDIR=\"/usr/local/share/locale\"
-DLIBDIR=\"/usr/local/lib64\" -DINCLUDEDIR=\"/usr/local/include\"
-DHAVE_CONFIG_H -I.  -I./glob  -I/usr/local/include -DNDEBUG  -g2 -O2
-m64 -march=native -fPIC -MT remote-stub.o -MD -MP -MF
.deps/remote-stub.Tpo -c -o remote-stub.o remote-stub.c
mv -f .deps/hash.Tpo .deps/hash.Po
mv -f .deps/remote-stub.Tpo .deps/remote-stub.Po
mv -f .deps/variable.Tpo .deps/variable.Po
mv -f .deps/read.Tpo .deps/read.Po
gcc  -g2 -O2 -m64 -march=native -fPIC -Wl,--export-dynamic
-L/usr/local/lib64 -m64 -Wl,-R,/usr/local/lib64 -Wl,--enable-new-dtags
-o make ar.o arscan.o commands.o default.o dir.o expand.o file.o
function.o getopt.o getopt1.o guile.o implicit.o job.o load.o
loadapi.o main.o misc.o posixos.o output.o read.o remake.o rule.o
signame.o strcache.o variable.o version.o vpath.o hash.o remote-stub.o
glob/libglob.a   -ldl -lpthread
glob/libglob.a(glob.o): In function `glob_in_dir':
/home/test/make-4.2.1/glob/glob.c:1367: undefined reference to `__alloca'
/home/test/make-4.2.1/glob/glob.c:1342: undefined reference to `__alloca'
/home/test/make-4.2.1/glob/glob.c:1256: undefined reference to `__alloca'
/home/test/make-4.2.1/glob/glob.c:1283: undefined reference to `__alloca'
glob/libglob.a(glob.o): In function `glob':
/home/test/make-4.2.1/glob/glob.c:581: undefined reference to `__alloca'
glob/libglob.a(glob.o):/home/test/make-4.2.1/glob/glob.c:732: more
undefined references to `__alloca' follow
collect2: error: ld returned 1 exit status
gmake[2]: *** [Makefile:656: make] Error 1
gmake[2]: Leaving directory '/home/test/make-4.2.1'
gmake[1]: *** [Makefile:798: all-recursive] Error 1
gmake[1]: Leaving directory '/home/test/make-4.2.1'
gmake: *** [Makefile:534: all] Error 2
Failed to build Make


Here's from the Fedora man pages. It should provide the header and
library information if a Fedora box is not handy.

ALLOCA(3)                  Linux Programmer's Manual                 ALLOCA(3)

       alloca - allocate memory that is automatically freed

       #include <alloca.h>

       void *alloca(size_t size);

       The  alloca() function allocates size bytes of space in the stack frame
       of the caller.  This temporary space is automatically  freed  when  the
       function that called alloca() returns to its caller.

       The  alloca()  function returns a pointer to the beginning of the allo‐
       cated space.  If the allocation causes stack overflow, program behavior
       is undefined.

       For   an   explanation   of   the  terms  used  in  this  section,  see

       │Interface │ Attribute     │ Value   │
       │alloca()  │ Thread safety │ MT-Safe │
       This function is not in POSIX.1.

       There is evidence that the alloca()  function  appeared  in  32V,  PWB,
       PWB.2,  3BSD,  and  4BSD.  There is a man page for it in 4.3BSD.  Linux
       uses the GNU version.

       The alloca() function is machine- and compiler-dependent.  For  certain
       applications,  its  use  can  improve efficiency compared to the use of
       malloc(3) plus free(3).  In certain cases, it can also simplify  memory
       deallocation  in  applications  that  use  longjmp(3) or siglongjmp(3).
       Otherwise, its use is discouraged.

       Because the space allocated by alloca() is allocated within  the  stack
       frame,  that  space  is  automatically  freed if the function return is
       jumped over by a call to longjmp(3) or siglongjmp(3).

       Do not attempt to free(3) space allocated by alloca()!

   Notes on the GNU version
       Normally, gcc(1) translates calls to alloca() with inlined code.   This
       is  not done when either the -ansi, -std=c89, -std=c99, or the -std=c11
       option is given and the header <alloca.h> is not included.   Otherwise,
       (without  an  -ansi  or -std=c* option) the glibc version of <stdlib.h>
       includes <alloca.h> and that contains the lines:

           #ifdef  __GNUC__
           #define alloca(size)   __builtin_alloca (size)

       with messy consequences if one has a private version of this function.

       The fact that the code is inlined means that it is impossible  to  take
       the address of this function, or to change its behavior by linking with
       a different library.

       The inlined code often consists of a single instruction  adjusting  the
       stack  pointer,  and does not check for stack overflow.  Thus, there is
       no NULL error return.

       There is no error indication if the stack  frame  cannot  be  extended.
       (However, after a failed allocation, the program is likely to receive a
       SIGSEGV signal if it attempts to access the unallocated space.)

       On many systems alloca() cannot be used inside the list of arguments of
       a  function  call,  because  the stack space reserved by alloca() would
       appear on the stack in the middle of the space for the  function  argu‐

       brk(2), longjmp(3), malloc(3)

       This  page  is  part of release 4.15 of the Linux man-pages project.  A
       description of the project, information about reporting bugs,  and  the
       latest     version     of     this    page,    can    be    found    at

GNU                               2017-09-15                         ALLOCA(3)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]