Package: libapt-pkg-dev
Version: 1.8.4
Severity: normal
Hi,
apt-pkg headers pollute the preprocessor namespace, causing breakage in
unrelated libraries; for example, /usr/include/apt-pkg/error.h contains
the following line:
#define _error _GetErrorObj()
which is likely to cause errors in any other header that uses the token
"_error", even for internal interfaces. Unfortunately preprocessor macro
are always global, so it is important to have some discipline and avoid
defining macros for tokens that are easily used in other headers.
Please, try to avoid this definition, namespace it (for example renaming
it to "apt_pkg_error") or ensure it is undefined at each exit from the
public-facing headers in apt-pkg.
In the specific case, this library conflicts with Boost.Flyweight from
Boost 1.71 (not yet the default Boost version in Debian, but going to
become). You can see this happening if you install libboost1.71-dev from
unstable together with libapt-pkg-dev and try to compile this little C++
program:
> $ make test
> g++ test.cpp -o test
> In file included from test.cpp:1:
> /usr/include/boost/parameter/aux_/pack/make_arg_list.hpp:234:15: error: expected nested-name-specifier before ‘_GetErrorObj’
> 234 | using _error = ::boost::mp11::mp_if<
> | ^~~~~~
> /usr/include/boost/parameter/aux_/pack/make_arg_list.hpp:288:13: error: call to non-‘constexpr’ function ‘GlobalError* _GetErrorObj()’
> 288 | , _error
> | ^~~~~~
> In file included from /usr/include/boost/parameter/parameters.hpp:84,
> from /usr/include/boost/flyweight/detail/value_tag.hpp:17,
> from /usr/include/boost/flyweight/detail/default_value_policy.hpp:19,
> from /usr/include/boost/flyweight/flyweight.hpp:21,
> from /usr/include/boost/flyweight.hpp:16,
> from test.cpp:2:
> /usr/include/boost/parameter/aux_/pack/make_arg_list.hpp:290:9: error: type/value mismatch at argument 7 in template parameter list for ‘template<class List, class DeducedArgs, class TagFn, class IsPositional, class UsedArgs, class ArgumentPack, class Error, class EmitsErrors> struct boost::parameter::aux::make_arg_list_aux’
> 290 | >::type type;
> | ^
> /usr/include/boost/parameter/aux_/pack/make_arg_list.hpp:290:9: note: expected a type, got ‘_GetErrorObj()’
> make: *** [<incorporato>: test] Error 1
This will cause aptitude to FTBFS as soon as boost1.71 is made the
default Boost version, so please fix this as soon as possible.
This definition above is the only example I am aware of, but it might be
that there are others. Please, fix all of them, in the interest of
future compatibility.
Thanks, Giovanni.
--- System information. ---
Architecture: Kernel: Linux 5.4.0-1-amd64
Debian Release: bullseye/sid
500 xenial updates.signal.org 500 unstable-debug
debug.mirrors.debian.org 500 unstable deb.debian.org 500
testing deb.debian.org 500 stable repo.skype.com
500 stable dl.google.com 1 experimental deb.debian.org
--- Package information. ---
Depends (Version) | Installed
==========================-+-===========
libapt-inst (= 1.8.4) | libapt-pkg (= 1.8.4) | zlib1g-dev
|
Package's Recommends field is empty.
Package's Suggests field is empty.
--
Giovanni Mascellani <g.mascellani@gmail.com>
Postdoc researcher - Université Libre de Bruxelles
Attachment:
signature.asc
Description: OpenPGP digital signature