Skip to content

Instantly share code, notes, and snippets.

@eerohele
Last active March 3, 2024 04:20
Show Gist options
  • Star 28 You must be signed in to star a gist
  • Fork 7 You must be signed in to fork a gist
  • Save eerohele/2349067 to your computer and use it in GitHub Desktop.
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.

@nikunjvaidya
Copy link

You might want to add in the 'make' and 'make install' at the end of 4 for completeness.
The Cygwin compile worked great! thanks, nik.. .
ps: I've still to get the server working on an older system to really see this working for me.

@eerohele
Copy link
Author

@nikunjvaidya: added, thanks! Don't know how I managed to leave that out.

Glad to hear it's working, though.

@tdl
Copy link

tdl commented Apr 11, 2012

Cygwin compile working great here as well, thanks for this.

@bvenable
Copy link

I combined this with puttycyg to get a Windows mosh client.

@mqhiller
Copy link

My build failed:

./configure
checking for a BSD-compatible install... /bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.exe
checking for suffix of executables... .exe
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
checking for ranlib... ranlib
checking for protoc... /usr/local/bin/protoc
checking for library containing utempter_remove_added_record... no
configure: WARNING: Unable to find libutempter; utmp entries will not be made.
checking for library containing compress... -lz
checking for boostlib >= 1.20.0... yes
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking arpa/inet.h usability... yes
checking arpa/inet.h presence... yes
checking for arpa/inet.h... yes
checking curses.h usability... no
checking curses.h presence... no
checking for curses.h... no
configure: error: Missing required header file.

@bvenable
Copy link

@mqhiller do:

ls /usr/include/ncurses/curses.h

If you have that file, you aren't setting CPPFLAGS in your configure command.

If you don't have it, you need to install libncurses-devel in Cygwin setup.exe.

If you follow all of the original directions precisely you will get a working mosh install.

@mqhiller
Copy link

mqhiller commented Apr 11, 2012 via email

@mqhiller
Copy link

mqhiller commented Apr 11, 2012 via email

@mqhiller
Copy link

mqhiller commented Apr 11, 2012 via email

@mqhiller
Copy link

mqhiller commented Apr 11, 2012 via email

@mqhiller
Copy link

mqhiller commented Apr 11, 2012 via email

@eerohele
Copy link
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

@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.

Copy link

ghost commented Jun 10, 2012

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

@shdobxr
Copy link

shdobxr commented Jun 20, 2012

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

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

@mrosedale
Copy link

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

@shdobxr
Copy link

shdobxr commented Jul 19, 2012 via email

@eerohele
Copy link
Author

@danep2: Will do, thanks!

@ksmyth
Copy link

ksmyth commented Jul 26, 2013

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

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
Copy link

dburr commented Sep 9, 2013

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
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

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

  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