Skip to content

Instantly share code, notes, and snippets.

@eerohele
Last active March 3, 2024 04:20
Show Gist options
  • Select an option

  • Save eerohele/2349067 to your computer and use it in GitHub Desktop.

Select an option

Save eerohele/2349067 to your computer and use it in GitHub Desktop.
Compiling Mosh (http://mosh.mit.edu/) under Cygwin

NOTE: You don't need to compile Mosh on Cygwin yourself anymore; just install the package with Cygwin's setup.exe.

  1. Download Cygwin.

  2. Run setup.exe and install the following packages in addition to the default ones:

    • make
    • boost
    • libncurses-devel
    • pkg-config
    • perl
  3. Download and compile Protocol Buffers (make sure there are no spaces in the working directory when compiling Protocol Buffers, make will fail if there are):

     $ tar zxvf protobuf-2.4.1.tar.gz
     $ cd protobuf-2.4.1
     $ ./configure
     $ make
     $ make install
    
  4. Download and compile Mosh:

     $ tar zxvf mosh-1.1.3.tar.gz
     $ cd mosh-1.1.3
     $ ./configure CPPFLAGS="-I/usr/include/ncurses" PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/
     $ make
     $ make install
    
  5. Install the IO::Pty Perl module:

     $ perl -MCPAN -e shell
     cpan> install IO::Pty
    
  6. Rock’n’roll.

@mqhiller

mqhiller commented Apr 11, 2012 via email

Copy link
Copy Markdown

@mqhiller

mqhiller commented Apr 11, 2012 via email

Copy link
Copy Markdown

@eerohele

Copy link
Copy Markdown
Author

@mqhiller: Well, this probably falls more into general Mosh troubleshooting than Cygwin-specific stuff, but make sure your server also has Mosh installed and UDP ports 60000-61000 open.

See http://mosh.mit.edu#usage for more info.

@bvenable

Copy link
Copy Markdown

@mqhiller is mosh-server installed in your path on 192.168.97.121? If it's installed but not in your path, use the client flag --server=/path/to/mosh-server to specify the path to it. If it's not installed, install it.

ghost commented Jun 10, 2012

Copy link
Copy Markdown

This doesn't work for me, it just says, "hangup"

@dan-osms

Copy link
Copy Markdown

See notes here:
mobile-shell/mosh#164

The problem is that we weren't using mosh correctly. See below. You must log onto the remote host using SSH. Then start mosh-server. This in turn gen's a key and a port. See below. That was the fix for me. Also make sure that you have setup your iptables and/or firewall(s) to allow this traffic through.

Now I run on the server:

mosh-server

MOSH CONNECT 60001 qbE+SNhaEJpfzFpHcXBwkw

and on the client:

MOSH_KEY=qbE+SNhaEJpfzFpHcXBwkw mosh-client 60001

@danepowell

Copy link
Copy Markdown

You might also mention that protobuf make will fail if the working directory has spaces in the path.

@mrosedale

Copy link
Copy Markdown

I'm having an issue where the client immediately hangsup when I try to connect. Any ideas what might be causing this?

What I see is following message.
Hangup

@dan-osms

dan-osms commented Jul 19, 2012 via email

Copy link
Copy Markdown

@eerohele

Copy link
Copy Markdown
Author

@danep2: Will do, thanks!

@ksmyth

ksmyth commented Jul 26, 2013

Copy link
Copy Markdown

This mosh configure worked for me:
PKG_CONFIG_PATH="/usr/local/lib/pkgconfig" ./configure CPPFLAGS="-I/usr/include/ncurses"

Current pkg-config (version 0.23b-10) installs to /usr/lib/pkgconfig/.

I also needed to install the zlib-devel and openssl-devel packages.

Thanks for the instructions.

@gdude2002

Copy link
Copy Markdown
Gareth@GARETH-PC ~/protobuf-2.5.0
$ make
make  all-recursive
make[1]: Entering directory `/home/Gareth/protobuf-2.5.0'
Making all in .
make[2]: Entering directory `/home/Gareth/protobuf-2.5.0'
make[2]: Leaving directory `/home/Gareth/protobuf-2.5.0'
Making all in src
make[2]: Entering directory `/home/Gareth/protobuf-2.5.0/src'
.deps/atomicops_internals_x86_gcc.Plo:1: *** multiple target patterns.  Stop.
make[2]: Leaving directory `/home/Gareth/protobuf-2.5.0/src'
Makefile:568: recipe for target `all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/Gareth/protobuf-2.5.0'
Makefile:477: recipe for target `all' failed
make: *** [all] Error 2

Hmm.. I guess I'll try the older version of this package then..

EDIT: Using the version of this package that was specified above..

Gareth@GARETH-PC ~/protobuf-2.4.1
$ make
make  all-recursive
make[1]: Entering directory `/home/Gareth/protobuf-2.4.1'
Making all in .
make[2]: Entering directory `/home/Gareth/protobuf-2.4.1'
make[2]: Leaving directory `/home/Gareth/protobuf-2.4.1'
Making all in src
make[2]: Entering directory `/home/Gareth/protobuf-2.4.1/src'
.deps/code_generator.Plo:1: *** multiple target patterns.  Stop.
make[2]: Leaving directory `/home/Gareth/protobuf-2.4.1/src'
Makefile:530: recipe for target `all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/Gareth/protobuf-2.4.1'
Makefile:435: recipe for target `all' failed
make: *** [all] Error 2

Using Cygwin x86_64, btw.

@dburr

dburr commented Sep 9, 2013

Copy link
Copy Markdown

I also needed to install libz-devel and openssl-devel to get mosh to compile, however everything is working quite nicely now. :) Running cygwin x86_64 version 1.7.25(0.270/5/3).

@eerohele

Copy link
Copy Markdown
Author

Note to future visitors: you don't need to compile Mosh on Cygwin yourself any more; just install the package with Cygwin's setup.exe.

@CMCDragonkai

Copy link
Copy Markdown

Above instructions is outdated, and the mosh in Cygwin official packages is broken. Instructions to build are here: mobile-shell/mosh#850 (comment)

@alejandro-bello

Copy link
Copy Markdown
  1. Can't download a .gz. The "Protocol Buffers" link points to a git repository! Since you're supposedly inside cygwin (not a fancy GUI desktop with a full-fledged web browser), you can't access the "download ZIP" option, so you're left with cloning a git repository, so no ".gz", nor useful instructions after that.
    git clone https://github.com/protocolbuffers/protobuf.git --depth=1

./configure
$ make
$ make install

It's all Ancient Mesopotamian dialect for me. I just wanted to install mosh for Windows, not learn to compile (Python, maybe?) under a completely new interface (cygwin, a pseudo Linux that doesn't work exactly as a ny Linux distro) that demands a obnoxiuslt steep learning curve just to use once.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment