编译make 4.2.1

下载源码

https://mirrors.tuna.tsinghua.edu.cn/gnu/make/make-4.2.1.tar.gz

编译并安装

tar xzvf make-4.2.1.tar.gz
cd make-4.2.1
./configure --prefix=/home/wangyuan/soft/
/* 如果当前系统中没有安装make /
./build.sh
/
如果安装了make */
make
./make install

错误解决

错误日志:

点击查看错误日志
compiling glob/glob.c...
./glob/glob.c: In function ‘glob’:
./glob/glob.c:581:23: warning: implicit declaration of function ‘__alloca’; did you mean ‘alloca’? [-Wimplicit-function-declaration]
  581 |       newp = (char *) __alloca (dirlen + 1);
      |                       ^~~~~~~~
      |                       alloca
./glob/glob.c:581:14: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
  581 |       newp = (char *) __alloca (dirlen + 1);
      |              ^
./glob/glob.c:709:22: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
  709 |               newp = (char *) __alloca (home_len + dirlen);
      |                      ^
./glob/glob.c:732:22: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
  732 |               newp = (char *) __alloca (end_name - dirname);
      |                      ^
./glob/glob.c:783:22: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
  783 |               newp = (char *) __alloca (home_len + rest_len + 1);
      |                      ^
./glob/glob.c:814:18: warning: implicit declaration of function ‘__stat’; did you mean ‘lstat’? [-Wimplicit-function-declaration]
  814 |                : __stat (dirname, &st)) == 0
      |                  ^~~~~~
      |                  lstat
./glob/glob.c: In function ‘glob_in_dir’:
./glob/glob.c:1256:28: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
 1256 |           char *fullname = (char *) __alloca (dirlen + 1 + patlen + 1);
      |                            ^
./glob/glob.c:1283:19: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
 1283 |           names = (struct globlink *) __alloca (sizeof (struct globlink));
      |                   ^
./glob/glob.c:1341:46: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
 1341 |                       struct globlink *new = (struct globlink *)
      |                                              ^
./glob/glob.c:1367:15: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
 1367 |       names = (struct globlink *) __alloca (sizeof (struct globlink));
      |               ^
linking make...
/usr/bin/ld: glob.o: in function `glob_in_dir':
/home/wangyuan/make/make-4.2.1/./glob/glob.c:1367: undefined reference to `__alloca'
/usr/bin/ld: /home/wangyuan/make/make-4.2.1/./glob/glob.c:1342: undefined reference to `__alloca'
/usr/bin/ld: /home/wangyuan/make/make-4.2.1/./glob/glob.c:1283: undefined reference to `__alloca'
/usr/bin/ld: /home/wangyuan/make/make-4.2.1/./glob/glob.c:1256: undefined reference to `__alloca'
/usr/bin/ld: /home/wangyuan/make/make-4.2.1/./glob/glob.c:1269: undefined reference to `__stat'
/usr/bin/ld: glob.o: in function `glob':
/home/wangyuan/make/make-4.2.1/./glob/glob.c:581: undefined reference to `__alloca'
/usr/bin/ld: /home/wangyuan/make/make-4.2.1/./glob/glob.c:1036: undefined reference to `__stat'
/usr/bin/ld: /home/wangyuan/make/make-4.2.1/./glob/glob.c:732: undefined reference to `__alloca'
/usr/bin/ld: /home/wangyuan/make/make-4.2.1/./glob/glob.c:783: undefined reference to `__alloca'
/usr/bin/ld: /home/wangyuan/make/make-4.2.1/./glob/glob.c:814: undefined reference to `__stat'
/usr/bin/ld: /home/wangyuan/make/make-4.2.1/./glob/glob.c:960: undefined reference to `__stat'
/usr/bin/ld: /home/wangyuan/make/make-4.2.1/./glob/glob.c:709: undefined reference to `__alloca'
collect2: error: ld returned 1 exit status

解决方法:
修改glob.c文件:
将 # if _GNU_GLOB_INTERFACE_VERSION == GLOB_INTERFACE_VERSION 修改为 # if _GNU_GLOB_INTERFACE_VERSION >= GLOB_INTERFACE_VERSION

posted @ 2023-06-15 11:54  insistYuan  阅读(518)  评论(0编辑  收藏  举报