MikaelSmith / torrent_client

A simple Ruby BitTorrent client based on libtorrent-rasterbar
Apache License 2.0
0 stars 0 forks source link

Fails to build: `error: no match for 'operator=' (operand types are 'std::shared_ptr<libtorrent::torrent_info>' and 'libtorrent::torrent_info*')` #4

Open barracuda156 opened 3 months ago

barracuda156 commented 3 months ago

@MikaelSmith Seems to be broken now:

Executing:  cd "/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_ruby_rb-torrent_client/rb33-torrent_client/work/torrent_client-0.2.1" && /opt/local/bin/gem3.3 install --local --force --install-dir /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_ruby_rb-torrent_client/rb33-torrent_client/work/destroot/opt/local/lib/ruby3.3/gems/3.3.0 /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_ruby_rb-torrent_client/rb33-torrent_client/work/torrent_client-0.2.1/torrent_client.gem 
Building native extensions. This could take a while...
ERROR:  Error installing /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_ruby_rb-torrent_client/rb33-torrent_client/work/torrent_client-0.2.1/torrent_client.gem:
    ERROR: Failed to build gem native extension.

    current directory: /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_ruby_rb-torrent_client/rb33-torrent_client/work/destroot/opt/local/lib/ruby3.3/gems/3.3.0/gems/torrent_client-0.2.1/ext/torrent_client
/opt/local/bin/ruby3.3 extconf.rb
creating Makefile

current directory: /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_ruby_rb-torrent_client/rb33-torrent_client/work/destroot/opt/local/lib/ruby3.3/gems/3.3.0/gems/torrent_client-0.2.1/ext/torrent_client
make DESTDIR\= sitearchdir\=./.gem.20240317-87227-v39kar sitelibdir\=./.gem.20240317-87227-v39kar clean
rm -f 
rm -fr torrent_client.bundle torrent_client.bundle.dSYM torrent_client.o *.bak mkmf.log .*.time

current directory: /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_ruby_rb-torrent_client/rb33-torrent_client/work/destroot/opt/local/lib/ruby3.3/gems/3.3.0/gems/torrent_client-0.2.1/ext/torrent_client
make DESTDIR\= sitearchdir\=./.gem.20240317-87227-v39kar sitelibdir\=./.gem.20240317-87227-v39kar
/opt/local/bin/g++-mp-13 -I. -I/opt/local/include/ruby-3.3.0/ppc-darwin10.0.0d2 -I/opt/local/include/ruby-3.3.0/ruby/backward -I/opt/local/include/ruby-3.3.0 -I. -I/opt/local/include -isystem/opt/local/include/LegacySupport -I/opt/local/libexec/openssl3/include -isystem/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT   -fno-common -pipe -I/opt/local/libexec/openssl3/include -Os -arch ppc -o torrent_client.o -c torrent_client.cc
torrent_client.cc:11:6: warning: 'template<class> class std::auto_ptr' is deprecated: use 'std::unique_ptr' instead [-Wdeprecated-declarations]
   11 | std::auto_ptr<lt::session> _session;
      |      ^~~~~~~~
In file included from /opt/local/include/gcc13/c++/bits/std_thread.h:43,
                 from /opt/local/include/gcc13/c++/thread:45,
                 from /opt/local/include/libtorrent/session.hpp:38,
                 from torrent_client.cc:4:
/opt/local/include/gcc13/c++/bits/unique_ptr.h:65:28: note: declared here
   65 |   template<typename> class auto_ptr;
      |                            ^~~~~~~~
torrent_client.cc: In function 'void Init_torrent_client()':
torrent_client.cc:25:37: warning: 'void libtorrent::session_handle::set_alert_mask(uint32_t)' is deprecated [-Wdeprecated-declarations]
   25 |             _session->set_alert_mask(lt::alert::status_notification | lt::alert::error_notification);
      |             ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /opt/local/include/libtorrent/session.hpp:43:
/opt/local/include/libtorrent/session_handle.hpp:1035:22: note: declared here
 1035 |                 void set_alert_mask(std::uint32_t m);
      |                      ^~~~~~~~~~~~~~
