When I type ./autogen.sh,some error happened.
It is a design goal of the Autotools that they are not part of ordinary builds. The Autotools are used for building the build system, which is a package maintainer responsibility. People who merely want to build the project should not (according to Autotools philosophy) invoke the Autotools at all -- instead, they should use the build system that has already been provided to them, consisting of a configure
script, Makefile and header templates, etc..
Thus, the first thing to try should always be to unpack a clean copy the distribution, and, without running autogen.sh
, autoreconf
, or similar, perform a standard configure; make; make install
sequence. In that case, the Autotools should not need even to be installed on the build host. Only if the existing build system needs to be modified for your environment, or if none is provided in the first place, should you look into (re)building the build system.
If you do need to rebuild the build system -- which is not as uncommon as GNU would like -- then the smoothest way forward is to use the same versions of the Autotools that the package maintainers use. More recent versions are often a viable substitute, to a point, but sometimes they require adjustments to the Autotools inputs. Older versions can be problematic. You must remain well aware, however, that this puts you in the role of a package maintainer, not a mere package builder. Rebuilding the build system opens you to a need to solve problems specific to that endeavor.
Sometimes, version compatibility issues can be partially or wholly resolved by instructing the Autotools to replace the scripts and local m4 macros that they install into the project source tree. If the project provides an autogen.sh
, it might or might not do this. The command autoreconf --install --force
, run from the root of the source tree, will take care of all those Autotools pieces, but might not do other things that autogen.sh
does. It is probably worth your while to check out what your particular autogen.sh
does, and it might be useful to run both autoreconf
and autogen.sh
, probably in that order.
I think maybe the .bashrc file is not right
It is unlikely that the particular error message you presented reflects a problem with your environment configuration. It could reflect an issue with your DIY local Autotools -- more likely Libtool than the others -- but there is a fair chance that it reflects an incompatibility between the Autotools versions used by the package's maintainers and the ones you have built.
sudo apt-get install libtool
to fix the issue. – Schwa