Hello,
     I use the newest version of gnulib from git. when I run the
./autogen.sh where I create for sed-4.9. gnulib-tool will throw an
exception like below:

  top/README-release
  top/maint.mk
Traceback (most recent call last):
  File "E:\Githubs\msvc-pkgs\pkgs\gnulib\.gnulib-tool.py", line 30, in
<module>
    main.main_with_exception_handling()
  File "E:\Githubs\msvc-pkgs\pkgs\gnulib\pygnulib\main.py", line 1367, in
main_with_exception_handling
    main()
  File "E:\Githubs\msvc-pkgs\pkgs\gnulib\pygnulib\main.py", line 953, in
main
    importer.execute(filetable, transformers)
  File "E:\Githubs\msvc-pkgs\pkgs\gnulib\pygnulib\GLImport.py", line 1222,
in execute
    emit = sp.run([joinpath(DIRS['root'], 'build-aux/prefix-gnulib-mk'),
'--from-gnulib-tool',

 
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python312\Lib\subprocess.py", line 548, in run
    with Popen(*popenargs, **kwargs) as process:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python312\Lib\subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Python312\Lib\subprocess.py", line 1538, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: [WinError 193] %1 is not a valid Win32 application

Finally, I have found the solution. I have add the 'shell=True' into
function sp.run in GLImport.py. You can see the detail
in 001-gnulib-fix-WinError-193.diff.
#!/bin/sh
# Convenience script for regenerating all autogeneratable files that are
# omitted from the version control repository. In particular, this script
# also regenerates all aclocal.m4, config.h.in, Makefile.in, configure files
# with new versions of autoconf or automake.
#
# This script requires autoconf-2.64..2.71 and automake-1.13..1.16 in the PATH.

# Copyright (C) 2003-2023 Free Software Foundation, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <https://www.gnu.org/licenses/>.

# Prerequisite (if not used from a released tarball): either
#   - the GNULIB_SRCDIR environment variable pointing to a gnulib checkout, or
#   - a preceding invocation of './autopull.sh'.
#
# Usage: ./autogen.sh [--skip-gnulib]
#
# Options:
#   --skip-gnulib       Avoid fetching files from Gnulib.
#                       This option is useful
#                       - when you are working from a released tarball (possibly
#                         with modifications), or
#                       - as a speedup, if the set of gnulib modules did not
#                         change since the last time you ran this script.

# Nuisances.
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH

skip_gnulib=false
skip_gnulib_option=

while :; do
  case "$1" in
    --skip-gnulib) skip_gnulib=true; skip_gnulib_option='--skip-gnulib'; shift;;
    *) break ;;
  esac
done

# The tests in gettext-tools/tests are not meant to be executable, because
# they have a TESTS_ENVIRONMENT that specifies the shell explicitly.

if ! $skip_gnulib; then
  if test -n "$GNULIB_SRCDIR"; then
    test -d "$GNULIB_SRCDIR" || {
      echo "*** GNULIB_SRCDIR is set but does not point to an existing directory." 1>&2
      exit 1
    }
  else
    GNULIB_SRCDIR=`dirname $(pwd)`/gnulib
    test -d "$GNULIB_SRCDIR" || {
      echo "*** Subdirectory 'gnulib' does not yet exist. Use './gitsub.sh pull' to create it, or set the environment variable GNULIB_SRCDIR." 1>&2
      exit 1
    }
  fi
  # Now it should contain a gnulib-tool.
  GNULIB_TOOL="$GNULIB_SRCDIR/gnulib-tool"
  test -f "$GNULIB_TOOL" || {
    echo "*** gnulib-tool not found." 1>&2
    exit 1
  }

  # https://www.gnu.org/software/gnulib/MODULES.html
  GNULIB_MODULES_POSIX_SUPPORT='
    acl
    alloca
    binary-io
    btowc
    c-ctype
    closeout
    dfa
    eloop-threshold
    extensions
    fwriting
    getdelim
    gettext-h
    git-version-gen
    gitlog-to-changelog
    idx
    ignore-value
    localcharset
    manywarnings
    mbrlen
    mbrtowc
    mbsinit
    memchr
    memrchr
    minmax
    mkostemp
    obstack
    perl
    progname
    readlink
    readme-release
    regex
    rename
    selinux-h
    ssize_t
    stat-macros
    stdalign
    stdbool
    strerror
    strverscmp
    unlocked-io
    update-copyright
    verify
    version-etc-fsf
    wcrtomb
    wctob
    xalloc
  '
  # Enhancements for POSIX:2008 functions
  GNULIB_MODULES_POSIX_ENHANCEMENTS='
    getopt-gnu
  '
  GNULIB_MODULES_POSIX="
    $GNULIB_MODULES_POSIX_SUPPORT
    $GNULIB_MODULES_POSIX_ENHANCEMENTS
  "

  $GNULIB_TOOL --import --local-dir=gl \
   --lib=libsed \
   --source-base=lib \
   --m4-base=m4 \
   --doc-base=doc \
   --tests-base=gnulib-tests \
   --aux-dir=build-aux \
   --with-tests \
   --makefile-name=gnulib.mk \
   --automake-subdir \
   --no-conditional-dependencies \
   --no-libtool \
   --macro-prefix=gl \
   --avoid=lock-tests \
   $GNULIB_MODULES_POSIX

  $GNULIB_TOOL --copy-file build-aux/ar-lib; chmod a+x build-aux/ar-lib
  $GNULIB_TOOL --copy-file build-aux/config.guess; chmod a+x build-aux/config.guess
  $GNULIB_TOOL --copy-file build-aux/config.sub;   chmod a+x build-aux/config.sub
  # If we got no texinfo.tex so far, take the snapshot from gnulib.
  if test ! -f build-aux/texinfo.tex; then
    $GNULIB_TOOL --copy-file build-aux/texinfo.tex
  fi
fi

aclocal -I m4
autoconf
autoheader && touch config.h.in
# Make sure we get new versions of files brought in by automake.
(cd build-aux && rm -f compile depcomp install-sh mdate-sh missing test-driver && cd ..)
automake --add-missing --copy
# Get rid of autom4te.cache directory.
rm -rf autom4te.cache tmp

# Remove all *~ files
for file in `find . -name "*~"`; do
  rm -rf $file
done || exit $?

echo "$0: done.  Now you can run './configure'."

Attachment: 001-gnulib-fix-WinError-193.diff
Description: Binary data

Reply via email to