torrent_client.cc:28:32: warning: 'void libtorrent::session_handle::listen_on(const std::pair<int, int>&, libtorrent::error_code&, const char*, int)' is deprecated [-Wdeprecated-declarations]
   28 |             _session->listen_on(std::make_pair(6881, 6889), ec);
      |             ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/local/include/libtorrent/session_handle.hpp:781:22: note: declared here
  781 |                 void listen_on(
      |                      ^~~~~~~~~
torrent_client.cc: In function 'VALUE method_torrentclient_download(VALUE, VALUE, VALUE)':
torrent_client.cc:44:74: error: no match for 'operator=' (operand types are 'std::shared_ptr<libtorrent::torrent_info>' and 'libtorrent::torrent_info*')
   44 |             p.ti = new lt::torrent_info(StringValueCStr(torrent_file), ec);
      |                                                                          ^
In file included from /opt/local/include/gcc13/c++/memory:80,
                 from /opt/local/libexec/boost/1.76/include/boost/asio/associated_allocator.hpp:19,
                 from /opt/local/libexec/boost/1.76/include/boost/asio/detail/bind_handler.hpp:19,
                 from /opt/local/libexec/boost/1.76/include/boost/asio/detail/wrapped_handler.hpp:18,
                 from /opt/local/libexec/boost/1.76/include/boost/asio/io_context.hpp:23,
                 from /opt/local/libexec/boost/1.76/include/boost/asio/ts/io_context.hpp:18,
                 from /opt/local/include/libtorrent/io_context.hpp:40,
                 from /opt/local/include/libtorrent/session.hpp:41:
/opt/local/include/gcc13/c++/bits/shared_ptr.h:418:9: note: candidate: 'template<class _Yp> std::shared_ptr<_Tp>::_Assignable<const std::shared_ptr<_Yp>&> std::shared_ptr<_Tp>::operator=(const std::shared_ptr<_Yp>&) [with _Tp = libtorrent::torrent_info]'
  418 |         operator=(const shared_ptr<_Yp>& __r) noexcept
      |         ^~~~~~~~
/opt/local/include/gcc13/c++/bits/shared_ptr.h:418:9: note:   template argument deduction/substitution failed:
torrent_client.cc:44:74: note:   mismatched types 'const std::shared_ptr<_Tp>' and 'libtorrent::torrent_info*'
   44 |             p.ti = new lt::torrent_info(StringValueCStr(torrent_file), ec);
      |                                                                          ^
/opt/local/include/gcc13/c++/bits/shared_ptr.h:429:9: note: candidate: 'template<class _Yp> std::shared_ptr<_Tp>::_Assignable<std::auto_ptr<_Up> > std::shared_ptr<_Tp>::operator=(std::auto_ptr<_Up>&&) [with _Tp = libtorrent::torrent_info]'
  429 |         operator=(auto_ptr<_Yp>&& __r)
      |         ^~~~~~~~
/opt/local/include/gcc13/c++/bits/shared_ptr.h:429:9: note:   template argument deduction/substitution failed:
torrent_client.cc:44:74: note:   mismatched types 'std::auto_ptr<_Up>' and 'libtorrent::torrent_info*'
   44 |             p.ti = new lt::torrent_info(StringValueCStr(torrent_file), ec);
      |                                                                          ^
/opt/local/include/gcc13/c++/bits/shared_ptr.h:446:9: note: candidate: 'template<class _Yp> std::shared_ptr<_Tp>::_Assignable<std::shared_ptr<_Yp> > std::shared_ptr<_Tp>::operator=(std::shared_ptr<_Yp>&&) [with _Tp = libtorrent::torrent_info]'
  446 |         operator=(shared_ptr<_Yp>&& __r) noexcept
      |         ^~~~~~~~
/opt/local/include/gcc13/c++/bits/shared_ptr.h:446:9: note:   template argument deduction/substitution failed:
torrent_client.cc:44:74: note:   mismatched types 'std::shared_ptr<_Tp>' and 'libtorrent::torrent_info*'
   44 |             p.ti = new lt::torrent_info(StringValueCStr(torrent_file), ec);
      |                                                                          ^
/opt/local/include/gcc13/c++/bits/shared_ptr.h:454:9: note: candidate: 'template<class _Yp, class _Del> std::shared_ptr<_Tp>::_Assignable<std::unique_ptr<_Up, _Ep> > std::shared_ptr<_Tp>::operator=(std::unique_ptr<_Up, _Ep>&&) [with _Del = _Yp; _Tp = libtorrent::torrent_info]'
  454 |         operator=(unique_ptr<_Yp, _Del>&& __r)
      |         ^~~~~~~~
/opt/local/include/gcc13/c++/bits/shared_ptr.h:454:9: note:   template argument deduction/substitution failed:
torrent_client.cc:44:74: note:   mismatched types 'std::unique_ptr<_Tp, _Dp>' and 'libtorrent::torrent_info*'
   44 |             p.ti = new lt::torrent_info(StringValueCStr(torrent_file), ec);
      |                                                                          ^
/opt/local/include/gcc13/c++/bits/shared_ptr.h:414:19: note: candidate: 'std::shared_ptr<_Tp>& std::shared_ptr<_Tp>::operator=(const std::shared_ptr<_Tp>&) [with _Tp = libtorrent::torrent_info]'
  414 |       shared_ptr& operator=(const shared_ptr&) noexcept = default;
      |                   ^~~~~~~~
/opt/local/include/gcc13/c++/bits/shared_ptr.h:414:29: note:   no known conversion for argument 1 from 'libtorrent::torrent_info*' to 'const std::shared_ptr<libtorrent::torrent_info>&'
  414 |       shared_ptr& operator=(const shared_ptr&) noexcept = default;
      |                             ^~~~~~~~~~~~~~~~~
/opt/local/include/gcc13/c++/bits/shared_ptr.h:438:7: note: candidate: 'std::shared_ptr<_Tp>& std::shared_ptr<_Tp>::operator=(std::shared_ptr<_Tp>&&) [with _Tp = libtorrent::torrent_info]'
  438 |       operator=(shared_ptr&& __r) noexcept
      |       ^~~~~~~~
/opt/local/include/gcc13/c++/bits/shared_ptr.h:438:30: note:   no known conversion for argument 1 from 'libtorrent::torrent_info*' to 'std::shared_ptr<libtorrent::torrent_info>&&'
  438 |       operator=(shared_ptr&& __r) noexcept
      |                 ~~~~~~~~~~~~~^~~
torrent_client.cc:58:26: warning: 'template<class> class std::auto_ptr' is deprecated: use 'std::unique_ptr' instead [-Wdeprecated-declarations]
   58 |                     std::auto_ptr<lt::alert> a = _session->pop_alert();
      |                          ^~~~~~~~
/opt/local/include/gcc13/c++/bits/unique_ptr.h:65:28: note: declared here
   65 |   template<typename> class auto_ptr;
      |                            ^~~~~~~~
torrent_client.cc:58:60: error: 'std::auto_ptr<libtorrent::session>::element_type' {aka 'struct libtorrent::session'} has no member named 'pop_alert'; did you mean 'pop_alerts'?
   58 |                     std::auto_ptr<lt::alert> a = _session->pop_alert();
      |                                                            ^~~~~~~~~
      |                                                            pop_alerts
torrent_client.cc: In function 'VALUE method_torrentclient_verify(VALUE, VALUE, VALUE)':
torrent_client.cc:78:74: error: no match for 'operator=' (operand types are 'std::shared_ptr<libtorrent::torrent_info>' and 'libtorrent::torrent_info*')
   78 |             p.ti = new lt::torrent_info(StringValueCStr(torrent_file), ec);
      |                                                                          ^
/opt/local/include/gcc13/c++/bits/shared_ptr.h:418:9: note: candidate: 'template<class _Yp> std::shared_ptr<_Tp>::_Assignable<const std::shared_ptr<_Yp>&> std::shared_ptr<_Tp>::operator=(const std::shared_ptr<_Yp>&) [with _Tp = libtorrent::torrent_info]'
  418 |         operator=(const shared_ptr<_Yp>& __r) noexcept
      |         ^~~~~~~~
/opt/local/include/gcc13/c++/bits/shared_ptr.h:418:9: note:   template argument deduction/substitution failed:
torrent_client.cc:78:74: note:   mismatched types 'const std::shared_ptr<_Tp>' and 'libtorrent::torrent_info*'
   78 |             p.ti = new lt::torrent_info(StringValueCStr(torrent_file), ec);
      |                                                                          ^
/opt/local/include/gcc13/c++/bits/shared_ptr.h:429:9: note: candidate: 'template<class _Yp> std::shared_ptr<_Tp>::_Assignable<std::auto_ptr<_Up> > std::shared_ptr<_Tp>::operator=(std::auto_ptr<_Up>&&) [with _Tp = libtorrent::torrent_info]'
  429 |         operator=(auto_ptr<_Yp>&& __r)
      |         ^~~~~~~~
/opt/local/include/gcc13/c++/bits/shared_ptr.h:429:9: note:   template argument deduction/substitution failed:
torrent_client.cc:78:74: note:   mismatched types 'std::auto_ptr<_Up>' and 'libtorrent::torrent_info*'
   78 |             p.ti = new lt::torrent_info(StringValueCStr(torrent_file), ec);
      |                                                                          ^
/opt/local/include/gcc13/c++/bits/shared_ptr.h:446:9: note: candidate: 'template<class _Yp> std::shared_ptr<_Tp>::_Assignable<std::shared_ptr<_Yp> > std::shared_ptr<_Tp>::operator=(std::shared_ptr<_Yp>&&) [with _Tp = libtorrent::torrent_info]'
  446 |         operator=(shared_ptr<_Yp>&& __r) noexcept
      |         ^~~~~~~~
/opt/local/include/gcc13/c++/bits/shared_ptr.h:446:9: note:   template argument deduction/substitution failed:
torrent_client.cc:78:74: note:   mismatched types 'std::shared_ptr<_Tp>' and 'libtorrent::torrent_info*'
   78 |             p.ti = new lt::torrent_info(StringValueCStr(torrent_file), ec);
      |                                                                          ^
/opt/local/include/gcc13/c++/bits/shared_ptr.h:454:9: note: candidate: 'template<class _Yp, class _Del> std::shared_ptr<_Tp>::_Assignable<std::unique_ptr<_Up, _Ep> > std::shared_ptr<_Tp>::operator=(std::unique_ptr<_Up, _Ep>&&) [with _Del = _Yp; _Tp = libtorrent::torrent_info]'
  454 |         operator=(unique_ptr<_Yp, _Del>&& __r)
      |         ^~~~~~~~
/opt/local/include/gcc13/c++/bits/shared_ptr.h:454:9: note:   template argument deduction/substitution failed:
torrent_client.cc:78:74: note:   mismatched types 'std::unique_ptr<_Tp, _Dp>' and 'libtorrent::torrent_info*'
   78 |             p.ti = new lt::torrent_info(StringValueCStr(torrent_file), ec);
      |                                                                          ^
/opt/local/include/gcc13/c++/bits/shared_ptr.h:414:19: note: candidate: 'std::shared_ptr<_Tp>& std::shared_ptr<_Tp>::operator=(const std::shared_ptr<_Tp>&) [with _Tp = libtorrent::torrent_info]'
  414 |       shared_ptr& operator=(const shared_ptr&) noexcept = default;
      |                   ^~~~~~~~
/opt/local/include/gcc13/c++/bits/shared_ptr.h:414:29: note:   no known conversion for argument 1 from 'libtorrent::torrent_info*' to 'const std::shared_ptr<libtorrent::torrent_info>&'
  414 |       shared_ptr& operator=(const shared_ptr&) noexcept = default;
      |                             ^~~~~~~~~~~~~~~~~
/opt/local/include/gcc13/c++/bits/shared_ptr.h:438:7: note: candidate: 'std::shared_ptr<_Tp>& std::shared_ptr<_Tp>::operator=(std::shared_ptr<_Tp>&&) [with _Tp = libtorrent::torrent_info]'
  438 |       operator=(shared_ptr&& __r) noexcept
      |       ^~~~~~~~
/opt/local/include/gcc13/c++/bits/shared_ptr.h:438:30: note:   no known conversion for argument 1 from 'libtorrent::torrent_info*' to 'std::shared_ptr<libtorrent::torrent_info>&&'
  438 |       operator=(shared_ptr&& __r) noexcept
      |                 ~~~~~~~~~~~~~^~~
torrent_client.cc:94:26: warning: 'template<class> class std::auto_ptr' is deprecated: use 'std::unique_ptr' instead [-Wdeprecated-declarations]
   94 |                     std::auto_ptr<lt::alert> a = _session->pop_alert();
      |                          ^~~~~~~~
/opt/local/include/gcc13/c++/bits/unique_ptr.h:65:28: note: declared here
   65 |   template<typename> class auto_ptr;
      |                            ^~~~~~~~
torrent_client.cc:94:60: error: 'std::auto_ptr<libtorrent::session>::element_type' {aka 'struct libtorrent::session'} has no member named 'pop_alert'; did you mean 'pop_alerts'?
   94 |                     std::auto_ptr<lt::alert> a = _session->pop_alert();
      |                                                            ^~~~~~~~~
      |                                                            pop_alerts
torrent_client.cc:97:49: error: cannot convert 'int' to 'libtorrent::torrent_handle::status_flags_t' {aka 'libtorrent::flags::bitfield_flag<unsigned int, libtorrent::status_flags_tag>'}
   97 |                         success = handle.status(0).is_finished;
      |                                                 ^
      |                                                 |
      |                                                 int
In file included from /opt/local/include/libtorrent/session_handle.hpp:44:
/opt/local/include/libtorrent/torrent_handle.hpp:385:54: note:   initializing argument 1 of 'libtorrent::torrent_status libtorrent::torrent_handle::status(status_flags_t) const'
  385 |                 torrent_status status(status_flags_t flags = status_flags_t::all()) const;
      |                                       ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make: *** [torrent_client.o] Error 1

make failed, exit code 2
MikaelSmith commented 3 months ago

This still successfully builds for me with

It's possible it needs some updates for newer versions of libtorrent; what version are you using? The code is pretty minimal - https://github.com/MikaelSmith/torrent_client/blob/master/ext/torrent_client/torrent_client.cc - but some of the APIs may have changed. It's been ~8 years since I've touched this.

barracuda156 commented 3 months ago

@MikaelSmith Thank you for responding!

We got 2.0.10 too: https://ports.macports.org/port/libtorrent-rasterbar There is no Boost 1.84 in Macports now (it was discussed, but there was no need in it so far), but I can try using 1.81 (by default 1.76 gets picked). I will update on the issue then.

barracuda156 commented 3 months ago

Hmm, no, that did not help:

Building native extensions. This could take a while...
ERROR:  Error installing /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_ruby_rb-torrent_client/rb33-torrent_client/work/torrent_client-0.2.1/torrent_client.gem:
    ERROR: Failed to build gem native extension.

    current directory: /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_ruby_rb-torrent_client/rb33-torrent_client/work/destroot/opt/local/lib/ruby3.3/gems/3.3.0/gems/torrent_client-0.2.1/ext/torrent_client
/opt/local/bin/ruby3.3 extconf.rb
creating Makefile

current directory: /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_ruby_rb-torrent_client/rb33-torrent_client/work/destroot/opt/local/lib/ruby3.3/gems/3.3.0/gems/torrent_client-0.2.1/ext/torrent_client
make DESTDIR\= sitearchdir\=./.gem.20240319-29043-bh3hkp sitelibdir\=./.gem.20240319-29043-bh3hkp clean
rm -f 
rm -fr torrent_client.bundle torrent_client.bundle.dSYM torrent_client.o *.bak mkmf.log .*.time

current directory: /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_ruby_rb-torrent_client/rb33-torrent_client/work/destroot/opt/local/lib/ruby3.3/gems/3.3.0/gems/torrent_client-0.2.1/ext/torrent_client
make DESTDIR\= sitearchdir\=./.gem.20240319-29043-bh3hkp sitelibdir\=./.gem.20240319-29043-bh3hkp
/opt/local/bin/g++-mp-13 -I. -I/opt/local/include/ruby-3.3.0/ppc-darwin10.0.0d2 -I/opt/local/include/ruby-3.3.0/ruby/backward -I/opt/local/include/ruby-3.3.0 -I. -I/opt/local/include -isystem/opt/local/include/LegacySupport -I/opt/local/libexec/openssl3/include -isystem/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT   -fno-common -pipe -I/opt/local/libexec/openssl3/include -Os -arch ppc -o torrent_client.o -c torrent_client.cc
torrent_client.cc:11:6: warning: 'template<class> class std::auto_ptr' is deprecated: use 'std::unique_ptr' instead [-Wdeprecated-declarations]
   11 | std::auto_ptr<lt::session> _session;
      |      ^~~~~~~~
In file included from /opt/local/include/gcc13/c++/bits/shared_ptr_base.h:59,
                 from /opt/local/include/gcc13/c++/bits/shared_ptr.h:53,
                 from /opt/local/include/gcc13/c++/condition_variable:45,
                 from /opt/local/include/gcc13/c++/mutex:48,
                 from /opt/local/libexec/boost/1.81/include/boost/system/detail/error_category_impl.hpp:104,
                 from /opt/local/libexec/boost/1.81/include/boost/system/error_category.hpp:11,
                 from /opt/local/libexec/boost/1.81/include/boost/system/error_code.hpp:14,
                 from /opt/local/include/libtorrent/error_code.hpp:41,
                 from /opt/local/include/libtorrent/entry.hpp:75,
                 from torrent_client.cc:2:
/opt/local/include/gcc13/c++/bits/unique_ptr.h:65:28: note: declared here
   65 |   template<typename> class auto_ptr;
      |                            ^~~~~~~~
torrent_client.cc: In function 'void Init_torrent_client()':
torrent_client.cc:25:37: warning: 'void libtorrent::session_handle::set_alert_mask(uint32_t)' is deprecated [-Wdeprecated-declarations]
   25 |             _session->set_alert_mask(lt::alert::status_notification | lt::alert::error_notification);
      |             ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /opt/local/include/libtorrent/session.hpp:43,
                 from torrent_client.cc:4:
/opt/local/include/libtorrent/session_handle.hpp:1035:22: note: declared here
 1035 |                 void set_alert_mask(std::uint32_t m);
      |                      ^~~~~~~~~~~~~~
torrent_client.cc:28:32: warning: 'void libtorrent::session_handle::listen_on(const std::pair<int, int>&, libtorrent::error_code&, const char*, int)' is deprecated [-Wdeprecated-declarations]
   28 |             _session->listen_on(std::make_pair(6881, 6889), ec);
      |             ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/local/include/libtorrent/session_handle.hpp:781:22: note: declared here
  781 |                 void listen_on(
      |                      ^~~~~~~~~
torrent_client.cc: In function 'VALUE method_torrentclient_download(VALUE, VALUE, VALUE)':
torrent_client.cc:44:74: error: no match for 'operator=' (operand types are 'std::shared_ptr<libtorrent::torrent_info>' and 'libtorrent::torrent_info*')
   44 |             p.ti = new lt::torrent_info(StringValueCStr(torrent_file), ec);
      |                                                                          ^
/opt/local/include/gcc13/c++/bits/shared_ptr.h:418:9: note: candidate: 'template<class _Yp> std::shared_ptr<_Tp>::_Assignable<const std::shared_ptr<_Yp>&> std::shared_ptr<_Tp>::operator=(const std::shared_ptr<_Yp>&) [with _Tp = libtorrent::torrent_info]'
  418 |         operator=(const shared_ptr<_Yp>& __r) noexcept
      |         ^~~~~~~~
/opt/local/include/gcc13/c++/bits/shared_ptr.h:418:9: note:   template argument deduction/substitution failed:
torrent_client.cc:44:74: note:   mismatched types 'const std::shared_ptr<_Tp>' and 'libtorrent::torrent_info*'
   44 |             p.ti = new lt::torrent_info(StringValueCStr(torrent_file), ec);
      |                                                                          ^
/opt/local/include/gcc13/c++/bits/shared_ptr.h:429:9: note: candidate: 'template<class _Yp> std::shared_ptr<_Tp>::_Assignable<std::auto_ptr<_Up> > std::shared_ptr<_Tp>::operator=(std::auto_ptr<_Up>&&) [with _Tp = libtorrent::torrent_info]'
  429 |         operator=(auto_ptr<_Yp>&& __r)
      |         ^~~~~~~~
/opt/local/include/gcc13/c++/bits/shared_ptr.h:429:9: note:   template argument deduction/substitution failed:
torrent_client.cc:44:74: note:   mismatched types 'std::auto_ptr<_Up>' and 'libtorrent::torrent_info*'
   44 |             p.ti = new lt::torrent_info(StringValueCStr(torrent_file), ec);
      |                                                                          ^
/opt/local/include/gcc13/c++/bits/shared_ptr.h:446:9: note: candidate: 'template<class _Yp> std::shared_ptr<_Tp>::_Assignable<std::shared_ptr<_Yp> > std::shared_ptr<_Tp>::operator=(std::shared_ptr<_Yp>&&) [with _Tp = libtorrent::torrent_info]'
  446 |         operator=(shared_ptr<_Yp>&& __r) noexcept
      |         ^~~~~~~~
/opt/local/include/gcc13/c++/bits/shared_ptr.h:446:9: note:   template argument deduction/substitution failed:
torrent_client.cc:44:74: note:   mismatched types 'std::shared_ptr<_Tp>' and 'libtorrent::torrent_info*'
   44 |             p.ti = new lt::torrent_info(StringValueCStr(torrent_file), ec);
      |                                                                          ^
/opt/local/include/gcc13/c++/bits/shared_ptr.h:454:9: note: candidate: 'template<class _Yp, class _Del> std::shared_ptr<_Tp>::_Assignable<std::unique_ptr<_Up, _Ep> > std::shared_ptr<_Tp>::operator=(std::unique_ptr<_Up, _Ep>&&) [with _Del = _Yp; _Tp = libtorrent::torrent_info]'
  454 |         operator=(unique_ptr<_Yp, _Del>&& __r)
      |         ^~~~~~~~
/opt/local/include/gcc13/c++/bits/shared_ptr.h:454:9: note:   template argument deduction/substitution failed:
torrent_client.cc:44:74: note:   mismatched types 'std::unique_ptr<_Tp, _Dp>' and 'libtorrent::torrent_info*'
   44 |             p.ti = new lt::torrent_info(StringValueCStr(torrent_file), ec);
      |                                                                          ^
/opt/local/include/gcc13/c++/bits/shared_ptr.h:414:19: note: candidate: 'std::shared_ptr<_Tp>& std::shared_ptr<_Tp>::operator=(const std::shared_ptr<_Tp>&) [with _Tp = libtorrent::torrent_info]'
  414 |       shared_ptr& operator=(const shared_ptr&) noexcept = default;
      |                   ^~~~~~~~
/opt/local/include/gcc13/c++/bits/shared_ptr.h:414:29: note:   no known conversion for argument 1 from 'libtorrent::torrent_info*' to 'const std::shared_ptr<libtorrent::torrent_info>&'
  414 |       shared_ptr& operator=(const shared_ptr&) noexcept = default;
      |                             ^~~~~~~~~~~~~~~~~
/opt/local/include/gcc13/c++/bits/shared_ptr.h:438:7: note: candidate: 'std::shared_ptr<_Tp>& std::shared_ptr<_Tp>::operator=(std::shared_ptr<_Tp>&&) [with _Tp = libtorrent::torrent_info]'
  438 |       operator=(shared_ptr&& __r) noexcept
      |       ^~~~~~~~
/opt/local/include/gcc13/c++/bits/shared_ptr.h:438:30: note:   no known conversion for argument 1 from 'libtorrent::torrent_info*' to 'std::shared_ptr<libtorrent::torrent_info>&&'
  438 |       operator=(shared_ptr&& __r) noexcept
      |                 ~~~~~~~~~~~~~^~~
torrent_client.cc:58:26: warning: 'template<class> class std::auto_ptr' is deprecated: use 'std::unique_ptr' instead [-Wdeprecated-declarations]
   58 |                     std::auto_ptr<lt::alert> a = _session->pop_alert();
      |                          ^~~~~~~~
/opt/local/include/gcc13/c++/bits/unique_ptr.h:65:28: note: declared here
   65 |   template<typename> class auto_ptr;
      |                            ^~~~~~~~
torrent_client.cc:58:60: error: 'std::auto_ptr<libtorrent::session>::element_type' {aka 'struct libtorrent::session'} has no member named 'pop_alert'; did you mean 'pop_alerts'?
   58 |                     std::auto_ptr<lt::alert> a = _session->pop_alert();
      |                                                            ^~~~~~~~~
      |                                                            pop_alerts
torrent_client.cc: In function 'VALUE method_torrentclient_verify(VALUE, VALUE, VALUE)':
torrent_client.cc:78:74: error: no match for 'operator=' (operand types are 'std::shared_ptr<libtorrent::torrent_info>' and 'libtorrent::torrent_info*')
   78 |             p.ti = new lt::torrent_info(StringValueCStr(torrent_file), ec);
      |                                                                          ^
/opt/local/include/gcc13/c++/bits/shared_ptr.h:418:9: note: candidate: 'template<class _Yp> std::shared_ptr<_Tp>::_Assignable<const std::shared_ptr<_Yp>&> std::shared_ptr<_Tp>::operator=(const std::shared_ptr<_Yp>&) [with _Tp = libtorrent::torrent_info]'
  418 |         operator=(const shared_ptr<_Yp>& __r) noexcept
      |         ^~~~~~~~
/opt/local/include/gcc13/c++/bits/shared_ptr.h:418:9: note:   template argument deduction/substitution failed:
torrent_client.cc:78:74: note:   mismatched types 'const std::shared_ptr<_Tp>' and 'libtorrent::torrent_info*'
   78 |             p.ti = new lt::torrent_info(StringValueCStr(torrent_file), ec);
      |                                                                          ^
/opt/local/include/gcc13/c++/bits/shared_ptr.h:429:9: note: candidate: 'template<class _Yp> std::shared_ptr<_Tp>::_Assignable<std::auto_ptr<_Up> > std::shared_ptr<_Tp>::operator=(std::auto_ptr<_Up>&&) [with _Tp = libtorrent::torrent_info]'
  429 |         operator=(auto_ptr<_Yp>&& __r)
      |         ^~~~~~~~
/opt/local/include/gcc13/c++/bits/shared_ptr.h:429:9: note:   template argument deduction/substitution failed:
torrent_client.cc:78:74: note:   mismatched types 'std::auto_ptr<_Up>' and 'libtorrent::torrent_info*'
   78 |             p.ti = new lt::torrent_info(StringValueCStr(torrent_file), ec);
      |                                                                          ^
/opt/local/include/gcc13/c++/bits/shared_ptr.h:446:9: note: candidate: 'template<class _Yp> std::shared_ptr<_Tp>::_Assignable<std::shared_ptr<_Yp> > std::shared_ptr<_Tp>::operator=(std::shared_ptr<_Yp>&&) [with _Tp = libtorrent::torrent_info]'
  446 |         operator=(shared_ptr<_Yp>&& __r) noexcept
      |         ^~~~~~~~
/opt/local/include/gcc13/c++/bits/shared_ptr.h:446:9: note:   template argument deduction/substitution failed:
torrent_client.cc:78:74: note:   mismatched types 'std::shared_ptr<_Tp>' and 'libtorrent::torrent_info*'
   78 |             p.ti = new lt::torrent_info(StringValueCStr(torrent_file), ec);
      |                                                                          ^
/opt/local/include/gcc13/c++/bits/shared_ptr.h:454:9: note: candidate: 'template<class _Yp, class _Del> std::shared_ptr<_Tp>::_Assignable<std::unique_ptr<_Up, _Ep> > std::shared_ptr<_Tp>::operator=(std::unique_ptr<_Up, _Ep>&&) [with _Del = _Yp; _Tp = libtorrent::torrent_info]'
  454 |         operator=(unique_ptr<_Yp, _Del>&& __r)
      |         ^~~~~~~~
/opt/local/include/gcc13/c++/bits/shared_ptr.h:454:9: note:   template argument deduction/substitution failed:
torrent_client.cc:78:74: note:   mismatched types 'std::unique_ptr<_Tp, _Dp>' and 'libtorrent::torrent_info*'
   78 |             p.ti = new lt::torrent_info(StringValueCStr(torrent_file), ec);
      |                                                                          ^
/opt/local/include/gcc13/c++/bits/shared_ptr.h:414:19: note: candidate: 'std::shared_ptr<_Tp>& std::shared_ptr<_Tp>::operator=(const std::shared_ptr<_Tp>&) [with _Tp = libtorrent::torrent_info]'
  414 |       shared_ptr& operator=(const shared_ptr&) noexcept = default;
      |                   ^~~~~~~~
/opt/local/include/gcc13/c++/bits/shared_ptr.h:414:29: note:   no known conversion for argument 1 from 'libtorrent::torrent_info*' to 'const std::shared_ptr<libtorrent::torrent_info>&'
  414 |       shared_ptr& operator=(const shared_ptr&) noexcept = default;
      |                             ^~~~~~~~~~~~~~~~~
/opt/local/include/gcc13/c++/bits/shared_ptr.h:438:7: note: candidate: 'std::shared_ptr<_Tp>& std::shared_ptr<_Tp>::operator=(std::shared_ptr<_Tp>&&) [with _Tp = libtorrent::torrent_info]'
  438 |       operator=(shared_ptr&& __r) noexcept
      |       ^~~~~~~~
/opt/local/include/gcc13/c++/bits/shared_ptr.h:438:30: note:   no known conversion for argument 1 from 'libtorrent::torrent_info*' to 'std::shared_ptr<libtorrent::torrent_info>&&'
  438 |       operator=(shared_ptr&& __r) noexcept
      |                 ~~~~~~~~~~~~~^~~
torrent_client.cc:94:26: warning: 'template<class> class std::auto_ptr' is deprecated: use 'std::unique_ptr' instead [-Wdeprecated-declarations]
   94 |                     std::auto_ptr<lt::alert> a = _session->pop_alert();
      |                          ^~~~~~~~
/opt/local/include/gcc13/c++/bits/unique_ptr.h:65:28: note: declared here
   65 |   template<typename> class auto_ptr;
      |                            ^~~~~~~~
torrent_client.cc:94:60: error: 'std::auto_ptr<libtorrent::session>::element_type' {aka 'struct libtorrent::session'} has no member named 'pop_alert'; did you mean 'pop_alerts'?
   94 |                     std::auto_ptr<lt::alert> a = _session->pop_alert();
      |                                                            ^~~~~~~~~
      |                                                            pop_alerts
torrent_client.cc:97:49: error: cannot convert 'int' to 'libtorrent::torrent_handle::status_flags_t' {aka 'libtorrent::flags::bitfield_flag<unsigned int, libtorrent::status_flags_tag>'}
   97 |                         success = handle.status(0).is_finished;
      |                                                 ^
      |                                                 |
      |                                                 int
In file included from /opt/local/include/libtorrent/session_handle.hpp:44:
/opt/local/include/libtorrent/torrent_handle.hpp:385:54: note:   initializing argument 1 of 'libtorrent::torrent_status libtorrent::torrent_handle::status(status_flags_t) const'
  385 |                 torrent_status status(status_flags_t flags = status_flags_t::all()) const;
      |                                       ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make: *** [torrent_client.o] Error 1

make failed, exit code 2

Gem files will remain installed in /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_ruby_rb-torrent_client/rb33-torrent_client/work/destroot/opt/local/lib/ruby3.3/gems/3.3.0/gems/torrent_client-0.2.1 for inspection.
Results logged to /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_ruby_rb-torrent_client/rb33-torrent_client/work/destroot/opt/local/lib/ruby3.3/gems/3.3.0/extensions/ppc-darwin-10/3.3.0/torrent_client-0.2.1/gem_make.out
Command failed:  cd "/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_ruby_rb-torrent_client/rb33-torrent_client/work/torrent_client-0.2.1" && /opt/local/bin/gem3.3 install --local --force --install-dir /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_ruby_rb-torrent_client/rb33-torrent_client/work/destroot/opt/local/lib/ruby3.3/gems/3.3.0 /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_ruby_rb-torrent_client/rb33-torrent_client/work/torrent_client-0.2.1/torrent_client.gem 
Exit code: 1
barracuda156 commented 3 months ago

@MikaelSmith Tried to build now on Sonoma aarch64 with Clang, and it failed like this:

Building native extensions. This could take a while...
ERROR:  Error installing /opt/local/var/macports/build/_opt_svacchanda_SonomaPorts_ruby_rb-torrent_client/rb33-torrent_client/work/torrent_client-0.2.1/torrent_client.gem:
    ERROR: Failed to build gem native extension.

    current directory: /opt/local/var/macports/build/_opt_svacchanda_SonomaPorts_ruby_rb-torrent_client/rb33-torrent_client/work/destroot/opt/local/lib/ruby3.3/gems/3.3.0/gems/torrent_client-0.2.1/ext/torrent_client
/opt/local/bin/ruby3.3 extconf.rb
creating Makefile

current directory: /opt/local/var/macports/build/_opt_svacchanda_SonomaPorts_ruby_rb-torrent_client/rb33-torrent_client/work/destroot/opt/local/lib/ruby3.3/gems/3.3.0/gems/torrent_client-0.2.1/ext/torrent_client
make DESTDIR\= sitearchdir\=./.gem.20240319-76378-w3nyz8 sitelibdir\=./.gem.20240319-76378-w3nyz8 clean
rm -f 
rm -fr torrent_client.bundle torrent_client.bundle.dSYM torrent_client.o *.bak mkmf.log .*.time

current directory: /opt/local/var/macports/build/_opt_svacchanda_SonomaPorts_ruby_rb-torrent_client/rb33-torrent_client/work/destroot/opt/local/lib/ruby3.3/gems/3.3.0/gems/torrent_client-0.2.1/ext/torrent_client
make DESTDIR\= sitearchdir\=./.gem.20240319-76378-w3nyz8 sitelibdir\=./.gem.20240319-76378-w3nyz8
/usr/bin/clang++ -I. -I/opt/local/include/ruby-3.3.0/arm64-darwin23 -I/opt/local/include/ruby-3.3.0/ruby/backward -I/opt/local/include/ruby-3.3.0 -I. -I/opt/local/include -I/opt/local/libexec/openssl3/include -isystem/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT   -fno-common -pipe -I/opt/local/libexec/openssl3/include -Os -stdlib=libc++ -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -fdeclspec -arch arm64 -o torrent_client.o -c torrent_client.cc
In file included from torrent_client.cc:2:
In file included from /opt/local/include/libtorrent/entry.hpp:75:
In file included from /opt/local/include/libtorrent/error_code.hpp:44:
/opt/local/include/libtorrent/units.hpp:66:70: error: a space is required between consecutive right angle brackets (use '> >')
                using diff_type = strong_typedef<UnderlyingType, difference_tag<Tag>>;
                                                                                   ^
/opt/local/include/libtorrent/units.hpp:68:3: error: unknown type name 'constexpr'
                constexpr strong_typedef(strong_typedef const& rhs) noexcept = default;
                ^
/opt/local/include/libtorrent/units.hpp:68:13: error: constructor cannot have a return type
                constexpr strong_typedef(strong_typedef const& rhs) noexcept = default;
                          ^~~~~~~~~~~~~~
/opt/local/include/libtorrent/units.hpp:68:54: error: expected ';' at end of declaration list
                constexpr strong_typedef(strong_typedef const& rhs) noexcept = default;
                                                                   ^
/opt/local/include/libtorrent/units.hpp:69:3: error: unknown type name 'constexpr'
                constexpr strong_typedef(strong_typedef&& rhs) noexcept = default;
                ^
/opt/local/include/libtorrent/units.hpp:69:13: error: constructor cannot have a return type
                constexpr strong_typedef(strong_typedef&& rhs) noexcept = default;
                          ^~~~~~~~~~~~~~
/opt/local/include/libtorrent/units.hpp:69:49: error: expected ';' at end of declaration list
                constexpr strong_typedef(strong_typedef&& rhs) noexcept = default;
                                                              ^
/opt/local/include/libtorrent/units.hpp:70:19: error: expected ';' at end of declaration list
                strong_typedef() noexcept = default;
                                ^
/opt/local/include/libtorrent/units.hpp:72:3: error: unknown type name 'constexpr'
                constexpr strong_typedef(UnderlyingType val) : m_val(val) {}
                ^
/opt/local/include/libtorrent/units.hpp:72:13: error: constructor cannot have a return type
                constexpr strong_typedef(UnderlyingType val) : m_val(val) {}
                          ^~~~~~~~~~~~~~
/opt/local/include/libtorrent/units.hpp:73:3: error: unknown type name 'constexpr'
                constexpr operator UnderlyingType() const { return m_val; }
                ^
/opt/local/include/libtorrent/units.hpp:104:57: error: expected ';' at end of declaration list
                strong_typedef& operator=(strong_typedef const& rhs) & noexcept = default;
                                                                      ^
/opt/local/include/libtorrent/units.hpp:105:52: error: expected ';' at end of declaration list
                strong_typedef& operator=(strong_typedef&& rhs) & noexcept = default;
                                                                 ^
/opt/local/include/libtorrent/units.hpp:87:59: error: expected '(' for function-style cast or type construction
                strong_typedef operator++(int) & { return strong_typedef{m_val++}; }
                                                          ~~~~~~~~~~~~~~^
/opt/local/include/libtorrent/units.hpp:88:59: error: expected '(' for function-style cast or type construction
                strong_typedef operator--(int) & { return strong_typedef{m_val--}; }
                                                          ~~~~~~~~~~~~~~^
/opt/local/include/libtorrent/units.hpp:91:21: error: expected '(' for function-style cast or type construction
                { return diff_type{lhs.m_val - rhs.m_val}; }
                         ~~~~~~~~~^
/opt/local/include/libtorrent/units.hpp:93:26: error: expected '(' for function-style cast or type construction
                { return strong_typedef{lhs.m_val + static_cast<UnderlyingType>(rhs)}; }
                         ~~~~~~~~~~~~~~^
/opt/local/include/libtorrent/units.hpp:95:26: error: expected '(' for function-style cast or type construction
                { return strong_typedef{static_cast<UnderlyingType>(lhs) + rhs.m_val}; }
                         ~~~~~~~~~~~~~~^
/opt/local/include/libtorrent/units.hpp:97:26: error: expected '(' for function-style cast or type construction
                { return strong_typedef{lhs.m_val - static_cast<UnderlyingType>(rhs)}; }
                         ~~~~~~~~~~~~~~^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [torrent_client.o] Error 1

make failed, exit code 2

Gem files will remain installed in /opt/local/var/macports/build/_opt_svacchanda_SonomaPorts_ruby_rb-torrent_client/rb33-torrent_client/work/destroot/opt/local/lib/ruby3.3/gems/3.3.0/gems/torrent_client-0.2.1 for inspection.
Results logged to /opt/local/var/macports/build/_opt_svacchanda_SonomaPorts_ruby_rb-torrent_client/rb33-torrent_client/work/destroot/opt/local/lib/ruby3.3/gems/3.3.0/extensions/arm64-darwin-23/3.3.0/torrent_client-0.2.1/gem_make.out
Command failed:  cd "/opt/local/var/macports/build/_opt_svacchanda_SonomaPorts_ruby_rb-torrent_client/rb33-torrent_client/work/torrent_client-0.2.1" && /opt/local/bin/gem3.3 install --local --force --install-dir /opt/local/var/macports/build/_opt_svacchanda_SonomaPorts_ruby_rb-torrent_client/rb33-torrent_client/work/destroot/opt/local/lib/ruby3.3/gems/3.3.0 /opt/local/var/macports/build/_opt_svacchanda_SonomaPorts_ruby_rb-torrent_client/rb33-torrent_client/work/torrent_client-0.2.1/torrent_client.gem 
Exit code: 1
MikaelSmith commented 3 months ago

I forgot gem build doesn't actually compile source code. Trying to remember how to build it myself.

barracuda156 commented 3 months ago

I forgot gem build doesn't actually compile source code. Trying to remember how to build it myself.

Macports uses this:

Executing:  cd "/opt/local/var/macports/build/_opt_svacchanda_SonomaPorts_ruby_rb-torrent_client/rb33-torrent_client/work/torrent_client-0.2.1" && /opt/local/bin/gem3.3 install --local --force --install-dir /opt/local/var/macports/build/_opt_svacchanda_SonomaPorts_ruby_rb-torrent_client/rb33-torrent_client/work/destroot/opt/local/lib/ruby3.3/gems/3.3.0 /opt/local/var/macports/build/_opt_svacchanda_SonomaPorts_ruby_rb-torrent_client/rb33-torrent_client/work/torrent_client-0.2.1/torrent_client.gem

So perhaps install is the thing which builds (oddly, yeah).

MikaelSmith commented 3 months ago

How did this project get added to macports? I'm not actively developing it, and it looks like the libtorrent API now requires C++14 and went through a significant redesign.

barracuda156 commented 3 months ago

@MikaelSmith It is not in Macports at the moment :)

I was looking into adding it, but it fails to build.

barracuda156 commented 3 months ago

@MikaelSmith If you get it to work, please let me know!