I have run this in a terminal.

git clone git://libmtp.git.sourceforge.net/gitroot/libmtp/libmtp
cd libmtp

(answering yes to all questions)

But when I try to run the ./configure --prefix=/usr/ I get this error:

checking whether to build static libraries... yes

./configure: line 11739: AC_LIB_PREPARE_PREFIX: command not found

./configure: line 11740: AC_LIB_RPATH: command not found

./configure: line 11745: syntax error near unexpected token `iconv'

./configure: line 11745: `      AC_LIB_LINKFLAGS_BODY(iconv)'

I have built and installed the libiconv from here.

How can I fix this?

The lines 11739 to 11745 in the configure file looks like this:


I ended up getting the tarball from here http://sourceforge.net/projects/libmtp/files/libmtp/1.1.4/libmtp-1.1.4.tar.gz/download

then the package compiled without hassle.

had both iconv and gettext installed as detailed on GNU site.

| improve this answer | |
apt-get install gettext
./autogen.sh # this is the critical bit
| improve this answer | |
  • Yes, that helped me, too. On Fedora: yum install gettext gettext-devel. Thanks a lot. – jogojapan Aug 24 '15 at 13:07
  • There is no autogen.sh in the libusb tarball downloaded from sourceforge... – Wizard79 Mar 19 '19 at 15:18

Hm... seems like there is a problem with the iconv installation. Could you take a look at this document and search for "iconv.m4"? There is a little section on how to use it with autotools.

Also, did you make sure that gettext is installed? (it should be)

sudo apt-get install gettext


| improve this answer | |

Okay, I struggled with this for a few hours so I thought I'd share what I did to get the git install of libmtp to build.

The secret is to be sure to follow all of the instructions on the GNU libiconv page:



first libiconv, then gettext, then libiconv again,

This got the configure script for libmtp to run, but it didn't find iconv to be usable. Thus during make you would get something like:

libmtp.c: In function 'LIBMTP_Open_Raw_Device_Uncached':
libmtp.c:1854:17: error: 'PTPParams' has no member named 'cd_locale_to_ucs2'
libmtp.c:1854:3: warning: implicit declaration of function 'iconv_open' [-Wimplicit-> function-declaration]

To fix that:

$ export LD_PRELOAD=/usr/local/lib/preloadable_libiconv.so

Then it built just fine.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.