tizonia-openmax-il icon indicating copy to clipboard operation
tizonia-openmax-il copied to clipboard

[PATCH] Fix compilation error `tizchromecast.cpp:108:63: error: ‘_1’ was not declared in this scope`.

Open dreirund opened this issue 1 year ago • 0 comments

Ahoj,

Issue

Description

Building from source (using the Arch Linux AUR package "tizonia-all-git") fails for me with

[96/342] ccache c++ -Iclients/chromecast/libtizchromecast/src/libtizchromecast.so.0.22.0.p -Iclients/chromecast/libtizchromecast/src -I../tizonia-all-git/clients/chromecast/libtizchromecast/src -I/usr/include -I/usr/include/python3.10 -I/[...]/src/build -flto=auto -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wnon-virtual-dtor -O0 -DHAVE_CONFIG_H -include/[...]/src/build/config.h -DHAVE_LIBSPOTIFY -g0 -march=x86-64 -mtune=native -O3 -flto -ffat-lto-objects -pipe -fstack-protector --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2 -fomit-frame-pointer -fPIC -fpermissive -fPIC -pthread -DBOOST_CHRONO_DYN_LINK=1 -DBOOST_FILESYSTEM_DYN_LINK=1 -DBOOST_SYSTEM_DYN_LINK=1 -DBOOST_THREAD_BUILD_DLL=1 -DBOOST_THREAD_USE_DLL=1 -DBOOST_ALL_NO_LIB -MD -MQ clients/chromecast/libtizchromecast/src/libtizchromecast.so.0.22.0.p/tizchromecast.cpp.o -MF clients/chromecast/libtizchromecast/src/libtizchromecast.so.0.22.0.p/tizchromecast.cpp.o.d -o clients/chromecast/libtizchromecast/src/libtizchromecast.so.0.22.0.p/tizchromecast.cpp.o -c ../tizonia-all-git/clients/chromecast/libtizchromecast/src/tizchromecast.cpp
samu: job failed: ccache c++ -Iclients/chromecast/libtizchromecast/src/libtizchromecast.so.0.22.0.p -Iclients/chromecast/libtizchromecast/src -I../tizonia-all-git/clients/chromecast/libtizchromecast/src -I/usr/include -I/usr/include/python3.10 -I/[...]/src/build -flto=auto -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wnon-virtual-dtor -O0 -DHAVE_CONFIG_H -include/[...]/src/build/config.h -DHAVE_LIBSPOTIFY -g0 -march=x86-64 -mtune=native -O3 -flto -ffat-lto-objects -pipe -fstack-protector --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2 -fomit-frame-pointer -fPIC -fpermissive -fPIC -pthread -DBOOST_CHRONO_DYN_LINK=1 -DBOOST_FILESYSTEM_DYN_LINK=1 -DBOOST_SYSTEM_DYN_LINK=1 -DBOOST_THREAD_BUILD_DLL=1 -DBOOST_THREAD_USE_DLL=1 -DBOOST_ALL_NO_LIB -MD -MQ clients/chromecast/libtizchromecast/src/libtizchromecast.so.0.22.0.p/tizchromecast.cpp.o -MF clients/chromecast/libtizchromecast/src/libtizchromecast.so.0.22.0.p/tizchromecast.cpp.o.d -o clients/chromecast/libtizchromecast/src/libtizchromecast.so.0.22.0.p/tizchromecast.cpp.o -c ../tizonia-all-git/clients/chromecast/libtizchromecast/src/tizchromecast.cpp
../tizonia-all-git/clients/chromecast/libtizchromecast/src/tizchromecast.cpp: In member function ‘tiz_chromecast_error_t tizchromecast::start()’:
../tizonia-all-git/clients/chromecast/libtizchromecast/src/tizchromecast.cpp:108:63: error: ‘_1’ was not declared in this scope
  108 |           boost::bind (&tizchromecast::new_cast_status, this, _1, _2));
      |                                                               ^~
../tizonia-all-git/clients/chromecast/libtizchromecast/src/tizchromecast.cpp:108:63: note: suggested alternatives:
In file included from /usr/include/boost/mpl/aux_/include_preprocessed.hpp:37,
                 from /usr/include/boost/mpl/placeholders.hpp:43,
                 from /usr/include/boost/iterator/iterator_categories.hpp:16,
                 from /usr/include/boost/iterator/iterator_facade.hpp:13,
                 from /usr/include/boost/range/iterator_range_core.hpp:27,
                 from /usr/include/boost/lexical_cast.hpp:30,
                 from ../tizonia-all-git/clients/chromecast/libtizchromecast/src/tizchromecast.cpp:35:
/usr/include/boost/mpl/aux_/preprocessed/gcc/placeholders.hpp:29:16: note:   ‘mpl_::_1’
   29 | typedef arg<1> _1;
      |                ^~
