s390架构下编译Nano 2.9.7遇Make错误,求低版本工具适配方案
Alright, let's work through these build issues step by step—since we can't upgrade your toolchain, we'll tweak nano's build files to play nice with autoconf 2.62 and automake 1.10.
First: Fix the Automake Version Declaration (Instead of Editing configure Directly)
You manually changed am__api_version in the configure script, but that's a temporary fix—make will overwrite this when it regenerates the script. Instead, edit the source file that controls this:
- Open
Makefile.am - Find the line starting with
AM_INIT_AUTOMAKE—it probably looks like this:AM_INIT_AUTOMAKE([1.15 foreign no-dist-gzip dist-bzip2]) - Change the version number from
1.15to1.10:AM_INIT_AUTOMAKE([1.10 foreign no-dist-gzip dist-bzip2])
Second: Confirm the Autoconf Version Requirement
You already started this, but let's lock it in:
- Open
configure.ac - Ensure line 27 matches your autoconf version:
AC_PREREQ([2.62])
Third: Fix the AC_CONFIG_HEADERS Autoheader Error
The new error happens because your old autoheader expects an explicit declaration for the config header file. Add this to configure.ac:
- Find the line right after
AC_INIT([nano], [2.9.7], [nano-devel@gnu.org]) - Add this line:
If this line already exists, try removing the square brackets to match older autoconf syntax:AC_CONFIG_HEADERS([config.h])AC_CONFIG_HEADERS(config.h)
Fourth: Suppress the Perl Prototype Warning
The main::scan_file() called too early warning is a compatibility issue between automake 1.10 and newer Perl versions. It doesn't break the build, but we can hide it:
Run this in your shell before generating build files:
export PERL5OPT="-Wno-deprecated"
Fifth: Regenerate Build Files Manually
Instead of letting make auto-run these commands (which can cause inconsistencies), run them yourself:
# Generate aclocal.m4 with your automake version aclocal-1.10 -I m4 # Regenerate the configure script autoconf # Generate config.h.in for autoheader autoheader # Generate Makefile.in and other required files automake-1.10 --add-missing
Sixth: Clean and Compile
Now let's start fresh and build nano:
# Wipe all previous build artifacts make distclean # Configure nano (add --prefix=/your/path if you want a custom install location) ./configure # Build the binary make # Install (optional, use sudo if needed) make install
Notes
- If you hit other dependency errors (like missing ncurses), you'll need to ensure the development libraries for ncurses are installed on your s390 system.
- The Perl warning might still appear even with the
PERL5OPTfix, but it's harmless—you can ignore it as long as the build completes.
内容的提问来源于stack exchange,提问作者RenegadeAndy

