3

Just finished installing ubuntu 16.04.1 desktop version. Now I am trying to install m4. So far installed m4 as follows.

  1. Downloaded m4-1.4.18.tar.gz
  2. tar -xvzf m4-1.4.18.tar.gz
  3. cd m4-1.4.18
  4. ./configure --prefix=/usr/local/m4
  5. make
  6. sudo make install

Now when I type:

m4 --version

It still says:

The program 'm4' is currently not installed....

What step am I missing?

Note: I do not have internet access on this machine.

Rui F Ribeiro
  • 55,929
  • 26
  • 146
  • 227
arod2028
  • 45
  • 1
  • 1
  • 4

2 Answers2

9

Normally on Ubuntu you'd just do apt-get install m4 to install m4 (which assumes you have an Internet connection), or download the m4 package and copy it across.

The way you've gone about things, m4 has been installed in /usr/local/m4/bin, so you need to run /usr/local/m4/bin/m4 or add /usr/local/m4/bin to your PATH. Alternatively, you can re-install, using

./configure && make && sudo make install

which will install m4 to /usr/local/bin, which should already be on your PATH.

Stephen Kitt
  • 411,918
  • 54
  • 1,065
  • 1,164
  • Thanks, running PATH=$PATH:/usr/local/m4/bin did it! Am I going about this the right way? Seems manually downloading the *.tar.gz file is not the right way? I see the update. How would I uninstall it first correctly? – arod2028 Jan 10 '17 at 14:31
  • Manually downloading the tarball isn't the best way, no, but it's not wrong either. `sudo make uninstall` in your current source tree will uninstall `m4`, or you can simply delete `/usr/local/m4`. – Stephen Kitt Jan 10 '17 at 14:36
  • Thanks that worked perfect. I think I am back on track now. Much appreciated Steve. – arod2028 Jan 10 '17 at 14:39
  • I would avoid using `/usr/local` at all if it's used by a package manager. Much safer to use e.g. `/opt` or `/sw` or `$HOME/local`. See also [GNU Stow](https://www.gnu.org/software/stow/). – Kusalananda Jan 10 '17 at 16:11
  • @Kusalananda `/usr/local` is never used by a package manager. The whole point of `/usr/local` is to install local software; that's why `./configure` defaults to `/usr/local` as prefix. – Stephen Kitt Jan 10 '17 at 16:12
  • @StephenKitt Tell that to the Free/OpenBSD teams :-) 3rd-party software (i.e. things in the ports/package system) goes into `/usr/local` as they are local additions to the base system. NetBSD is better, using `/usr/pkg` instead. – Kusalananda Jan 10 '17 at 16:34
  • @Kusalananda aargh! How long before some ports start using `/opt` or some other location? In fact `/opt` is used quite a bit in the Linux world by third-party packages... In the context of this question though `/usr/local` is safe (this is on Ubuntu). – Stephen Kitt Jan 10 '17 at 16:47
  • @arod2028 The best way would be to use something like apt-offline to retrieve the .deb packages without an Internet connection. – Gilles 'SO- stop being evil' Jan 10 '17 at 23:48
-3

You may also need install these

sudo apt-get install libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-dev g++-multilib 
sudo apt-get install -y git flex bison gperf build-essential libncurses5-dev:i386 
sudo apt-get install tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386 
sudo apt-get install dpkg-dev libsdl1.2-dev libesd0-dev
sudo apt-get install git-core gnupg flex bison gperf build-essential  
sudo apt-get install zip curl zlib1g-dev gcc-multilib g++-multilib 
sudo apt-get install libc6-dev-i386 
sudo apt-get install lib32ncurses5-dev x11proto-core-dev libx11-dev 
sudo apt-get install libgl1-mesa-dev libxml2-utils xsltproc unzip m4
sudo apt-get install lib32z-dev ccache