In file included from /usr/include/boost/numeric/conversion/converter_policies.hpp:13,
                 from /usr/include/boost/numeric/conversion/converter.hpp:14,
                 from /usr/include/boost/numeric/conversion/cast.hpp:33,
                 from /usr/include/boost/lexical_cast/detail/converter_numeric.hpp:36,
                 from /usr/include/boost/lexical_cast/try_lexical_convert.hpp:43,
                 from /usr/include/boost/lexical_cast.hpp:32:
/usr/include/c++/12.2.0/functional:285:34: note:   ‘std::placeholders::_1’
  285 |     extern const _Placeholder<1> _1;
      |                                  ^~
/usr/include/boost/mpl/aux_/preprocessed/gcc/placeholders.hpp:29:16: note:   ‘mpl_::_1’
   29 | typedef arg<1> _1;
      |                ^~
In file included from /usr/include/boost/bind/bind.hpp:2336,
                 from /usr/include/boost/python/exception_translator.hpp:10,
                 from /usr/include/boost/python.hpp:28,
                 from ../tizonia-all-git/clients/chromecast/libtizchromecast/src/tizchromecast.hpp:65,
                 from ../tizonia-all-git/clients/chromecast/libtizchromecast/src/tizchromecast.cpp:38:
/usr/include/boost/bind/placeholders.hpp:46:38: note:   ‘boost::placeholders::_1’
   46 | BOOST_INLINE_CONSTEXPR boost::arg<1> _1;
      |                                      ^~
/usr/include/boost/mpl/aux_/preprocessed/gcc/placeholders.hpp:29:16: note:   ‘mpl_::_1’
   29 | typedef arg<1> _1;
      |                ^~
../tizonia-all-git/clients/chromecast/libtizchromecast/src/tizchromecast.cpp:108:67: error: ‘_2’ was not declared in this scope
  108 |           boost::bind (&tizchromecast::new_cast_status, this, _1, _2));
      |                                                                   ^~
../tizonia-all-git/clients/chromecast/libtizchromecast/src/tizchromecast.cpp:108:67: note: suggested alternatives:
/usr/include/boost/mpl/aux_/preprocessed/gcc/placeholders.hpp:42:16: note:   ‘mpl_::_2’
   42 | typedef arg<2> _2;
      |                ^~
/usr/include/c++/12.2.0/functional:286:34: note:   ‘std::placeholders::_2’
  286 |     extern const _Placeholder<2> _2;
      |                                  ^~
/usr/include/boost/mpl/aux_/preprocessed/gcc/placeholders.hpp:42:16: note:   ‘mpl_::_2’
   42 | typedef arg<2> _2;
      |                ^~
/usr/include/boost/bind/placeholders.hpp:47:38: note:   ‘boost::placeholders::_2’
   47 | BOOST_INLINE_CONSTEXPR boost::arg<2> _2;
      |                                      ^~
/usr/include/boost/mpl/aux_/preprocessed/gcc/placeholders.hpp:42:16: note:   ‘mpl_::_2’
   42 | typedef arg<2> _2;
      |                ^~
samu: subcommand failed

There is a fix: In
clients/chromecast/libtizchromecast/src/tizchromecast.cpp, both appearances of
boost::bind (&tizchromecast::new_cast_status, this, _1, _2)); need to be changed to
boost::bind (&tizchromecast::new_cast_status, this, boost::placeholders::_1, boost::placeholders::_2));, see this patch.

Steps to Reproduce

Build tizonia on Arch Linux from this recipe from the latest git clone with

CFLAGS='-O2 -s -DNDEBUG' \
CXXFLAGS='-O2 -s -DNDEBUG -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security' \
export SAMUFLAGS=-j1
arch-meson tizonia-all-git build
samu -v -C build

Expected behavior:

Succeeding build.

Actual behaviour:

Failing build with above error.

Reproduces how often:

Each time.

Versions

Current git.

Installation Method Used

Trying to build from source.

See also

→ This report on the Arch Linux user repository.

Fix

There is a fix: Apply this patch:

diff -U1 -r tizonia-all-git.orig/clients/chromecast/libtizchromecast/src/tizchromecast.cpp tizonia-all-git/clients/chromecast/libtizchromecast/src/tizchromecast.cpp
--- tizonia-all-git.orig/clients/chromecast/libtizchromecast/src/tizchromecast.cpp	2022-10-16 19:22:24.229914127 +0200
+++ tizonia-all-git/clients/chromecast/libtizchromecast/src/tizchromecast.cpp	2022-10-16 19:28:40.529902356 +0200
@@ -107,5 +107,5 @@
       handler_fn1 cast_status_handler (
-          boost::bind (&tizchromecast::new_cast_status, this, _1, _2));
+          boost::bind (&tizchromecast::new_cast_status, this, boost::placeholders::_1, boost::placeholders::_2));
       handler_fn2 media_status_handler (
-          boost::bind (&tizchromecast::new_media_status, this, _1, _2));
+          boost::bind (&tizchromecast::new_media_status, this, boost::placeholders::_1, boost::placeholders::_2));
       try_catch_wrapper (py_cc_proxy.attr ("activate") (

dreirund avatar Oct 16 '22 17:10 dreirund