libtool version mismatch error

2019-01-16 05:25发布

问题:

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?

回答1:

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.



回答2:

Try

autoreconf -i

The -i option is important.



回答3:

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



回答4:

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.



回答5:

Try running aclocal



回答6:

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


回答7:

None of the above worked.

Then this worked:

autoconf -f
./configure
make


回答8:

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

source deactivate