Ticket #4266 (closed defect: fixed)

Opened 3 years ago

Last modified 3 years ago

MacOS fail - AC_INIT should be called with package and version

Reported by: edrozenberg Owned by: andrew_b
Priority: minor Milestone: 4.8.27
Component: mc-core Version: master
Keywords: Cc: and
Blocked By: Blocking:
Branch state: merged Votes for changeset: committed-master

Description

Since "recently" (weeks) mc no longer builds from source on MacOS when I use the homebrew build formula.
https://github.com/Homebrew/homebrew-core/blob/master/Formula/midnight-commander.rb

Grateful for any hints.

brew install -s --HEAD mc
==> Cloning https://github.com/MidnightCommander/mc.git
Updating /Users/eduardr/Library/Caches/Homebrew/midnight-commander--git
==> Checking out branch master
Already on 'master'
Your branch is up to date with 'origin/master'.
HEAD is now at 9e5535e2d Merge branch '4259_sftp_verify_fingerprint'
==> ./autogen.sh
Last 15 lines from /Users/eduardr/Library/Logs/Homebrew/midnight-commander/01.autogen.sh:
Copying file po/Makevars.template
Copying file po/Rules-quot
Copying file po/boldquot.sed
Copying file po/en@boldquot.header
Copying file po/en@quot.header
Copying file po/insert-header.sin
Copying file po/quot.sed
Copying file po/remove-potcdate.sin
autoreconf: running: aclocal -I m4 --force -I m4
configure.ac:31: error: AC_INIT should be called with package and version arguments
/usr/local/Cellar/automake/1.16.4/share/aclocal-1.16/init.m4:29: AM_INIT_AUTOMAKE is expanded from...
configure.ac:31: the top level
autom4te: error: /usr/local/opt/m4/bin/m4 failed with exit status: 1
aclocal: error: /usr/local/Cellar/autoconf/2.71/bin/autom4te failed with exit status: 1
autoreconf: error: aclocal failed with exit status: 1

Attachments

mc-4266-version_sh-short-version-for-config_h.patch (2.0 KB) - added by and 3 years ago.

Change History

comment:1 Changed 3 years ago by zaytsev

  • Cc and added

It seems to have the latest version of autotools installed, and apparently they broke something about AC_INIT. Patches welcome...

comment:2 follow-up: ↓ 3 Changed 3 years ago by and

Hi,
I can confirm this issue with automake-1.16.4
Since automake-1.16.4 complain predefined empty AC_PACKAGE_VERSION tiggered by following mc configure.ac lines

dnl If AC_PACKAGE_VERSION and AC_PACKAGE_STRING macros are predefined before
dnl AC_INIT call, AC_INIT doesn't redefine them.
dnl As a result, config.h will not contain macros with variable version.
m4_define([AC_PACKAGE_VERSION], [])
m4_define([AC_PACKAGE_STRING], [])

Currently I can not verify why this is needed to keep it out of config.h?

comment:3 in reply to: ↑ 2 Changed 3 years ago by andrew_b

Replying to and:

Currently I can not verify why this is needed to keep it out of config.h?

It's needed to get rid of config.h modification after each commit/checkout.
#2252

comment:4 Changed 3 years ago by and

Ah,
how about to print (only to stdout) a short mc version string by version.sh to get rid of empty AC_PACKAGE_VERSION/AC_PACKAGE_STRING defines at configure.ac?

comment:5 Changed 3 years ago by edrozenberg

Thanks for the patch, tried and it didn't fix the issue on MacOS, assuming my brew formula edit did the right thing

  on_macos do
    # Patch to fix AC build issue
    patch do
      url "http://midnight-commander.org/raw-attachment/ticket/4266/mc-4266-version_sh-short-version-for-config_h.patch"
      sha256 "a81974f2b5bbae7ceee5bb095e95758dc3f32437022ec59cd39161305be5d089"
    end
  end
