bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Jianshan Jiang <jiangjianshan1103@gmail.com>
To: bug-gnulib@gnu.org
Subject: OSError: [WinError 193] %1 is not a valid Win32 application
Date: Tue, 30 Apr 2024 15:10:03 +0800	[thread overview]
Message-ID: <CAH3-bYKKuQ-ZR_Wp-ODE-VoRGGvMYkWA3ZJ4hVTv-2PKdEBZmA@mail.gmail.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 1549 bytes --]

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.

[-- Attachment #1.2: Type: text/html, Size: 1890 bytes --]

[-- Attachment #2: autogen.sh --]
[-- Type: text/x-sh, Size: 4835 bytes --]

#!/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 #3: 001-gnulib-fix-WinError-193.diff --]
[-- Type: application/octet-stream, Size: 698 bytes --]

--- GLImport.py.orig	2024-04-30 15:06:58.086331700 +0800
+++ GLImport.py	2024-04-30 15:07:08.042473100 +0800
@@ -1221,7 +1221,7 @@
         if automake_subdir:
             emit = sp.run([joinpath(DIRS['root'], 'build-aux/prefix-gnulib-mk'), '--from-gnulib-tool',
                            f'--lib-name={libname}', f'--prefix={sourcebase}/'],
-                          input=emit, text=True, capture_output=True).stdout
+                          input=emit, text=True, capture_output=True, shell=True).stdout
         with open(tmpfile, mode='w', newline='\n', encoding='utf-8') as file:
             file.write(emit)
         filename, backup, flag = assistant.super_update(basename, tmpfile)

             reply	other threads:[~2024-04-30 12:59 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-30  7:10 Jianshan Jiang [this message]
2024-04-30 13:44 ` OSError: [WinError 193] %1 is not a valid Win32 application Bruno Haible
2024-04-30 20:51   ` Collin Funk
2024-05-01 10:50     ` Bruno Haible
2024-05-01 13:50       ` Jeffrey Walton
2024-05-01 14:11         ` Bruno Haible
2024-05-01 14:26           ` Jeffrey Walton
2024-05-01 22:40             ` Collin Funk
2024-05-01 22:27       ` Collin Funk
2024-05-01 22:41         ` Bruno Haible

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAH3-bYKKuQ-ZR_Wp-ODE-VoRGGvMYkWA3ZJ4hVTv-2PKdEBZmA@mail.gmail.com \
    --to=jiangjianshan1103@gmail.com \
    --cc=bug-gnulib@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).