Giter Site home page Giter Site logo

Can't get winpty working about winpty HOT 9 CLOSED

shiek avatar shiek commented on August 21, 2024
Can't get winpty working

from winpty.

Comments (9)

rprichard avatar rprichard commented on August 21, 2024

FWIW, I am able to use winpty successfully with both Cygwin and MSYS -- so presumably the problem's got something to do with our environments.

I reproduced the Cygwin problem by installing the mingw-gcc-g++ package. (Previously I only had the mingw-w64 stuff installed.) I think there's a bug in Cygwin's header:

/usr/i686-pc-mingw32/sys-root/mingw/include/winbase.h
#if (NTDDK_VERSION >= NTDDI_WIN2KSP2)
#define FILE_FLAG_FIRST_PIPE_INSTANCE   524288
#endif

I think the NTDDK_VERSION was supposed to be NTDDI_VERSION.

rprichard@vbwin7 /usr/i686-pc-mingw32/sys-root/mingw/include
$ grep NTDDK_VERSION -R .
./winbase.h:#if (NTDDK_VERSION >= NTDDI_WIN2KSP2)

rprichard@vbwin7 /usr/i686-pc-mingw32/sys-root/mingw/include
$ grep NTDDI_VERSION -R .
./sdkddkver.h:#define NTDDI_VERSION_FROM_WIN32_WINNT(ver) _NTDDI_VERSION_FROM_WIN32_WINNT(ver)
./sdkddkver.h:#define _NTDDI_VERSION_FROM_WIN32_WINNT(ver) ver##0000
./sdkddkver.h: * Version constants defining NTDDI_VERSION.
./sdkddkver.h:#ifdef NTDDI_VERSION
./sdkddkver.h:#    if _WIN32_WINNT != OSDIR(NTDDI_VERSION)
./sdkddkver.h:#      error The _WIN32_WINNT value does not match NTDDI_VERSION
./sdkddkver.h:#    define _WIN32_WINNT WINNTVER(NTDDI_VERSION)
./sdkddkver.h:#ifndef NTDDI_VERSION
./sdkddkver.h:#    warning NTDDI_VERSION is defaulting to _WIN32_WINNT version SPK0
./sdkddkver.h:#  define NTDDI_VERSION NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT)
./winbase.h:#if (NTDDI_VERSION >= NTDDI_WINXPSP1)
./winbase.h:#endif /* (NTDDI_VERSION >= NTDDI_WINXPSP1) */

My mingw-w32api and mingw-runtime packages are up-to-date (version 4.0-1). (I'm not sure which package has the winbase.h header in it.)

from winpty.

rprichard avatar rprichard commented on August 21, 2024

I pushed a commit that should work around the Cygwin problem. Let me know how that goes.

I haven't looked at the MSYS problem yet.

from winpty.

shiek avatar shiek commented on August 21, 2024

Thank you very much Ryan!
Your workaround works great.

 ~/winpty-master
$ ./configure
uname -s identifies a Cygwin environment.
uname -m identifies a i686 environment.
Found Cygwin/MSYS G++ compiler: i686-pc-cygwin-g++
Found 32-bit MinGW G++ compiler: i686-pc-mingw32-g++
Writing config-unix.mk
Writing config-mingw.mk

 ~/winpty-master
$ make
cd agent && make
make[1]: Entering directory '/home/User/winpty-master/agent'
Compiling EventLoop.cc
Compiling NamedPipe.cc
Compiling Agent.cc
Compiling AgentAssert.cc
Compiling Terminal.cc
Compiling Win32Console.cc
Compiling ConsoleInput.cc
Compiling ../shared/DebugClient.cc
Compiling Coord.cc
Compiling SmallRect.cc
Compiling main.cc
Linking ../build/winpty-agent.exe
make[1]: Leaving directory '/home/User/winpty-master/agent'
cd libwinpty && make
make[1]: Entering directory '/home/User/winpty-master/libwinpty'
Compiling winpty.cc
Compiling ../shared/DebugClient.cc
Linking ../build/winpty.dll
make[1]: Leaving directory '/home/User/winpty-master/libwinpty'
cd unix-adapter && make
make[1]: Entering directory '/home/User/winpty-master/unix-adapter'
Compiling main.cc
Compiling Shared.cc
Linking ../build/console.exe
make[1]: Leaving directory '/home/User/winpty-master/unix-adapter'

The testcase works fine too now. :)

