按照这些说明解决libmtp
问题...
https://askubuntu.com/a/886986/296836
...我收到这些错误...
../src/.libs/libmtp.so: undefined reference to `usb_claim_interface'
../src/.libs/libmtp.so: undefined reference to `usb_get_string_simple'
../src/.libs/libmtp.so: undefined reference to `usb_detach_kernel_driver_np'
../src/.libs/libmtp.so: undefined reference to `usb_get_descriptor'
../src/.libs/libmtp.so: undefined reference to `usb_get_busses'
collect2: error: ld returned 1 exit status
Makefile:506: recipe for target 'mtp-connect' failed
make[2]: *** [mtp-connect] Error 1
make[2]: Leaving directory '/tmp/mozilla_hasan0/libmtp-1.1.15/examples'
Makefile:526: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/tmp/mozilla_hasan0/libmtp-1.1.15'
Makefile:389: recipe for target 'all' failed
make: *** [all] Error 2
指示的步骤是:
sudo apt-get install build-essential
./configure --prefix=/usr
make
make
来自 JavaScript/Python 生态系统,我对and的经验很少configure
,因此非常感谢任何帮助。
这是一个明显的错误吗?我能做些什么来追查原因?
完整的日志在下面...
完整日志:
./configure --prefix=/usr
you@tornado:/tmp/mozilla_you0/libmtp-1.1.15$ ./configure --prefix=/usr
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking whether ln -s works... yes
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking how to print strings... printf
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for fgrep... /bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking the maximum length of command line arguments... 1572864
checking how to convert x86_64-pc-linux-gnu file names to x86_64-pc-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-pc-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... dlltool
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for a working dd... /bin/dd
checking how to truncate binary pipes... /bin/dd bs=4096 count=1
checking for mt... mt
checking if mt is a manifest tool... no
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking for ld used by gcc... /usr/bin/ld -m elf_x86_64
checking if the linker (/usr/bin/ld -m elf_x86_64) is GNU ld... yes
checking for shared library run path origin... done
checking for iconv... yes
checking for working iconv... yes
checking for iconv declaration...
extern size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
checking for doxygen... false
checking if the host operating system is Darwin... no
checking if the host operating system is Linux... yes
checking For MinGW32... no
checking for pkg-config... no
checking for libusb-1.0 >= 1.0.0... no
checking for openusb_init in -lopenusb... no
checking for libusb >= 0.1.8... no
checking for usb_open in -lusb... yes
checking for libgcrypt... checking for gcry_check_version in -lgcrypt... no
configure: *** libgcrypt not found - disabling MTPZ support ***
configure: MTPZ functionality disable
configure: *** using libusb 0.1 ***
checking for ANSI C header files... (cached) yes
checking whether time.h and sys/time.h may both be included... yes
checking ctype.h usability... yes
checking ctype.h presence... yes
checking for ctype.h... yes
checking errno.h usability... yes
checking errno.h presence... yes
checking for errno.h... yes
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking getopt.h usability... yes
checking getopt.h presence... yes
checking for getopt.h... yes
checking libgen.h usability... yes
checking libgen.h presence... yes
checking for libgen.h... yes
checking limits.h usability... yes
checking limits.h presence... yes
checking for limits.h... yes
checking stdio.h usability... yes
checking stdio.h presence... yes
checking for stdio.h... yes
checking for string.h... (cached) yes
checking for sys/stat.h... (cached) yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking for unistd.h... (cached) yes
checking langinfo.h usability... yes
checking langinfo.h presence... yes
checking for langinfo.h... yes
checking locale.h usability... yes
checking locale.h presence... yes
checking for locale.h... yes
checking arpa/inet.h usability... yes
checking arpa/inet.h presence... yes
checking for arpa/inet.h... yes
checking byteswap.h usability... yes
checking byteswap.h presence... yes
checking for byteswap.h... yes
checking sys/uio.h usability... yes
checking sys/uio.h presence... yes
checking for sys/uio.h... yes
checking for an ANSI C-conforming const... yes
checking for off_t... yes
checking return type of signal handlers... void
checking for size_t... yes
checking for struct stat.st_blksize... yes
checking for working memcmp... yes
checking whether lstat correctly handles trailing slash... yes
checking whether stat accepts an empty string... no
checking for basename... yes
checking for memset... yes
checking for select... yes
checking for strdup... yes
checking for strerror... yes
checking for strndup... yes
checking for strrchr... yes
checking for strtoul... yes
checking for usleep... yes
checking for mkstemp... yes
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... no
checking for uint8_t in stdint.h... yes
checking whether byte ordering is bigendian... no
checking for le32toh in machine/endian.h... no
checking for ntohl in arpa/inet.h... yes
checking for swap32 in machine/endian.h... no
checking for bswap_32 in byteswap.h... yes
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating src/libmtp.h
config.status: creating doc/Doxyfile
config.status: creating Makefile
config.status: creating doc/Makefile
config.status: creating src/Makefile
config.status: creating examples/Makefile
config.status: creating util/Makefile
config.status: creating libmtp.sh
config.status: creating hotplug.sh
config.status: creating libmtp.pc
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles commands
config.status: executing libtool commands
you@tornado:/tmp/mozilla_you0/libmtp-1.1.15$
you@tornado:/tmp/mozilla_you0/libmtp-1.1.15$
make
you@tornado:/tmp/mozilla_you0/libmtp-1.1.15$
you@tornado:/tmp/mozilla_you0/libmtp-1.1.15$ make
make all-recursive
make[1]: Entering directory '/tmp/mozilla_hasan0/libmtp-1.1.15'
Making all in src
make[2]: Entering directory '/tmp/mozilla_hasan0/libmtp-1.1.15/src'
/bin/bash ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I.. -g -O2 -Wall -Wmissing-prototypes -MT libmtp_la-libmtp.lo -MD -MP -MF .deps/libmtp_la-libmtp.Tpo -c -o libmtp_la-libmtp.lo `test -f 'libmtp.c' || echo './'`libmtp.c
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -g -O2 -Wall -Wmissing-prototypes -MT libmtp_la-libmtp.lo -MD -MP -MF .deps/libmtp_la-libmtp.Tpo -c libmtp.c -fPIC -DPIC -o .libs/libmtp_la-libmtp.o
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -g -O2 -Wall -Wmissing-prototypes -MT libmtp_la-libmtp.lo -MD -MP -MF .deps/libmtp_la-libmtp.Tpo -c libmtp.c -o libmtp_la-libmtp.o >/dev/null 2>&1
mv -f .deps/libmtp_la-libmtp.Tpo .deps/libmtp_la-libmtp.Plo
/bin/bash ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I.. -g -O2 -Wall -Wmissing-prototypes -MT libmtp_la-unicode.lo -MD -MP -MF .deps/libmtp_la-unicode.Tpo -c -o libmtp_la-unicode.lo `test -f 'unicode.c' || echo './'`unicode.c
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -g -O2 -Wall -Wmissing-prototypes -MT libmtp_la-unicode.lo -MD -MP -MF .deps/libmtp_la-unicode.Tpo -c unicode.c -fPIC -DPIC -o .libs/libmtp_la-unicode.o
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -g -O2 -Wall -Wmissing-prototypes -MT libmtp_la-unicode.lo -MD -MP -MF .deps/libmtp_la-unicode.Tpo -c unicode.c -o libmtp_la-unicode.o >/dev/null 2>&1
mv -f .deps/libmtp_la-unicode.Tpo .deps/libmtp_la-unicode.Plo
/bin/bash ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I.. -g -O2 -Wall -Wmissing-prototypes -MT libmtp_la-util.lo -MD -MP -MF .deps/libmtp_la-util.Tpo -c -o libmtp_la-util.lo `test -f 'util.c' || echo './'`util.c
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -g -O2 -Wall -Wmissing-prototypes -MT libmtp_la-util.lo -MD -MP -MF .deps/libmtp_la-util.Tpo -c util.c -fPIC -DPIC -o .libs/libmtp_la-util.o
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -g -O2 -Wall -Wmissing-prototypes -MT libmtp_la-util.lo -MD -MP -MF .deps/libmtp_la-util.Tpo -c util.c -o libmtp_la-util.o >/dev/null 2>&1
mv -f .deps/libmtp_la-util.Tpo .deps/libmtp_la-util.Plo
/bin/bash ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I.. -g -O2 -Wall -Wmissing-prototypes -MT libmtp_la-playlist-spl.lo -MD -MP -MF .deps/libmtp_la-playlist-spl.Tpo -c -o libmtp_la-playlist-spl.lo `test -f 'playlist-spl.c' || echo './'`playlist-spl.c
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -g -O2 -Wall -Wmissing-prototypes -MT libmtp_la-playlist-spl.lo -MD -MP -MF .deps/libmtp_la-playlist-spl.Tpo -c playlist-spl.c -fPIC -DPIC -o .libs/libmtp_la-playlist-spl.o
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -g -O2 -Wall -Wmissing-prototypes -MT libmtp_la-playlist-spl.lo -MD -MP -MF .deps/libmtp_la-playlist-spl.Tpo -c playlist-spl.c -o libmtp_la-playlist-spl.o >/dev/null 2>&1
mv -f .deps/libmtp_la-playlist-spl.Tpo .deps/libmtp_la-playlist-spl.Plo
/bin/bash ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I.. -g -O2 -Wall -Wmissing-prototypes -MT libmtp_la-ptp.lo -MD -MP -MF .deps/libmtp_la-ptp.Tpo -c -o libmtp_la-ptp.lo `test -f 'ptp.c' || echo './'`ptp.c
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -g -O2 -Wall -Wmissing-prototypes -MT libmtp_la-ptp.lo -MD -MP -MF .deps/libmtp_la-ptp.Tpo -c ptp.c -fPIC -DPIC -o .libs/libmtp_la-ptp.o
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -g -O2 -Wall -Wmissing-prototypes -MT libmtp_la-ptp.lo -MD -MP -MF .deps/libmtp_la-ptp.Tpo -c ptp.c -o libmtp_la-ptp.o >/dev/null 2>&1
mv -f .deps/libmtp_la-ptp.Tpo .deps/libmtp_la-ptp.Plo
/bin/bash ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I.. -g -O2 -Wall -Wmissing-prototypes -MT libmtp_la-libusb-glue.lo -MD -MP -MF .deps/libmtp_la-libusb-glue.Tpo -c -o libmtp_la-libusb-glue.lo `test -f 'libusb-glue.c' || echo './'`libusb-glue.c
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -g -O2 -Wall -Wmissing-prototypes -MT libmtp_la-libusb-glue.lo -MD -MP -MF .deps/libmtp_la-libusb-glue.Tpo -c libusb-glue.c -fPIC -DPIC -o .libs/libmtp_la-libusb-glue.o
libusb-glue.c: In function ‘dump_usbinfo’:
libusb-glue.c:706:7: warning: variable ‘res’ set but not used [-Wunused-but-set-variable]
int res;
^~~
At top level:
libusb-glue.c:1815:13: warning: ‘clear_halt’ defined but not used [-Wunused-function]
static void clear_halt(PTP_USB* ptp_usb)
^~~~~~~~~~
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -g -O2 -Wall -Wmissing-prototypes -MT libmtp_la-libusb-glue.lo -MD -MP -MF .deps/libmtp_la-libusb-glue.Tpo -c libusb-glue.c -o libmtp_la-libusb-glue.o >/dev/null 2>&1
mv -f .deps/libmtp_la-libusb-glue.Tpo .deps/libmtp_la-libusb-glue.Plo
/bin/bash ../libtool --tag=CC --mode=link gcc -g -O2 -Wall -Wmissing-prototypes -no-undefined -export-symbols ./libmtp.sym -version-info 13:0:4 -o libmtp.la -rpath /usr/lib libmtp_la-libmtp.lo libmtp_la-unicode.lo libmtp_la-util.lo libmtp_la-playlist-spl.lo libmtp_la-ptp.lo libmtp_la-libusb-glue.lo
libtool: link: rm -fr .libs/libmtp.a .libs/libmtp.la .libs/libmtp.lai .libs/libmtp.so .libs/libmtp.so.9 .libs/libmtp.so.9.4.0 .libs/libmtp.ver
libtool: link: echo "{ global:" > .libs/libmtp.ver
libtool: link: cat ./libmtp.sym | sed -e "s/\(.*\)/\1;/" >> .libs/libmtp.ver
libtool: link: echo "local: *; };" >> .libs/libmtp.ver
libtool: link: gcc -shared -fPIC -DPIC .libs/libmtp_la-libmtp.o .libs/libmtp_la-unicode.o .libs/libmtp_la-util.o .libs/libmtp_la-playlist-spl.o .libs/libmtp_la-ptp.o .libs/libmtp_la-libusb-glue.o -g -O2 -Wl,-soname -Wl,libmtp.so.9 -Wl,-version-script -Wl,.libs/libmtp.ver -o .libs/libmtp.so.9.4.0
libtool: link: (cd ".libs" && rm -f "libmtp.so.9" && ln -s "libmtp.so.9.4.0" "libmtp.so.9")
libtool: link: (cd ".libs" && rm -f "libmtp.so" && ln -s "libmtp.so.9.4.0" "libmtp.so")
libtool: link: ar cru .libs/libmtp.a libmtp_la-libmtp.o libmtp_la-unicode.o libmtp_la-util.o libmtp_la-playlist-spl.o libmtp_la-ptp.o libmtp_la-libusb-glue.o
ar: `u' modifier ignored since `D' is the default (see `U')
libtool: link: ranlib .libs/libmtp.a
libtool: link: ( cd ".libs" && rm -f "libmtp.la" && ln -s "../libmtp.la" "libmtp.la" )
make[2]: Leaving directory '/tmp/mozilla_hasan0/libmtp-1.1.15/src'
Making all in examples
make[2]: Entering directory '/tmp/mozilla_hasan0/libmtp-1.1.15/examples'
gcc -DHAVE_CONFIG_H -I. -I.. -I../src -g -O2 -Wall -Wmissing-prototypes -MT connect.o -MD -MP -MF .deps/connect.Tpo -c -o connect.o connect.c
mv -f .deps/connect.Tpo .deps/connect.Po
gcc -DHAVE_CONFIG_H -I. -I.. -I../src -g -O2 -Wall -Wmissing-prototypes -MT delfile.o -MD -MP -MF .deps/delfile.Tpo -c -o delfile.o delfile.c
mv -f .deps/delfile.Tpo .deps/delfile.Po
gcc -DHAVE_CONFIG_H -I. -I.. -I../src -g -O2 -Wall -Wmissing-prototypes -MT getfile.o -MD -MP -MF .deps/getfile.Tpo -c -o getfile.o getfile.c
mv -f .deps/getfile.Tpo .deps/getfile.Po
gcc -DHAVE_CONFIG_H -I. -I.. -I../src -g -O2 -Wall -Wmissing-prototypes -MT newfolder.o -MD -MP -MF .deps/newfolder.Tpo -c -o newfolder.o newfolder.c
mv -f .deps/newfolder.Tpo .deps/newfolder.Po
gcc -DHAVE_CONFIG_H -I. -I.. -I../src -g -O2 -Wall -Wmissing-prototypes -MT sendfile.o -MD -MP -MF .deps/sendfile.Tpo -c -o sendfile.o sendfile.c
mv -f .deps/sendfile.Tpo .deps/sendfile.Po
gcc -DHAVE_CONFIG_H -I. -I.. -I../src -g -O2 -Wall -Wmissing-prototypes -MT sendtr.o -MD -MP -MF .deps/sendtr.Tpo -c -o sendtr.o sendtr.c
mv -f .deps/sendtr.Tpo .deps/sendtr.Po
gcc -DHAVE_CONFIG_H -I. -I.. -I../src -g -O2 -Wall -Wmissing-prototypes -MT pathutils.o -MD -MP -MF .deps/pathutils.Tpo -c -o pathutils.o pathutils.c
pathutils.c: In function ‘progress’:
pathutils.c:122:24: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 2 has type ‘uint64_t {aka const long unsigned int}’ [-Wformat=]
printf("Progress: %llu of %llu (%d%%)\r", sent, total, percent);
~~~^
%lu
pathutils.c:122:32: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 3 has type ‘uint64_t {aka const long unsigned int}’ [-Wformat=]
printf("Progress: %llu of %llu (%d%%)\r", sent, total, percent);
~~~^
%lu
mv -f .deps/pathutils.Tpo .deps/pathutils.Po
/bin/bash ../libtool --tag=CC --mode=link gcc -g -O2 -Wall -Wmissing-prototypes -o mtp-connect connect.o delfile.o getfile.o newfolder.o sendfile.o sendtr.o pathutils.o util.o ../src/libmtp.la
libtool: link: gcc -g -O2 -Wall -Wmissing-prototypes -o .libs/mtp-connect connect.o delfile.o getfile.o newfolder.o sendfile.o sendtr.o pathutils.o util.o ../src/.libs/libmtp.so
../src/.libs/libmtp.so: undefined reference to `usb_get_driver_np'
../src/.libs/libmtp.so: undefined reference to `usb_find_busses'
../src/.libs/libmtp.so: undefined reference to `usb_release_interface'
../src/.libs/libmtp.so: undefined reference to `usb_reset'
../src/.libs/libmtp.so: undefined reference to `usb_clear_halt'
../src/.libs/libmtp.so: undefined reference to `usb_find_devices'
../src/.libs/libmtp.so: undefined reference to `usb_set_configuration'
../src/.libs/libmtp.so: undefined reference to `usb_close'
../src/.libs/libmtp.so: undefined reference to `usb_device'
../src/.libs/libmtp.so: undefined reference to `usb_resetep'
../src/.libs/libmtp.so: undefined reference to `usb_control_msg'
../src/.libs/libmtp.so: undefined reference to `usb_bulk_write'
../src/.libs/libmtp.so: undefined reference to `usb_bulk_read'
../src/.libs/libmtp.so: undefined reference to `usb_init'
../src/.libs/libmtp.so: undefined reference to `usb_set_debug'
../src/.libs/libmtp.so: undefined reference to `usb_open'
../src/.libs/libmtp.so: undefined reference to `usb_claim_interface'
../src/.libs/libmtp.so: undefined reference to `usb_get_string_simple'
../src/.libs/libmtp.so: undefined reference to `usb_detach_kernel_driver_np'
../src/.libs/libmtp.so: undefined reference to `usb_get_descriptor'
../src/.libs/libmtp.so: undefined reference to `usb_get_busses'
collect2: error: ld returned 1 exit status
Makefile:506: recipe for target 'mtp-connect' failed
make[2]: *** [mtp-connect] Error 1
make[2]: Leaving directory '/tmp/mozilla_hasan0/libmtp-1.1.15/examples'
Makefile:526: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/tmp/mozilla_hasan0/libmtp-1.1.15'
Makefile:389: recipe for target 'all' failed
make: *** [all] Error 2
you@tornado:/tmp/mozilla_you0/libmtp-1.1.15$
这或多或少是一个幸运的猜测,恰好解决了这个问题。
./configure
从日志中跳出来的两件事是:虽然不一定是问题,但
pkg-config
构建系统经常使用它来定位头文件、库和链接选项。可能是构建软件所需的一切都已经安装在您的系统上,但是./configure
如果没有 ; 的帮助,脚本找不到它pkg-config
。和
这很奇怪,因为 Ubuntu 18.04 应该分别提供
libusb-1.0-0-dev
版本1.0.21
和libusb-dev
版本0.1.12
。如上所述,这可能是因为脚本在没有 帮助的情况下无法找到它们pkg-config
,或者可能是因为您的系统上尚未安装开发包。无论哪种方式,尝试安装所有三个软件包都不会造成伤害:
然后从头开始。