75
votes

When building my application with kdevelop 3.5 on Ubuntu 10.04, I get the following errors:

libtool: Version mismatch error. This is libtool 2.2.6 Debian-2.2.6a-4, but the
libtool: definition of this LT_INIT comes from libtool 2.2.6b.
libtool: You should recreate aclocal.m4 with macros from libtool 2.2.6 Debian-2.2.6a-4
libtool: and run autoconf again.
make[2]: *** [wktools4] Error 63
make[2]: Target `all' not remade because of errors.
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
*** Exited with status: 2 ***

Where can I get the needed version of libtool, or how can I recreate aclocal.m4?

10

10 Answers

149
votes

Try running

autoreconf --force --install
./configure
make

in the root directory of your project.

If that doesn't work, try running make maintainer-clean first and then go to step 1.

If that still doesn't work, run make maintainer-clean, then delete every generated file in the root directory of your project; including aclocal.m4, any m4 directory, any autom4te.cache directory, configure, Makefile.in, config.h, config.h.in, config.status, libtool, ltmain.sh, etc. Then go to step 1.

Why this works: libtool and aclocal.m4 are both files that are generated by your build system. If they are out of sync (generated by different versions of the build tools), then you get this error. Normally that shouldn't happen, but an example of something that can cause it is when you check in generated files to source control.

What this solution does is delete and regenerate all the autogenerated files. Once they're erased and regenerated, they can't be out of sync anymore.

11
votes

Try

autoreconf -i

The -i option is important.

9
votes

If you are using Anaconda, then this could be due to libtool and autoconf from different sources. You can check this by executing

which libtool

which autoconf

My libtool was from conda and autoconf was a system package. Uninstalled autoconf and installed it again using conda

apt remove -y autoconf (Ubuntu/Debian)

conda install -c anaconda autoconf

Note: You may need to install automake too.

conda install -c anaconda automake

3
votes

maybe you have installed two libtools of different version. Try to apt-get remove all (until you get nothing, when you type which libtool in the command line), then apt-get install the one you like.

1
votes

Try running aclocal

0
votes

I solve that uninstalling system's libtool and installing from upstream: git clone git://git.savannah.gnu.org/libtool.git

sudo apt-get install texinfo autoconf automake make
./bootstrap
./configure
make
sudo make install
0
votes

None of the above worked.

Then this worked:

autoconf -f
./configure
make
0
votes

None of the above worked. After I deactivated the conda environment, it worked:

source deactivate

0
votes

I also encounter this issue. In my case, in the output of ./autogen.sh, there is:

libtoolize: You should add the contents of the following files to 'aclocal.m4': libtoolize: '/aclocal/libtool.m4' libtoolize: '/aclocal/ltoptions.m4' libtoolize: '/aclocal/ltversion.m4' libtoolize: Consider adding 'AC_CONFIG_MACRO_DIRS([m4])' to configure.ac, libtoolize: and rerunning libtoolize and aclocal. libtoolize: Consider adding '-I m4' to ACLOCAL_AMFLAGS in Makefile.am.

I just append the content the three *.m4 files under /aclocal/ to the aclocal.m4 file:

cat <a path>/aclocal/libtool.m4 <a path>/aclocal/ltoptions.m4 <a path>/aclocal/ltversion.m4 >> aclocal.m4 

then make.

0
votes

here is the error:

libtool: Version mismatch error.  This is libtool 2.4.2 Debian-2.4.2-1.11, but the
libtool: definition of this LT_INIT comes from libtool 2.4.6.
libtool: You should recreate aclocal.m4 with macros from libtool 2.4.2 Debian-2.4.2-1.11
libtool: and run autoconf again.

None of the above worked.

Then this worked:

wget http://ftpmirror.gnu.org/libtool/libtool-2.4.6.tar.gz -O /root/libtool-2.4.6.tar.gz
tar xzvf /root/libtool-2.4.6.tar.gz -C /root
cp -f /usr/share/libtool/build-aux/ltmain.sh /usr/share/libtool/build-aux/ltmain_sh
cp -f /root/libtool-2.4.6/build-aux/ltmain.sh /usr/share/libtool/build-aux/ltmain.sh

autoreconf -fi
./configure
make