Opened 3 years ago

Last modified 3 years ago

#63093 new defect

msort 8.53: fixing install by disabling iwidgets itcl dep & running patched old Makefile.am

Reported by: vike2000 Owned by:
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc:
Port: msort

Description (last modified by vike2000)

I don't know if I'm correct in creating this ticket as I'm doing.
Please forgive any annoying language / formatting.

I tried to summarise my steps for a successful install in the ticket summary,
but I give you a full trace of my steps from problem to solution:

  • sudo port install msort
    
    grep 'configure:.* error:' '/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_itcl/itcl/work/itcl3.4/config.log'
    
    Getting given an initial error:
    configure:2138: error: C compiler cannot create executables
    
  • (Examining some MacPorts configure/C-compiler options.)
  • Finding ticket:44829#comment:9 mentioning itcl is "included in MacPorts' tcl".
    Also, above that, a question:

    is msort now effectively a dead twig on the port tree?

  • Patching the iwidgets Portfile to remove the itcl dep
    • (a) tarballs vs. (b) local

      a b  
      2121
      2222checksums           ${name}${version}.tar.gz md5 0e9c140e81ea6015b56130127c7deb03
      2323
      24 depends_build       port:tk port:itcl
       24depends_build       port:tk
      2525
      2626build.args          CPPFLAGS=-I${prefix}/include
      2727
  • sudo port install msort
    
    grep -B1 'error: use of undeclared identifier' /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_textproc_msort/msort/main.log|grep -Ev '\^|--'
    
    Getting given a secondary error
    :info:build In file included from /opt/local/include/uninum/uninum.h:19:
    :info:build /opt/local/include/gmp.h:1743:33: error: use of undeclared identifier 'UINT_MAX'
    :info:build /opt/local/include/gmp.h:1754:33: error: use of undeclared identifier 'ULONG_MAX'
    :info:build /opt/local/include/gmp.h:1765:33: error: use of undeclared identifier 'USHRT_MAX'
    
  • Finding a highly relevant comment before a debian bugreport getting fixed:

    The problem is that by default Automake adds "." to the include path
    (which is a pretty dumb idea IMO), and that msort has a header named
    "limits.h". So now when GMP requests <limits.h>, the msort's one gets
    included, instead of the system-wide one. Of course, the msort's header
    doesn't define UINT_MAX and friends, hence the error.

    Adding "nostdinc" to AUTOMAKE_OPTIONS in Makefile.am and then
    regenerating Makefile.in should fix the bug.

    --
    Jakub Wilk

    Before seeing this, having (daftly) tried to patch msort-*/info.c with an #include <limits.h>,
    and having also seen -I. -I. -I. in the make output of the clang runs,
    I'm realizing this could be the solution:
    (k=1 && p=msort && d=$p-8.53 && s=sudo\ -u\ macports && sp=sudo\ port &&
     (((!k))||($sp clean $p && $sp extract $p)) &&
     cd $($sp work $p)/$d &&
     $s perl -i -pe$'s/^(AUTOMAKE_OPTIONS =.*?)( nostdinc)?(.*?)$/\\1 nostdinc\\3/' Makefile.am &&
     $s automake) # automake is macports'
    
    (I'm working in a local repo)

Getting given a tertiary error:

…
configure.ac:4: error: version mismatch.  This is Automake 1.16.3,
configure.ac:4: but the definition used by this AM_INIT_AUTOMAKE
configure.ac:4: comes from Automake 1.9.6.  You should recreate
configure.ac:4: aclocal.m4 with aclocal and run automake again.
…

Noting the error: version mismatch.

  • Following a superuser.com/questions/383580/how-to-install-autoconf-automake... (cause a websearch didn't give me whether/how I could use something other than the intuitive port install automake @1.9.6 for that older version)
    (b=automake && v=1.9.6 && n="$b"-"$v" && a=$n.tar.gz &&
     cd /tmp && ([[ -a $a ]]||curl -OL http://ftpmirror.gnu.org/"$b"/"$a") &&
     rm -rf "$n" && tar -xzf "$a" &&
     cd "$n" && ./configure && make && sudo make install)
    
    Unknown if needed but I got this all working with it installed as well:
    (b=autoconf && v=2.59 && n="$b"-"$v" && a=$n.tar.gz &&
     cd /tmp && ([[ -a $a ]]||curl -OL http://ftpmirror.gnu.org/"$b"/"$a") &&
     rm -rf "$n" && tar -xzf "$a" &&
     cd "$n" && ./configure && make && sudo make install)
    
  • Finalizing, I can do a stream-patched variant of port install msort
    (k=1 && p=msort && d=$p-8.53 && s=sudo\ -u\ macports && sp=sudo\ port &&
     (((!k))||($sp clean $p && $sp extract $p)) &&
     cd $($sp work $p)/$d &&
     $s perl -i -pe$'s/^(AUTOMAKE_OPTIONS =.*?)( nostdinc)?(.*?)$/\\1 nostdinc\\3/' Makefile.am &&
     $s /usr/local/bin/automake &&
     $sp install $p)
    
    Some warnings can be fixed by also running autoconf, but this is not needed for install
    (k=1 && p=msort && d=$p-8.53 && s=sudo\ -u\ macports && sp=sudo\ port &&
     (((!k))||($sp clean $p && $sp extract $p)) &&
     cd $($sp work $p)/$d &&
     $s perl -i -pe$'s/^(AUTOMAKE_OPTIONS =.*?)( nostdinc)?(.*?)$/\\1 nostdinc\\3/' Makefile.am &&
     $s /usr/local/bin/autoupdate &&
     $s /usr/local/bin/aclocal &&
     $s /usr/local/bin/autoconf &&
     $s /usr/local/bin/automake &&
     $sp install $p)
    
  • Making use of the custom-installed (above) /usr/local/bin/automake (old version 1.9.6)
    I doubt any effort on my side to take this all the way through into the macports-ports repo will be fruitful.

I have only used this install of msort for something equivalent to ...|msort -qjl -ta -o= -cN -tz -o= -cN|....
Also please note that I haven't run any further testing on the implications on removing the iwidgets dep on itcl.

Btw:

port version
uname -a
Version: 2.6.2
Darwin [redacted] 17.7.0 Darwin Kernel Version 17.7.0: Mon Aug 31 22:11:23 PDT 2020; root:xnu-4570.71.82.6~1/RELEASE_X86_64 x86_64

(I have now done port selfupdate for Version: 2.7.1)

Hope I haven't overlooked anything.
Thanks to any linked resources, anyone who takes interest in this and of course the MacPorts project in general.

Peace,
vike

Change History (2)

comment:1 Changed 3 years ago by vike2000

Description: modified (diff)

comment:2 Changed 3 years ago by vike2000

Description: modified (diff)
Note: See TracTickets for help on using tickets.