Bug #2419
closedwscript misdetects availability of functions for conditional compilation (getpass, setegid, ...)
100%
Description
The test program generated by waf for getpass
is:
#include <unistd.h>
int main(int argc, char **argv) {
void *p;
(void)argc; (void)argv;
p=(void*)(getpass);
return 0;
}
which fails to compile with our debug CXXFLAGS due to the presence of -Werror
:
['/usr/bin/g++', '-pedantic', '-Wall', '-O0', '-g3', '-Werror', '-Wno-error=maybe-uninitialized', '-Og', '-fdiagnostics-color', '-std=c++11', '-D_DEBUG', '-DHAVE_IS_DEFAULT_CONSTRUCTIBLE=1', '-DHAVE_IS_MOVE_CONSTRUCTIBLE=1', '-DHAVE_IS_MOVE_ASSIGNABLE=1', '-DHAVE_CXX_FRIEND_TYPENAME=1', '-DHAVE_PTHREAD=1', '-DHAVE_RT=1', '../test.cpp', '-c', '-o', '/home/davide/ndn-cxx/build/.conf_check_cb65f796106d255f157c14cc65e54028/testbuild/test.cpp.1.o']
err: ../test.cpp: In function ‘int main(int, char**)’:
../test.cpp:4:8: error: variable ‘p’ set but not used [-Werror=unused-but-set-variable]
void *p;
^
cc1plus: all warnings being treated as errors
This is a regression introduced in commit a2ada22022bc8aebc5c4b36753ee5935443f480c
Updated by Alex Afanasyev almost 10 years ago
oh... Will take care, though not exactly sure. Either detection should happen before we set default flags or code snippet should be fixed.
Updated by Alex Afanasyev almost 10 years ago
- Status changed from New to Code review
- % Done changed from 0 to 100
Updated by Alex Afanasyev almost 10 years ago
Updated waf using a custom fork: https://github.com/cawka/waf
Updated by Alex Afanasyev almost 10 years ago
- Status changed from Code review to Closed
Updated by Alex Afanasyev almost 10 years ago
- Subject changed from wscript misdetects availability of getpass to wscript misdetects availability of functions for conditional compilation (getpass, setegid, ...)
- Status changed from Closed to In Progress
I'm reopening this, as now we have problem with setegid on Ubuntu 14.04 in debug mode:
Checking for function setegid
==>
#include <unistd.h>
#include <pwd.h>
#include <grp.h>
int main(int argc, char **argv) {
void *p;
(void)argc; (void)argv;
p=(void*)(setegid);
((void)(p));
return 0;
}
<==
[1/2] Compiling ^[[32mbuild/.conf_check_0f1c398112a4679aa11804895503cb18/test.cpp^[[0m
['/usr/bin/g++', '-pedantic', '-Wall', '-O0', '-g3', '-Werror', '-Wno-error=maybe-uninitialized', '-Og', '-std=c++11', '-D_DEBUG', '-DHAVE_IS_DEFAULT_CONSTRUCTIBLE=1', '-DHAVE_IS_MOVE_CONSTRUCTIBLE=1', '-DHAVE_CXX_OVERRIDE=1', '-DHAVE_LIBRT=1', '-DHAVE_LIBRESOLV=1', '-DHAVE_IFADDRS_H=1', '../test.cpp', '-c', '-o', '/home/vagrant/NFD/build/.conf_check_0f1c398112a4679aa11804895503cb18/testbuild/test.cpp.1.o']
err: ../test.cpp: In function ‘int main(int, char**)’:
../test.cpp:8:19: error: ISO C++ forbids casting between pointer-to-function and pointer-to-object [-Werror]
p=(void*)(setegid);
^
cc1plus: all warnings being treated as errors
Updated by Alex Afanasyev almost 10 years ago
And actually, the original problem still exist, but with a different error (the one in note-6).
Updated by Alex Afanasyev almost 10 years ago
I guess, I'll have to write a snippet manually then..
Updated by Davide Pesavento almost 10 years ago
How about appending -Wno-error
to those checks instead? If it comes last it should override any previous -Werror
.
Updated by Alex Afanasyev almost 10 years ago
May be, though I think adding the explicit code snippet is safer option and provides better guarantees for the detection (it can check actual usage, not just presence of a symbol)
Updated by Alex Afanasyev almost 10 years ago
- Status changed from In Progress to Code review
I verified my new solutions for ndn-cxx and NFD on Ubuntu 14.04 (gcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2)
Updated by Junxiao Shi almost 10 years ago
Given that commit:8fbcfc50b60317a5e5381e8a3fcd17dbdfb0fbd5 is bad, should we revert the change of waf
binary?
Another problem is exposed by this "misdetect": four test cases in MgmtGeneralConfigSection
test suite needs conditional compilation, because they invoke PrivilegeHelper::initialize()
. see https://travis-ci.org/yoursunny/ndn-cxx-breaks/jobs/48707441
Updated by Alex Afanasyev almost 10 years ago
There are some other updates in waf, so there is no much value in reverting. When updating next time, I will remove the applied patch.
Updated by Alex Afanasyev almost 10 years ago
Another problem is exposed by this "misdetect": four test cases in
MgmtGeneralConfigSection
test suite needs conditional compilation, because they invokePrivilegeHelper::initialize()
. see https://travis-ci.org/yoursunny/ndn-cxx-breaks/jobs/48707441
Should it be fixed as part of this issue? Or somebody needs to create a new one?
Updated by Alex Afanasyev almost 10 years ago
- Has duplicate Bug #2448: waf does not find setegid when configured in debug mode in Ubuntu 14.04 added
Updated by Alex Afanasyev almost 10 years ago
- Status changed from Code review to Closed
Updated by Alex Afanasyev almost 10 years ago
- Status changed from Closed to In Progress
Have to reopen this again. I put wrong conditionals... ifndef's insteaf of ifdef's....
Updated by Alex Afanasyev almost 10 years ago
- Status changed from In Progress to Closed
Updated by Davide Pesavento over 7 years ago
- Related to Bug #4157: ndnsec-export: confusing error message when getpass is unavailable added
Updated by Davide Pesavento over 7 years ago
- Related to Bug #4296: Xcode >= 9.0 triggers -Wundefined-func-template warnings/errors in boost headers added