==> Downloading http://midnight-commander.org/raw-attachment/ticket/4266/mc-4266-version_sh-short-version-for-config_h.patch
Already downloaded: /Users/eduardr/Library/Caches/Homebrew/downloads/0fc3d7f758328496ff6b09f7aefec21b076666d366feacc735ebeeaa2b3d43ee--mc-4266-version_sh-short-version-for-config_h.patch
==> Cloning https://github.com/MidnightCommander/mc.git
Updating /Users/eduardr/Library/Caches/Homebrew/midnight-commander--git
==> Checking out branch master
Already on 'master'
Your branch is up to date with 'origin/master'.
HEAD is now at cbc214da8 lib/tty/tty.c: fix indentation.
==> Patching
==> Applying mc-4266-version_sh-short-version-for-config_h.patch
patching file version.sh
==> ./autogen.sh
Last 15 lines from /Users/eduardr/Library/Logs/Homebrew/midnight-commander/01.autogen.sh:
Copying file po/Makevars.template
Copying file po/Rules-quot
Copying file po/boldquot.sed
Copying file po/en@boldquot.header
Copying file po/en@quot.header
Copying file po/insert-header.sin
Copying file po/quot.sed
Copying file po/remove-potcdate.sin
autoreconf: running: aclocal -I m4 --force -I m4
configure.ac:31: error: AC_INIT should be called with package and version arguments
/usr/local/Cellar/automake/1.16.4/share/aclocal-1.16/init.m4:29: AM_INIT_AUTOMAKE is expanded from...
configure.ac:31: the top level
autom4te: error: /usr/local/opt/m4/bin/m4 failed with exit status: 1
aclocal: error: /usr/local/Cellar/autoconf/2.71/bin/autom4te failed with exit status: 1
autoreconf: error: aclocal failed with exit status: 1

comment:6 Changed 3 years ago by and

This patch prepared only a possiblity to remove automake-1.16.4 problematic lines from configure.ac without having a regression for #2252

dnl If AC_PACKAGE_VERSION and AC_PACKAGE_STRING macros are predefined before
dnl AC_INIT call, AC_INIT doesn't redefine them.
dnl As a result, config.h will not contain macros with variable version.
m4_define([AC_PACKAGE_VERSION], [])
m4_define([AC_PACKAGE_STRING], [])

You need to remove these lines from configure.ac to fix automake-1.16.4 issue

comment:7 Changed 3 years ago by edrozenberg

Thanks a lot - worked great on MacOS to build cbc214da8 (Midnight Commander 4.8.26-232-gcbc214da8) after applying the mc-* patch from earlier + the patch below based on suggested line removals.

diff -rupN midnight-commander.orig/configure.ac midnight-commander.ptch/configure.ac
--- midnight-commander.orig/configure.ac	2021-08-02 10:58:03.000000000 -0700
+++ midnight-commander.ptch/configure.ac	2021-08-02 10:59:42.000000000 -0700
@@ -12,11 +12,6 @@ dnl as a result) and b) config.h is incl
 dnl recompilation is performed after commit instead of recompilation
 dnl of modified files only.
 dnl
-dnl If AC_PACKAGE_VERSION and AC_PACKAGE_STRING macros are predefined before
-dnl AC_INIT call, AC_INIT doesn't redefine them.
-dnl As a result, config.h will not contain macros with variable version.
-m4_define([AC_PACKAGE_VERSION], [])
-m4_define([AC_PACKAGE_STRING], [])
 AC_INIT([GNU Midnight Commander], m4_esyscmd_s([./version.sh .]),
         [https://www.midnight-commander.org/wiki/NewTicket], [mc],
         [https://www.midnight-commander.org/])
Version 0, edited 3 years ago by edrozenberg (next)

comment:8 Changed 3 years ago by andrew_b

  • Owner set to andrew_b
  • Status changed from new to accepted
  • Branch state changed from no branch to on review
  • Milestone set to 4.8.27

@and: thanks!

Branch: 4266_ac_init
Initial changeset:eb1c57d03bebf0f6d5f1bebce5bb99d3741e7a0e

comment:9 Changed 3 years ago by andrew_b

Ticket #4268 has been marked as a duplicate of this ticket.

comment:10 Changed 3 years ago by andrew_b

  • Votes for changeset set to andrew_b
  • Branch state changed from on review to approved

comment:11 Changed 3 years ago by andrew_b

  • Status changed from accepted to testing
  • Votes for changeset changed from andrew_b to committed-master
  • Resolution set to fixed
  • Branch state changed from approved to merged

Merged to master: [eab84392efb974a4b53c5411e3a3d7bcb7cf881f].

git log --pretty=oneline fdf2140bc..eab84392e

comment:12 Changed 3 years ago by andrew_b

  • Status changed from testing to closed
Note: See TracTickets for help on using tickets.