Skip to content

Instantly share code, notes, and snippets.

@kuntau
Last active November 18, 2023 22:27
Show Gist options
  • Save kuntau/37698a5159ceac40982b1f7ae96b7db8 to your computer and use it in GitHub Desktop.
Save kuntau/37698a5159ceac40982b1f7ae96b7db8 to your computer and use it in GitHub Desktop.
Compile and install mosh error on Linux

Requirements:

sudo apk add autoconf
sudo apk add zlib-dev
sudo apk add openssl-dev
sudo apk add ncurses-dev
sudo apk add protobuf-dev

Autoconf

❯ ./autogen.sh
./autogen.sh: exec: line 3: autoreconf: not found

Make

❯ make
make  all-recursive
make[1]: Entering directory '/home/kuntau/forks/mosh'
Making all in scripts
make[2]: Entering directory '/home/kuntau/forks/mosh/scripts'
perl -Mdiagnostics -c ./mosh.pl
couldn't find diagnostic data in /usr/share/perl5/core_perl/pods/perldiag.pod /usr/local/lib/perl5/site_perl /usr/local/share/perl5/site_perl /usr/lib/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib/perl5/core_perl /usr/share/perl5/core_perl ./mosh.pl at /usr/share/perl5/core_perl/diagnostics.pm line 259, <POD_DIAG> line 711.
Compilation failed in require.
BEGIN failed--compilation aborted.
make[2]: *** [Makefile:521: mosh] Error 25
make[2]: Leaving directory '/home/kuntau/forks/mosh/scripts'
make[1]: *** [Makefile:387: all-recursive] Error 1
make[1]: Leaving directory '/home/kuntau/forks/mosh'
make: *** [Makefile:343: all] Error 2

Test: perl -e 'use diagnostics;'

Solution:

sudo apk add perl-doc

TLDR;

sudo apt install perl protobuf-compiler libprotobuf-dev \
libncurses5-dev zlib1g-dev libutempter-dev libssl-dev
git clone --depth=1 https://github.com/mobile-shell/mosh.git
cd mosh
./autogen.sh
./configure
make && sudo make install

1. Automake

❯ ./autogen.sh
./autogen.sh: 3: exec: autoreconf: not found

Solution:

sudo apt install automake

2. Protobuf

❯ ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking for cc... cc
...
...
...
checking for ranlib... ranlib
checking for protoc... no
configure: error: cannot find protoc, the Protocol Buffers compiler

Solution:

sudo apt install protobuf-compiler

or

git clone --depth=1 https://github.com/google/protobuf.git
cd protobuf
./autogen.sh
./configure
make && sudo make install

3. Zlib

❯ ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking for cc... cc
...
...
...
checking for utempter_remove_record in -lutempter... no
configure: WARNING: Unable to find libutempter; utmp entries will not be made.
checking for compress in -lz... no
configure: error: Unable to find zlib.

Solution:

sudo apt install zlib1g-dev

4. Ncurses

❯ ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking for cc... cc
...
...
...
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for TINFO... no
checking for TINFO... no
checking curses.h usability... no
checking curses.h presence... no
checking for curses.h... no
checking for NcursesW wide-character library... no
checking for Ncurses library... no
checking for Curses library... no
configure: error: requires either tinfo, NcursesW or Ncurses library

Solution:

sudo apt install libncurses5-dev

5. OpenSSL

❯ ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking for cc... cc
...
...
...
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for TINFO... yes
checking CommonCrypto/CommonCrypto.h usability... no
checking CommonCrypto/CommonCrypto.h presence... no
checking for CommonCrypto/CommonCrypto.h... no
checking for CRYPTO... no
checking openssl/aes.h usability... no
checking openssl/aes.h presence... no
checking for openssl/aes.h... no
configure: error: OpenSSL crypto library not found

Solution:

sudo apt install libssl-dev

6. Libprotobuf

