77

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?

P̲̳x͓L̳
  • 3,615
  • 3
  • 29
  • 37
mspoerr
  • 2,680
  • 5
  • 32
  • 35

11 Answers11

162

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.

ptomato
  • 56,175
  • 13
  • 112
  • 165
  • 6
    I don't want to edit the answer because I don't understand, but I had this error, and `autoreconf` wasn't enough. I had to run: `aclocal; libtoolize --force; autoheader; autoconf` – djeikyb Jun 15 '12 at 00:09
  • 2
    `autoreconf` does nothing else than run all those programs for you. It's probably a good idea to add the `--force` option though, I'll edit the answer. – ptomato Jun 15 '12 at 07:13
  • I tried this with php5 on ubuntu 12.04, but things gone worse after this command: I'm not able to execute `./configure` successfully after this – hek2mgl Oct 24 '13 at 16:20
  • If there's an `autogen.sh` or `bootstrap` script, run that first. – ptomato Oct 25 '13 at 04:49
  • 4
    But why does this help? What is the version mismatch really about? – user1603472 Jun 03 '14 at 09:17
  • @ptomato, thanks for your answer. I've stuck in similar issue. Could you, please, take a look at my question? http://stackoverflow.com/questions/28788920/libtool-issue-while-compile-liblinphone – orkenstein Mar 01 '15 at 07:24
  • Is it possible to specify the directory of the libtool version I want to use? How do I do that? I am thinking like autoreconf --force --install – user2543 Mar 19 '21 at 09:43
14

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

Foreever
  • 7,099
  • 8
  • 53
  • 55
12

Try

autoreconf -i

The -i option is important.

Peter Eisentraut
  • 35,221
  • 12
  • 85
  • 90
3

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.

Florent
  • 12,310
  • 10
  • 49
  • 58
Johnson
  • 31
  • 1
  • 2
    Didn't realize this until I run which libtool and find that it points to my anaconda installation. Thanks! – Yadli Sep 21 '17 at 03:56
1

Try running aclocal

ninjalj
  • 42,493
  • 9
  • 106
  • 148
  • 1
    thank you for your answer. Could you please be more specific? Which options do I have to use? Thanks! – mspoerr Jun 24 '10 at 18:51
0

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
Neonigma
  • 1,825
  • 17
  • 20
0

None of the above worked.

Then this worked:

autoconf -f
./configure
make
lkraav
  • 2,696
  • 3
  • 26
  • 26
0

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

source deactivate

Dawei Yang
  • 606
  • 1
  • 9
  • 19
0

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.

japrin
  • 21
  • 2
0

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
0

I also use custom include directories for autoconf and autoreconf, like autoreconf -I ./m4. So it happened that an outdated ltversion.m4 accidentially was sitting inside one of those custom includes. This caused exactly the same error here. I solved it by removing the outdated ltversion.m4 file.

domson
  • 205
  • 2
  • 8