編譯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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章