104

This is my first time trying to compile and install anything on a linux machine. I got the latest version of https://github.com/processone/exmpp via git and read the instructions which state:

2. Build and install

Exmpp uses the Autotools. Therefore the process is quite common:

$ ./configure
$ make
$ sudo make install

after type ./configure I get the error

Cannot find install-sh, install.sh, or shtool in ac-aux

Google was of little to no help. Not sure at all what I'm supposed to do. Any help would be much appreciated

Josh Pinto
  • 7,919
Micah
  • 1,204

10 Answers10

152

I got it to create the configure script using the following tools:

libtoolize --force
aclocal
autoheader
automake --force-missing --add-missing
autoconf
./configure

I don't have all the dependencies so I can't test it right now, but this is generally how you would create a configure script from an ac file.

Evan Carroll
  • 7,526
sk29910
  • 2,328
  • I'm a total noob. Can you explain what it is your doing and why the instructions in the readme file don't work? – Micah Feb 23 '11 at 06:35
  • 2
    The instructions in the README were probably blindly copied from somewhere else. I have to admit that I don't understand every detail of the autoconf toolchain; it's basically a collection of macros that are generated and used to create your configure script (which, in turn, sets the stage for the compilation and installation process). I never had to fine-tune these things, so I'm not an expert, but there are some fairly extensive explanations here – sk29910 Feb 23 '11 at 07:05
  • I was getting undefined macro errors when executing a configure script (such as the AX_PTHREAD macro). These macros appear to be usually defined in a subfolder 'm4'. Replacing autoconf with autoreconf in sebastian_k's answer, solved this issue for me. – logion Jul 18 '14 at 11:34
  • 22
    Note to programmers: please stop using the automake toolchain. Please. – Qix - MONICA WAS MISTREATED Oct 02 '15 at 09:41
  • 3
    @Qix, could you, please, explain us why? – Serg Kryvonos Feb 21 '16 at 20:01
  • 8
    @Sergei it's messy, slow, and breaks constantly. It clutters up defines and is incredibly magic. Its way of handling dependencies (or lack thereof) gives cryptic error messages, and the files it produces are unreadable at best and nightmarishly broken at worst. – Qix - MONICA WAS MISTREATED Feb 22 '16 at 19:53
  • 1
    @Qix thank you much for the explaination. Which alternative you see? – Serg Kryvonos Feb 25 '16 at 12:09
  • 5
    @Sergei CMake is the most viable at this point in time in my opinion. I'm sure there will be something better in the (near) future. – Qix - MONICA WAS MISTREATED Feb 26 '16 at 01:04
  • found this series of commands very helpful! – memnoch_proxy Jun 18 '16 at 04:50
  • 1
    Saved this to ~/bin/autohell.sh for future (ab)use. – kfix Mar 28 '17 at 01:04
  • @Qix The accusation on automake toolchain (I prefer to call it GNU Build System) is plain wrong, but I agree with the suggestion of not using it. It is a good tool, but most users use it the wrong way, so they are better off without it. – Franklin Yu Aug 27 '18 at 16:22
57

Well, I tried sebastian_k's answer and it didn't work for me (./configure crashed midway through with an extremely weird error).

What did, however work for me was copying the instructions used in this build log I found