$ console /cygdrive/c/Python27/python.exe
Python 2.7.8 (default, Jun 30 2014, 16:03:49) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()

The winbase.h is in the package mingw-w32api-4.0-1.

from winpty.

shiek avatar shiek commented on August 21, 2024

I think it wasn't a good idea to use the MSYS version in Cygwin. I'll try the MSYS version in MSYS tomorrow and I think it will work.

Btw. Could you add the https://github.com/rprichard/winpty/downloads/ page to the README.rst please? I totally overlooked the already compiled packages at the beginning.
Btw2. You could add make to the Cygwin packages for completeness. (README.rst)

from winpty.

shiek avatar shiek commented on August 21, 2024

I'm sorry - the MSYS version works fine in MSYS.
Do you have a real testcase for winpty in MSYS? Because in MSYS python works also without winpty.

from winpty.

rprichard avatar rprichard commented on August 21, 2024

MSYS is basically the same as Cygwin -- both of them can be used inside a
Windows console (i.e. the clunky "DOS box"), in which case, the native
Windows Python will work fine. Alternatively, they can be run inside an
emulated pty using a terminal emulator like mintty. In that case, the
native Windows Python will see the pty as a vanilla Windows pipe and fail.

A good way to test MSYS and winpty is to install the MSYS version of
mintty. It looks like there's a mintty-1.1.3-msys.zip binary for download
on the mintty site, or you might be able to use a package manager too (e.g.
"mingw-get install mintty").

-Ryan

On Thu, Sep 18, 2014 at 7:44 AM, shiek [email protected] wrote:

I'm sorry - the MSYS version works fine in MSYS.
Do you have a real testcase for winpty in MSYS? Because in MSYS python
works also without winpty.


Reply to this email directly or view it on GitHub
#27 (comment).

from winpty.

shiek avatar shiek commented on August 21, 2024

Ah - thank you for pointing that out. I never used MSYS before yesterday -- just Cygwin all the time.
I thought this basic MSYS shell is like mintty in Cygwin.

from winpty.

martell avatar martell commented on August 21, 2024

I don't know if this is the place to post this but this info should help a lot
msys from mingw.org is very very old like 5/6 years old

There is the msys2 project that i am a contributor to and I've even added winpty as a package.
We unlike msys have a package manage. pacman borrowed from arch linux.
Where we keep every component of the shell up to date
See here http://msys2.github.io

So we have bash 4.3 and all the latest autotools etc.
our mintty is the latest from trunk and
We use the latest mingw-w64 headers and toolchains.
mingw.org toolchains are also very old and dont support x64 and armv7.
As a result most linux distros have switched to mingw-w64

from winpty.

rprichard avatar rprichard commented on August 21, 2024

I added make to the Cygwin and MSYS2 package lists in the README.

I think I'll upload new binaries at some point. The ones at https://github.com/rprichard/winpty/downloads are a few years old now, assume 32 bits, and lack various bugfixes. (They break badly on Windows 10.) Issue #32 covers that, though.

The FILE_FLAG_FIRST_PIPE_INSTANCE bug was fixed in the winbase.h header, http://sourceforge.net/p/mingw/bugs/2050/. If I remove my hack, my code compiles fine with:

It still fails using the original MinGW installed via Cygwin. Maybe no one is updating its w32api package? In any case, I changed the configure script to prefer MinGW-w64 over MinGW for Cygwin.

from winpty.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.