After a few attempts, I summarized a much easier steps to reproduce this issue.
I'm highly recommend that run in a VM.

1. Install vs_BuildTools.exe, and then just install C++ components
2. Install msys2 from https://www.msys2.org/
3. Click "x64 Native Tools Command Prompt for VS" from start menu
4. Run "set MSYS2_PATH_TYPE=inherit"
5. Run msys2_shell.cmd located in msys2 installation directory in the terminal
6. Run "pacman -S autotools base-devel m4" for dependency packages
7. Download libtool-2.5.4.tar.gz and extract it (wget + bsdtar)
8. Apply the patch I submitted in
https://savannah.gnu.org/support/index.php?111241
9. Run the following commands to setup a MSVC compatible environment
export PATH=$PATH:$(ls -dv /usr/share/automake-* 2> /dev/null | tail -n 1)
export \
    AR="ar-lib lib.exe" \
    AS=":" \
    CC="compile cl.exe" \
    CCAS=":" \
    CFLAGS="-O2" \
    CL="-nologo -utf-8" \
    CPP="compile cl.exe -E" \
    CPPFLAGS="-DNDEBUG" \
    CXX="compile cl.exe" \
    DLLTOOL="link.exe -dll" \
    LD="link.exe" \
    NM="dumpbin.exe -symbols -headers" \
    RANLIB=":" \
    STRIP=":"
10. change directory to libtool directory and run ./configure
--host=x86_64-msvc-mingw32
11. make and install (I hate install to system directory that's the reason why I
run it in VM)
12. Run the following commands to reproduce this issue
export CL="-nologo -utf-8 -O2 -GL"
echo "int main(void) {}" > test.c
libtool --mode=link compile cl.exe test.c -o test.exe
libtool --mode=install /usr/bin/install -c test.exe /tmp/test.exe

If you are impatient to wait the build process, just run ./libtool in build
directory instead of system ones after step 10.

Reply via email to