GNU Make 3.82 升级到 4.4.1

发布于:2025-06-15 ⋅ 阅读:(23) ⋅ 点赞:(0)

昨天,手动升级linux的kernel到 6.15.2时候,遇到了问题(如下)

[root@c7 linux-6.15.2]# make 
Makefile:15: *** GNU Make >= 4.0 is required. Your Make version is 3.82。 停止。

根据提示信息,make至少需要升级4.0版本,才可以。

升级步骤如下:

1 下载make离线包(Index of /gnu/make

根据需要,下载对应的版本即可。

2 上传至指定服务器

[root@c7 ~]# ls
anaconda-ks.cfg  etc  Init.sh  linux-6.15.2.tar.xz  make-4.4.1.tar.gz  rpms

# 这里,我上传至/root目录下

3 解压

[root@c7 ~]# tar xfz make-4.4.1.tar.gz 
[root@c7 ~]# ls
anaconda-ks.cfg  etc  Init.sh  linux-6.15.2.tar.xz  make-4.4.1  make-4.4.1.tar.gz  rpms

4 编译、安装

root@c7 ~]# cd make-4.4.1        # 进入到4.4.1目录
[root@c7 make-4.4.1]# ls        #查看大致有哪些文件
ABOUT-NLS   build-aux     build_w32.bat  COPYING  m4            mk      README.Amiga    README.VMS  src
aclocal.m4  build.cfg.in  ChangeLog      doc      Makefile.am   NEWS    README.customs  README.W32  tests
AUTHORS     builddos.bat  configure      INSTALL  makefile.com  po      README.DOS      README.zOS  vms_export_symbol_test.com
Basic.mk    build.sh      configure.ac   lib      Makefile.in   README  README.OS2      SCOPTIONS

[root@c7 make-4.4.1]# ./configure --prefix=/usr/local/make        # 指定相关的安装配置
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a race-free mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports the include directive... yes (GNU style)
checking for gcc... gcc
checking whether the C compiler works... yes

...

[root@c7 make-4.4.1]# make -j2 && make install        #编译、安装
Making all in lib
make[1]: 进入目录“/root/make-4.4.1/lib”
sed -e 1h -e '1s,.*,/* DO NOT EDIT! GENERATED AUTOMATICALLY! */,' -e 1G \
  -e 's|@''HAVE_ALLOCA_H''@|1|g' \
  ./alloca.in.h > alloca.h-t
rm -f fnmatch.h-t fnmatch.h && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \

...

 /usr/bin/install -c -m 644 doc/make.1 '/usr/local/make/share/man/man1'
make[2]: 离开目录“/root/make-4.4.1”
make[1]: 离开目录“/root/make-4.4.1”
[root@c7 make-4.4.1]# 


[root@c7 make-4.4.1]# make -v        # 安装完成,但是版本还是 3.82;
GNU Make 3.82
Built for x86_64-redhat-linux-gnu
Copyright (C) 2010  Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

如何解决呢?继续往下看

5 重命名原来的make

[root@c7 make-4.4.1]# cd /usr/bin/

[root@c7 bin]# mv make make.bak

6 建立新的软连接

[root@c7 bin]# ln -sv /usr/local/make/bin/make /usr/bin/make
"/usr/bin/make" -> "/usr/local/make/bin/make"

7 检查make版本

[root@c7 bin]# make -v
GNU Make 4.4.1
为 x86_64-pc-linux-gnu 编译
Copyright (C) 1988-2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

ok 问题解决,撤! 希望能够帮助到大家!


网站公告

今日签到

点亮在社区的每一天
去签到