❯ ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking for cc... cc
...
...
...
checking whether __builtin_bswap64 is declared... yes
checking whether IP_MTU_DISCOVER is declared... yes
checking whether IP_RECVTOS is declared... yes
checking whether __STDC_ISO_10646__ is declared... yes
checking whether IUTF8 is declared... yes
checking for protobuf... yes
checking whether protoc matches protobuf... /usr/local/bin/protoc: error while loading shared libraries: libprotoc.so.23: cannot open shared object file: No such file or directory
no
configure: error: Could not run protoc (/usr/local/bin/protoc).

Solution:

sudo apt install libprotobuf-dev

Easier dependencies

sudo apt install pkg-config

Installing latest protobuf from git

Dependencies

sudo apt install build-essential libtool

Error

./autogen.sh
+ mkdir -p third_party/googletest/m4
+ autoreconf -f -i -Wall,no-obsolete
configure.ac:109: error: possibly undefined macro: AC_PROG_LIBTOOL
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
autoreconf: /usr/bin/autoconf failed with exit status: 1

Solution

sudo apt install libtool

TLDR;

sudo apt install perl protobuf-compiler libprotobuf-dev \
libncurses5-dev zlib1g-dev libutempter-dev libssl-dev
git clone --depth=1 https://github.com/mobile-shell/mosh.git
cd mosh
./autogen.sh
./configure
make && sudo make install

1. Automake

❯ ./autogen.sh
./autogen.sh: 3: exec: autoreconf: not found

Solution:

sudo apt install automake

2. Protobuf

❯ ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking for cc... cc
...
...
...
checking for ranlib... ranlib
checking for protoc... no
configure: error: cannot find protoc, the Protocol Buffers compiler

Solution:

sudo apt install protobuf-compiler

or

git clone --depth=1 https://github.com/google/protobuf.git
cd protobuf
./autogen.sh
./configure
make && sudo make install

3. Zlib

❯ ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking for cc... cc
...
...
...
checking for utempter_remove_record in -lutempter... no
configure: WARNING: Unable to find libutempter; utmp entries will not be made.
checking for compress in -lz... no
configure: error: Unable to find zlib.

Solution:

sudo apt install zlib1g-dev

4. Ncurses

❯ ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking for cc... cc
...
...
...
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for TINFO... no
checking for TINFO... no
checking curses.h usability... no
checking curses.h presence... no
checking for curses.h... no
checking for NcursesW wide-character library... no
checking for Ncurses library... no
checking for Curses library... no
configure: error: requires either tinfo, NcursesW or Ncurses library

Solution:

sudo apt install libncurses5-dev

5. OpenSSL

❯ ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking for cc... cc
...
...
...
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for TINFO... yes
checking CommonCrypto/CommonCrypto.h usability... no
checking CommonCrypto/CommonCrypto.h presence... no
checking for CommonCrypto/CommonCrypto.h... no
checking for CRYPTO... no
checking openssl/aes.h usability... no
checking openssl/aes.h presence... no
checking for openssl/aes.h... no
configure: error: OpenSSL crypto library not found

Solution:

sudo apt install libssl-dev

6. Libprotobuf

❯ ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking for cc... cc
...
...
...
checking whether __builtin_bswap64 is declared... yes
checking whether IP_MTU_DISCOVER is declared... yes
checking whether IP_RECVTOS is declared... yes
checking whether __STDC_ISO_10646__ is declared... yes
checking whether IUTF8 is declared... yes
checking for protobuf... yes
checking whether protoc matches protobuf... /usr/local/bin/protoc: error while loading shared libraries: libprotoc.so.23: cannot open shared object file: No such file or directory
no
configure: error: Could not run protoc (/usr/local/bin/protoc).

Solution:

sudo apt install libprotobuf-dev

Easier dependencies

sudo apt install pkg-config

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = (unset),
        LC_ALL = "en_US.UTF-8",
        LC_CTYPE = "UTF-8",
        LC_TERMINAL = "iTerm2",
        LANG = "C.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("C.UTF-8").

Solution:

locale-gen en_US.UTF-8

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