在 Ubuntu 18.04 中安装旧版本的 gnu-make

问题描述 投票:0回答:3

我想在 Ubuntu 18.04 上安装 make 3.81。

所以我下载了这个版本的 make 并运行 ./configure,然后运行 make。但是编译时它给了我这个错误:

./glob/glob.c: In function ‘glob’:
./glob/glob.c:581:23: warning: implicit declaration of function ‘__alloca’; did you mean ‘alloca’? [-Wimplicit-function-declaration]
       newp = (char *) __alloca (dirlen + 1);
                       ^~~~~~~~
                       alloca
./glob/glob.c:581:14: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
       newp = (char *) __alloca (dirlen + 1);
              ^
./glob/glob.c:709:15: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
        newp = (char *) __alloca (home_len + dirlen);
               ^
./glob/glob.c:732:15: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
        newp = (char *) __alloca (end_name - dirname);
               ^
./glob/glob.c:783:15: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
        newp = (char *) __alloca (home_len + rest_len + 1);
               ^
./glob/glob.c:814:11: warning: implicit declaration of function ‘__stat’; did you mean ‘__xstat’? [-Wimplicit-function-declaration]
         : __stat (dirname, &st)) == 0
           ^~~~~~
           __xstat
./glob/glob.c: In function ‘glob_in_dir’:
./glob/glob.c:1256:21: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
    char *fullname = (char *) __alloca (dirlen + 1 + patlen + 1);
                     ^
./glob/glob.c:1283:12: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
    names = (struct globlink *) __alloca (sizeof (struct globlink));
            ^
./glob/glob.c:1341:32: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
         struct globlink *new = (struct globlink *)
                                ^
./glob/glob.c:1367:15: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
       names = (struct globlink *) __alloca (sizeof (struct globlink));

构建版本 3.82 时的情况相同。我当前的 make 版本是 4.1.

有人知道可能出了什么问题吗?

谢谢

编辑:

glob/libglob.a(glob.o): 在函数 `glob_in_dir' 中:
/opt/make-3.81/glob/glob.c:1361:对“__alloca”的未定义引用
/opt/make-3.81/glob/glob.c:1336:对“__alloca”的未定义引用
/opt/make-3.81/glob/glob.c:1277:对“__alloca”的未定义引用
/opt/make-3.81/glob/glob.c:1250:对“__alloca”的未定义引用
glob/libglob.a(glob.o): 在函数 `glob' 中:
/opt/make-3.81/glob/glob.c:575:对“__alloca”的未定义引用
glob/libglob.a(glob.o):/opt/make-3.81/glob/glob.c:726:更多对“__alloca”的未定义引用如下
collect2:错误:ld 返回 1 退出状态
Makefile:410: 目标“make”的配方失败
make[2]: *** [make] 错误 1
make[2]:离开目录“/opt/make-3.81”
Makefile:603: 目标“全递归”的配方失败
make[1]: *** [全递归] 错误 1
make[1]:离开目录“/opt/make-3.81”
Makefile:326: 目标“全部”的配方失败
make: *** [全部] 错误 2
linux ubuntu gnu-make
3个回答
19
投票

您可以尝试修改

glob.c
文件:

# if _GNU_GLOB_INTERFACE_VERSION == GLOB_INTERFACE_VERSION 

# if _GNU_GLOB_INTERFACE_VERSION >= GLOB_INTERFACE_VERSION

对我来说这是工作,我可以构建 make 3.82

(来源:http://gnu-make.2324884.n4.nabble.com/undefined-reference-to-alloca-td18308.html


1
投票

使用Lubuntu 20.04.4 64位

对我来说,一个可行的解决方案是: 更换,

#if !defined __alloca && !defined __GNU_LIBRARY__

#if !defined __alloca && defined __GNU_LIBRARY__

作者:underhood31

并改变

#ifndef __GNU_LIBRARY__

在:

#ifdef __GNU_LIBRARY__

在没有(严重!)警告的情况下构建。


0
投票

在make-3.82目录下运行此命令。
来自用户的内容:A2N 又名 ace2nutzer。

sed -i 's/#if !defined __alloca \&\& !defined __GNU_LIBRARY__/#if !defined __alloca \&\& defined __GNU_LIBRARY__/g; s/#ifndef __GNU_LIBRARY__/#ifdef __GNU_LIBRARY__/g' "./glob/glob.c"`
© www.soinside.com 2019 - 2024. All rights reserved.