The short version(so you don't have to wade through it yourself) is:

$ autoreconf -vif
$ ./configure --prefix=/usr/lib/erlang/lib
$ make
$ sudo make install
entropy
  • 671
  • 5
  • 4
14

This question, and most of the other answers here, arise from a misunderstanding of how projects using the GNU Build System (a.k.a. Autotools) are distributed. In fact, in the case of the Erlang XMPP library mentioned by the OP, the misunderstanding appears to be on the part of the developers.

Obtaining the software the right way

If all you want to do is compile and install a project released with the GNU Autotools, then you should not check it out from the source control system. You should instead download the packaged source release provided by the developer. These normally take the form of tarballs distributed on the project's website. For projects that are hosted entirely on GitHub, Savannah, or some similar hosting service, these tarballs will usually be found behind some link labelled "Download" or "Releases". You untar the package and utter some variant of the standard ./configure && make && sudo make install incantation. That's all; you don't need to invoke any of the GNU Autotools, and don't even need to have the GNU Autotools installed on your system.

The reason that you, the user, don't need the GNU Autotools to compile an Autotools-packaged project is that the developer has already used the various Autotools programs to generate a "distribution tarball" that can be used to build the software on any Unix-like system. The distribution tarball contains a highly portable configure script that scans the build environment, checks for dependencies, and constructs a Makefile customized to your system.

So when do you need Autotools?

The only reason you should need to install and invoke the GNU Autotools yourself is if you want to do development work on a project built with Autotools. And even then, you probably won't need the Autotools unless you change the project's dependencies. In that case, you would indeed need to check out the original source, make appropriate changes to the Autotools-specific input files (configure.ac, Makefile.am, etc.), and run the Autotools on them to generate a new configure file. If you want to independently publish the revised package, then you would use the Makefile generated by Autotools to generate a new distribution tarball, and then publish that tarball somewhere online.

The problem is that some developers make their source repository publically available but neglect to publish their distribution tarballs (or make it difficult to find where they are published). For example, rather than publishing their distribution tarballs as GitHub Releases, the Erlang XMPP library's GitHub Releases are tarballs of the raw source repository. This makes it impossible to compile the project without the GNU Autotools, defeating the entire purpose of using Autotools in the first place.

TL;DR summary

The GNU Autotools are something that developers use to make portable source code packages for users. Users should download and compile from these source packages, not the original code from the source control system. If the developers don't provide these source packages, then they aren't using Autotools correctly, and should be gently slapped with a wet trout until they see the error of their ways.

Psychonaut
  • 243
  • 2
  • 5
  • How is this long post related to the question? Did OP try to use autotools? They downloaded some soft and ran ./configure && make && sudo make install as you suggested in the second paragraph. – Pilot6 Sep 01 '17 at 10:56
  • 6
    It's relevant because the software downloaded by the OP did not contain a correct configure script (and the most recent version in source control, plus the released tarballs, do not contain a configure script at all). Almost all the answers here are telling the OP to run Autotools. While this may work around the problem, it's important to understand the root cause: the developers are the ones responsible for running Autotools, and they haven't done this correctly (or at all). – Psychonaut Sep 01 '17 at 11:02
  • 1
    This is a good answer, and although I like the phrase "gently slapped with a wet trout" it might be more appropriate to explicitly mention the the correct response is to report the bug upstream. – William Pursell Sep 01 '17 at 14:43
  • 1
    @WilliamPursell I take it the pun is intended. :) – Psychonaut Sep 01 '17 at 14:51
  • @Psychonaut Do you suggest that we never use a non release version of a library? For example am I supposed to use a library that has not had a release since many years ago but has lots of useful bug fixes to the main branch? I need to know how to correctly generate the configure file to be able to do that. In my case the last release is not even compilable anymore by new compilers/standards. – pooya13 Sep 15 '20 at 10:34
  • 1
    @pooya13 Again it's about using autotools correctly. The developers of a project like exmpp that uses autotools should provide a script called bootstrap or autogen.sh that runs all of the necessary commands to regenerate the configure script and related support files. They haven't done that, but at least they say what commands to run in their README. If the developers of the software you want to use haven't provided such a script or instructions in their readme, more troutslapping is appropriate. – ryandesign Mar 08 '21 at 10:00
9

Please do the following to fix this problem,

sudo apt-get install autogen libtool shtool

Then do the installation

sh autogen.sh --prefix=prefered_install_path
make 
make install 
Evan Carroll
  • 7,526
Ravi Hegde
  • 91
  • 1
  • 2
4

I've had this problem, and found it was due to the following line in configure.ac:

AC_CONFIG_AUX_DIR([build-aux])

The line wasn't bad per se, however it needed to be moved closer to the top of the configure.ac file.

3

When trying to compile GNU Octave from Mercurial repository, you may come across this problem. The fix is to run ./bootstrap while being in the root of the source tree.

Ruslan
  • 1,733
2

I had slightly different error:

configure: error: cannot find install-sh, install.sh, or shtool in "." "./.." "./../.."

It turns out configure couldn't find build-aux/install-sh. I linked it like so

ln -s build-aux/install-sh .

then it builds.

Hope that helps someone out there!

Barmaley
  • 401
  • 4
  • 5
1

sudo apt-get install automake autoconf

its works sucessfully

Radu Rădeanu
  • 169,590
0

After installing autogen package this error got resolved in wolfSSL build.

sudo apt-get install autogen libtool shtool
rashok
  • 349
  • 3
  • 7
0

I had a similar problem when i tried to ./configure a source code and got the same error as posted. Finally resolved my issues by entering the code:

sudo apt-get install autotools-dev