Bug 738

Summary: libsigrok fails to build on NetBSD
Product: libsigrok Reporter: Martijn van Buul <martijn.van.buul>
Component: Bindings: C++Assignee: Nobody <nobody>
Status: CONFIRMED ---    
Severity: major    
Priority: Normal    
Version: unreleased development snapshot   
Target Milestone: ---   
Hardware: x86   
OS: Other   
Attachments: C++ file triggering the same error.

Description Martijn van Buul 2016-01-26 21:26:31 CET
Created attachment 218 [details]
C++ file triggering the same error.

While trying to port libsigrok to NetBSD, I stumbled across the following compile error in bindings/cxx/classes.cpp:

In file included from /usr/pkgobj/wip/libsigrok-git/work/.buildlink/include/glibmm-2.4/glibmm/unicode.h:28:0,
                 from /usr/pkgobj/wip/libsigrok-git/work/.buildlink/include/glibmm-2.4/glibmm/ustring.h:25,
                 from /usr/pkgobj/wip/libsigrok-git/work/.buildlink/include/glibmm-2.4/glibmm/exception.h:25,
                 from /usr/pkgobj/wip/libsigrok-git/work/.buildlink/include/glibmm-2.4/glibmm/error.h:23,
                 from /usr/pkgobj/wip/libsigrok-git/work/.buildlink/include/glibmm-2.4/glibmm/thread.h:56,
                 from /usr/pkgobj/wip/libsigrok-git/work/.buildlink/include/glibmm-2.4/glibmm.h:87,
                 from bindings/cxx/include/libsigrokcxx/libsigrokcxx.hpp:78,
                 from bindings/cxx/classes.cpp:26:
/usr/include/g++/cctype:87:11: error: '::isblank' has not been declared
   using ::isblank;
           ^
In file included from /usr/include/g++/ext/string_conversions.h:43:0,
                 from /usr/include/g++/bits/basic_string.h:2815,
                 from /usr/include/g++/string:52,
                 from /usr/include/g++/bits/locale_classes.h:40,
                 from /usr/include/g++/bits/ios_base.h:41,
                 from /usr/include/g++/ios:42,
                 from /usr/include/g++/ostream:38,
                 from /usr/include/g++/iterator:64,
                 from /usr/pkgobj/wip/libsigrok-git/work/.buildlink/include/glibmm-2.4/glibmm/ustring.h:29,
                 from /usr/pkgobj/wip/libsigrok-git/work/.buildlink/include/glibmm-2.4/glibmm/exception.h:25,
                 from /usr/pkgobj/wip/libsigrok-git/work/.buildlink/include/glibmm-2.4/glibmm/error.h:23,
                 from /usr/pkgobj/wip/libsigrok-git/work/.buildlink/include/glibmm-2.4/glibmm/thread.h:56,
                 from /usr/pkgobj/wip/libsigrok-git/work/.buildlink/include/glibmm-2.4/glibmm.h:87,
                 from bindings/cxx/include/libsigrokcxx/libsigrokcxx.hpp:78,
                 from bindings/cxx/classes.cpp:26:
/usr/include/g++/cstdio:169:11: error: '::vfscanf' has not been declared
   using ::vfscanf;
           ^
/usr/include/g++/cstdio:170:11: error: '::vscanf' has not been declared
   using ::vscanf;
           ^
/usr/include/g++/cstdio:172:11: error: '::vsscanf' has not been declared
   using ::vsscanf;
           ^
/usr/include/g++/cstdio:179:22: error: '__gnu_cxx::vfscanf' has not been declared
   using ::__gnu_cxx::vfscanf;
                      ^
/usr/include/g++/cstdio:180:22: error: '__gnu_cxx::vscanf' has not been declared
   using ::__gnu_cxx::vscanf;
                      ^
/usr/include/g++/cstdio:182:22: error: '__gnu_cxx::vsscanf' has not been declared
   using ::__gnu_cxx::vsscanf;
                      ^
In file included from /usr/include/g++/random:38:0,
                 from /usr/include/g++/bits/stl_algo.h:65,
                 from /usr/include/g++/algorithm:62,
                 from /usr/pkgobj/wip/libsigrok-git/work/.buildlink/include/glibmm-2.4/glibmm/containerhandle_shared.h:31,
                 from /usr/pkgobj/wip/libsigrok-git/work/.buildlink/include/glibmm-2.4/glibmm/arrayhandle.h:23,
                 from /usr/pkgobj/wip/libsigrok-git/work/.buildlink/include/glibmm-2.4/glibmm.h:91,
                 from bindings/cxx/include/libsigrokcxx/libsigrokcxx.hpp:78,
                 from bindings/cxx/classes.cpp:26:
/usr/include/g++/cmath:1037:11: error: '::double_t' has not been declared
   using ::double_t;
           ^
/usr/include/g++/cmath:1038:11: error: '::float_t' has not been declared
   using ::float_t;
           ^
/usr/include/g++/cmath:1057:11: error: '::copysign' has not been declared
   using ::copysign;
           ^
/usr/include/g++/cmath:1165:11: error: '::scalbln' has not been declared
   using ::scalbln;
           ^
/usr/include/g++/cmath:1169:11: error: '::scalbn' has not been declared
   using ::scalbn;
           ^
*** [bindings/cxx/classes.lo] Error code 1

I have narrowed this down to a small test file, attached below. This file compiles just fine using Ubuntu 14.10 (gcc 4.8.4, glibmm 2.39.93-0ubuntu1), but not using NetBSD 7.0 (gcc 4.8.4, glibmm 2.44.0).

There is a workaround: After removing the two #defines, the test code compiles cleanly on NetBSD.