janoc/libndofdev

libexplain linking errors

Techwolf opened this issue · 5 comments

When building the libndofdev, a gcc warning occures:

cc -march=native -O2 -pipe -ggdb -c -o ndofdev.o ndofdev.c
ndofdev.c: In function ‘ndof_init_first’:
ndofdev.c:159:13: warning: format ‘%s’ expects argument of type ‘char *’, but argument 3 has type ‘int’ [-Wformat=]
fprintf(stderr, "%s\n", explain_ioctl(fd, EVIOCGBIT(EV_REL, sizeof evtype_mask), evtype_mask));

This warning later turns into linking errors when building the secondlife client.

janoc commented

Don't have a Linux machine on hand right now, but explain_ioctl() returns const char* according to the manpage, not int: http://manpages.ubuntu.com/manpages/precise/man3/explain_ioctl.3.html
What does it return on your system?

This sounds like a bogus warning to me. Which compiler/libraries are you building this with?
Also, don't build with -Werror, that will avoid that linking error later caused by spurious warnings.

The warning pops up when libexplain is NOT installed in the system. The secondlife client will fail to build due to missing -lexplain, a new dependency. Another user found this problem before I did. I worked around it, Techwolf/techwolf-overlay@3084d3e after filing this bug report. And now seeing I forgot someinfo....libexplain was not installed on the system. Whoops...my bad.

Also, the secondlife client build with that gcc flag, I did NOT set it, the secondlife build system does that.
Update: Wait a minute......check his overlay....
Yep, I set this: # LL like to break code from time to time
mycmakeargs="${mycmakeargs} -DGCC_DISABLE_FATAL_WARNINGS:BOOL=TRUE"

This is what I get when building the secondlife client:

Linking CXX executable firestorm-bin
Verifying message template - See http://wiki.secondlife.com/wiki/Template_verifier.py
master: http://bitbucket.org/lindenlab/master-message-template/raw/tip/message_template.msg
current: /var/tmp/portage/games-simulation/firestorm-hg-22/work/linden/scripts/messages/message_template.msg
Message template SHA_1 has not changed.
/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/../../../../lib64/libcollada14dom.a(daeUtils.o): In function `cdom::getRandomFileName()':
/var/tmp/portage/media-libs/llcolladadom-hg-3/work/llcolladadom-hg-3/src/dae/daeUtils.cpp:171: warning: the use of `tmpnam' is dangerous, better use `mkstemp'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/../../../../lib64/libndofdev.a(ndofdev.o): In function `ndof_init_first':
/var/tmp/portage/dev-libs/libndofdev-0.6/work/libndofdev-0.5/ndofdev.c:159: undefined reference to `explain_ioctl'
collect2: error: ld returned 1 exit status
newview/CMakeFiles/firestorm-bin.dir/build.make:18077: recipe for target 'newview/firestorm-bin' failed
make[2]: *** [newview/firestorm-bin] Error 1
CMakeFiles/Makefile2:1727: recipe for target 'newview/CMakeFiles/firestorm-bin.dir/all' failed
make[1]: *** [newview/CMakeFiles/firestorm-bin.dir/all] Error 2
Makefile:75: recipe for target 'all' failed
make: *** [all] Error 2
janoc commented

Ah but that is a different thing, not really caused by the warning. It seems that the viewer's lacks the libexplain library while linking.

On the other hand, that shouldn't really be needed - it seems it got picked up with the last patch I got contributed. It also misses the header file for explain_ioctl() - that would explain the warning too, because the compiler doesn't see the prototype and assumes int as the default return type.

Good catch, I will remove this dependency - it really isn't needed.