Bug 96900

Summary: Failing build with `undefined reference to `udev_device_get_is_initialized'`
Product: Wayland Reporter: Paul Menzel <pmenzel+bugs.freedesktop.org>
Component: libinputAssignee: Wayland bug list <wayland-bugs>
Status: RESOLVED INVALID QA Contact:
Severity: normal    
Priority: medium CC: peter.hutterer
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Paul Menzel 2016-07-12 14:20:42 UTC
Building libinput 1.3.3 fails with the error below.

```
$ /dev/shm/bee-root/libinput/libinput-1.3.3-0/source/configure --prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --libexecdir=/usr/libexec --sysconfdir=/etc --sharedstatedir=/var --localstatedir=/var --libdir=/usr/lib --includedir=/usr/include --datarootdir=/usr/share --datadir=/usr/share --infodir=/usr/share/info --localedir=/usr/share/locale --mandir=/usr/share/man --docdir=/usr/share/doc/libinput --exec-prefix=/usr --disable-static --with-udev-dir=/lib/udev
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 whether make supports nested variables... (cached) yes
checking for style of include used by make... GNU
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 dependency style of gcc... gcc3
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -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 minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking for gcc option to accept ISO C99... none needed
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
checking for grep that handles long lines and -e... (cached) /bin/grep
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking how to print strings... printf
checking for a sed that does not truncate output... /bin/sed
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 whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking how to convert x86_64-unknown-linux-gnu file names to x86_64-unknown-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-unknown-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... no
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... no
checking if : is a manifest tool... no
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... no
checking how to run the C++ preprocessor... g++ -E
checking for ld used by g++... /usr/bin/ld -m elf_x86_64
checking if the linker (/usr/bin/ld -m elf_x86_64) is GNU ld... yes
checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking for g++ option to produce PIC... -fPIC -DPIC
checking if g++ PIC flag -fPIC -DPIC works... yes
checking if g++ static flag -static works... yes
checking if g++ supports -c -o file.o... yes
checking if g++ supports -c -o file.o... (cached) yes
checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking dynamic linker characteristics... (cached) GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether EPOLL_CLOEXEC is declared... yes
checking whether TFD_CLOEXEC is declared... yes
checking whether CLOCK_MONOTONIC is declared... yes
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for MTDEV... yes
checking for LIBUDEV... yes
checking for LIBEVDEV... yes
checking for LIBUNWIND... no
checking for addr2line... /usr/bin/addr2line
checking for atan2 in -lm... yes
checking for clock_gettime in -lrt... yes
checking for doxygen... /usr/bin/doxygen
checking for compatible doxygen version... yes
checking for dot... /usr/bin/dot
checking for compatible dot version... yes
checking for CAIRO... yes
checking for GTK... yes
checking for CHECK... no
checking for LIBWACOM... yes
checking for sed... (cached) /bin/sed
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating doc/Makefile
config.status: creating doc/libinput.doxygen
config.status: creating src/Makefile
config.status: creating src/libinput.pc
config.status: creating src/libinput-version.h
config.status: creating test/Makefile
config.status: creating tools/Makefile
config.status: creating udev/Makefile
config.status: creating udev/80-libinput-device-groups.rules
config.status: creating udev/90-libinput-model-quirks.rules
config.status: creating test/symbols-leak-test
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing libtool commands

        Prefix                  /usr
        udev base dir           /lib/udev

        libwacom enabled        yes
        Build documentation     yes
        Build tests             no
        Tests use valgrind
        Tests use libunwind     no
        Build GUI event tool    yes
[…]
$ make V=1
[…]
/bin/sh ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I/dev/shm/bee-root/libinput/libinput-1.3.3-0/source/src -I..    -I/dev/shm/bee-root/libinput/libinput-1.3.3-0/source/include   -I/usr/include/libevdev-1.0/   -I/usr/include/libwacom-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include   -Wall -Wextra -Wno-unused-parameter -g -fvisibility=hidden -Wmissing-prototypes -Wstrict-prototypes -g -O2 -MT libinput_la-path.lo -MD -MP -MF .deps/libinput_la-path.Tpo -c -o libinput_la-path.lo `test -f 'path.c' || echo '/dev/shm/bee-root/libinput/libinput-1.3.3-0/source/src/'`path.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I/dev/shm/bee-root/libinput/libinput-1.3.3-0/source/src -I.. -I/dev/shm/bee-root/libinput/libinput-1.3.3-0/source/include -I/usr/include/libevdev-1.0/ -I/usr/include/libwacom-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -Wall -Wextra -Wno-unused-parameter -g -fvisibility=hidden -Wmissing-prototypes -Wstrict-prototypes -g -O2 -MT libinput_la-path.lo -MD -MP -MF .deps/libinput_la-path.Tpo -c /dev/shm/bee-root/libinput/libinput-1.3.3-0/source/src/path.c  -fPIC -DPIC -o .libs/libinput_la-path.o
/dev/shm/bee-root/libinput/libinput-1.3.3-0/source/src/path.c: In function ‘udev_device_from_devnode’:
/dev/shm/bee-root/libinput/libinput-1.3.3-0/source/src/path.c:309:17: warning: implicit declaration of function ‘udev_device_get_is_initialized’ [-Wimplicit-function-declaration]
  while (dev && !udev_device_get_is_initialized(dev)) {
                 ^
mv -f .deps/libinput_la-path.Tpo .deps/libinput_la-path.Plo
[…]
/bin/sh ../libtool  --tag=CC   --mode=link gcc  -g -O2   -o libinput-list-devices libinput_list_devices-libinput-list-devices.o ../src/libinput.la libshared.la -ludev   -lrt -lm 
libtool: link: gcc -g -O2 -o .libs/libinput-list-devices libinput_list_devices-libinput-list-devices.o  ../src/.libs/libinput.so -lmtdev -lwacom ./.libs/libshared.a -levdev -ludev -lrt -lm
../src/.libs/libinput.so: undefined reference to `udev_device_get_is_initialized'
collect2: error: ld returned 1 exit status
Makefile:567: recipe for target 'libinput-list-devices' failed
make[2]: *** [libinput-list-devices] Error 1
make[2]: Leaving directory '/dev/shm/bee-root/libinput/libinput-1.3.3-0/build/tools'
Makefile:431: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/dev/shm/bee-root/libinput/libinput-1.3.3-0/build'
Makefile:363: recipe for target 'all' failed
make: *** [all] Error 2
```
Comment 1 Peter Hutterer 2016-07-13 00:47:05 UTC
libudev.h is included in path.c and that function has been there for approximately forever. We add the udev cflags and libs to the makefile and it's present in your output ("-ludev"). Could this be a broken installation of libudev.so? I can't think of a reason why just that function would fail when it finds the libudev.h header and all other udev functions are fine.
Comment 2 Peter Hutterer 2016-07-17 22:13:26 UTC
ping?
Comment 3 Paul Menzel 2016-07-18 08:33:27 UTC
Dear Peter, thank you for your quick reply and sorry for my late one.

(In reply to Peter Hutterer from comment #1)
> libudev.h is included in path.c and that function has been there for
> approximately forever. We add the udev cflags and libs to the makefile and
> it's present in your output ("-ludev"). Could this be a broken installation
> of libudev.so? I can't think of a reason why just that function would fail
> when it finds the libudev.h header and all other udev functions are fine.

It is possible that udev versions are mixed up. I need some more time to investigate this. I’ll close the ticket until then.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.