Doesn't build with libtorrent-rasterbar 1.1
felixonmars opened this issue · 9 comments
g++ -DPACKAGE_NAME=\"btfs\" -DPACKAGE_TARNAME=\"btfs\" -DPACKAGE_VERSION=\"2.8\" -DPACKAGE_STRING=\"btfs\ 2.8\" -DPACKAGE_BUGREPORT=\"johan.gunnarsson@gmail.com\" -DPACKAGE_URL=\"https://github.com/johang/btfs\" -DPACKAGE=\"btfs\" -DVERSION=\"2.8\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_MEMSET=1 -DHAVE_MKDIR=1 -DHAVE_REALPATH=1 -DHAVE_STRDUP=1 -I. -Wall -Wextra -Wconversion -Wsign-compare -Wsign-conversion -Wno-unused-parameter -D_FILE_OFFSET_BITS=64 -I/usr/include/fuse -DTORRENT_DISABLE_LOGGING -DTORRENT_USE_OPENSSL -DBOOST_ASIO_HASH_MAP_BUCKETS=1021 -msse4.2 -DBOOST_EXCEPTION_DISABLE -DBOOST_ASIO_ENABLE_CANCELIO -DTORRENT_LINKING_SHARED -I/usr/include/libtorrent -D_FORTIFY_SOURCE=2 -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -MT btfs-btfs.o -MD -MP -MF .deps/btfs-btfs.Tpo -c -o btfs-btfs.o `test -f 'btfs.cc' || echo './'`btfs.cc
btfs.cc: In constructor 'btfs::Read::Read(char*, int, off_t, size_t)':
btfs.cc:115:48: warning: 'libtorrent::file_entry libtorrent::torrent_info::file_at(int) const' is deprecated [-Wdeprecated-declarations]
libtorrent::file_entry file = ti.file_at(index);
^
In file included from btfs.cc:32:0:
/usr/include/libtorrent/torrent_info.hpp:352:14: note: declared here
file_entry file_at(int index) const { return m_files.at_deprecated(index); }
^
btfs.cc: In function 'void setup()':
btfs.cc:203:32: warning: 'libtorrent::file_entry libtorrent::torrent_info::file_at(int) const' is deprecated [-Wdeprecated-declarations]
char *p = strdup(ti.file_at(i).path.c_str());
^
In file included from btfs.cc:32:0:
/usr/include/libtorrent/torrent_info.hpp:352:14: note: declared here
file_entry file_at(int index) const { return m_files.at_deprecated(index); }
^
btfs.cc:223:27: warning: 'libtorrent::file_entry libtorrent::torrent_info::file_at(int) const' is deprecated [-Wdeprecated-declarations]
files["/" + ti.file_at(i).path] = i;
^
In file included from btfs.cc:32:0:
/usr/include/libtorrent/torrent_info.hpp:352:14: note: declared here
file_entry file_at(int index) const { return m_files.at_deprecated(index); }
^
btfs.cc: In function 'void* alert_queue_loop(void*)':
btfs.cc:354:30: warning: 'void libtorrent::session_handle::pop_alerts(std::deque<libtorrent::alert*>*)' is deprecated [-Wdeprecated-declarations]
session->pop_alerts(&alerts);
^
In file included from /usr/include/libtorrent/session.hpp:53:0,
from btfs.cc:33:
/usr/include/libtorrent/session_handle.hpp:916:8: note: declared here
void pop_alerts(std::deque<alert*>* alerts);
^
btfs.cc: In function 'int btfs_getattr(const char*, stat*)':
btfs.cc:398:55: warning: 'libtorrent::file_entry libtorrent::torrent_info::file_at(int) const' is deprecated [-Wdeprecated-declarations]
libtorrent::file_entry file = ti.file_at(files[path]);
^
In file included from btfs.cc:32:0:
/usr/include/libtorrent/torrent_info.hpp:352:14: note: declared here
file_entry file_at(int index) const { return m_files.at_deprecated(index); }
^
btfs.cc: In function 'void* btfs_init(fuse_conn_info*)':
btfs.cc:510:9: warning: 'libtorrent::session::session(const libtorrent::fingerprint&, std::pair<int, int>, const char*, int, int)' is deprecated [-Wdeprecated-declarations]
alerts);
^
In file included from btfs.cc:33:0:
/usr/include/libtorrent/session.hpp:226:3: note: declared here
session(fingerprint const& print
^
btfs.cc:519:54: warning: 'libtorrent::session_settings libtorrent::session_handle::settings() const' is deprecated [-Wdeprecated-declarations]
libtorrent::session_settings se = session->settings();
^
In file included from /usr/include/libtorrent/session.hpp:53:0,
from btfs.cc:33:
/usr/include/libtorrent/session_handle.hpp:810:20: note: declared here
session_settings settings() const;
^
btfs.cc:527:26: warning: 'void libtorrent::session_handle::set_settings(const libtorrent::session_settings&)' is deprecated [-Wdeprecated-declarations]
session->set_settings(se);
^
In file included from /usr/include/libtorrent/session.hpp:53:0,
from btfs.cc:33:
/usr/include/libtorrent/session_handle.hpp:808:8: note: declared here
void set_settings(session_settings const& s);
^
btfs.cc: In function 'bool populate_metadata(libtorrent::add_torrent_params&, const char*)':
btfs.cc:632:8: error: no match for 'operator=' (operand types are 'boost::shared_ptr<libtorrent::torrent_info>' and 'libtorrent::torrent_info*')
p.ti = new libtorrent::torrent_info((const char *) output.buf,
^
In file included from /usr/include/boost/smart_ptr/shared_array.hpp:24:0,
from /usr/include/boost/shared_array.hpp:17,
from /usr/include/libtorrent/torrent_info.hpp:42,
from btfs.cc:32:
/usr/include/boost/smart_ptr/shared_ptr.hpp:524:18: note: candidate: boost::shared_ptr<T>& boost::shared_ptr<T>::operator=(const boost::shared_ptr<T>&) [with T = libtorrent::torrent_info]
shared_ptr & operator=( shared_ptr const & r ) BOOST_NOEXCEPT
^
/usr/include/boost/smart_ptr/shared_ptr.hpp:524:18: note: no known conversion for argument 1 from 'libtorrent::torrent_info*' to 'const boost::shared_ptr<libtorrent::torrent_info>&'
/usr/include/boost/smart_ptr/shared_ptr.hpp:533:18: note: candidate: template<class Y> boost::shared_ptr<T>& boost::shared_ptr<T>::operator=(const boost::shared_ptr<Y>&) [with Y = Y; T = libtorrent::torrent_info]
shared_ptr & operator=(shared_ptr<Y> const & r) BOOST_NOEXCEPT
^
/usr/include/boost/smart_ptr/shared_ptr.hpp:533:18: note: template argument deduction/substitution failed:
btfs.cc:632:8: note: mismatched types 'const boost::shared_ptr<X>' and 'libtorrent::torrent_info*'
p.ti = new libtorrent::torrent_info((const char *) output.buf,
^
In file included from /usr/include/boost/smart_ptr/shared_array.hpp:24:0,
from /usr/include/boost/shared_array.hpp:17,
from /usr/include/libtorrent/torrent_info.hpp:42,
from btfs.cc:32:
/usr/include/boost/smart_ptr/shared_ptr.hpp:544:18: note: candidate: template<class Y> boost::shared_ptr<T>& boost::shared_ptr<T>::operator=(std::auto_ptr<_Tp1>&) [with Y = Y; T = libtorrent::torrent_info]
shared_ptr & operator=( std::auto_ptr<Y> & r )
^
/usr/include/boost/smart_ptr/shared_ptr.hpp:544:18: note: template argument deduction/substitution failed:
btfs.cc:632:8: note: mismatched types 'std::auto_ptr<Y>' and 'libtorrent::torrent_info*'
p.ti = new libtorrent::torrent_info((const char *) output.buf,
^
In file included from /usr/include/boost/smart_ptr/shared_array.hpp:24:0,
from /usr/include/boost/shared_array.hpp:17,
from /usr/include/libtorrent/torrent_info.hpp:42,
from btfs.cc:32:
/usr/include/boost/smart_ptr/shared_ptr.hpp:562:77: note: candidate: template<class Ap> typename boost::detail::sp_enable_if_auto_ptr<Ap, boost::shared_ptr<T>&>::type boost::shared_ptr<T>::operator=(Ap) [with Ap = Ap; T = libtorrent::torrent_info]
typename boost::detail::sp_enable_if_auto_ptr< Ap, shared_ptr & >::type operator=( Ap r )
^
/usr/include/boost/smart_ptr/shared_ptr.hpp:562:77: note: template argument deduction/substitution failed:
/usr/include/boost/smart_ptr/shared_ptr.hpp: In substitution of 'template<class Ap> typename boost::detail::sp_enable_if_auto_ptr<Ap, boost::shared_ptr<T>&>::type boost::shared_ptr<T>::operator=(Ap) [with Ap = libtorrent::torrent_info*]':
btfs.cc:632:8: required from here
/usr/include/boost/smart_ptr/shared_ptr.hpp:562:77: error: no type named 'type' in 'struct boost::detail::sp_enable_if_auto_ptr<libtorrent::torrent_info*, boost::shared_ptr<libtorrent::torrent_info>&>'
/usr/include/boost/smart_ptr/shared_ptr.hpp:584:18: note: candidate: template<class Y, class D> boost::shared_ptr<T>& boost::shared_ptr<T>::operator=(boost::movelib::unique_ptr<Y, D>) [with Y = Y; D = D; T = libtorrent::torrent_info]
shared_ptr & operator=( boost::movelib::unique_ptr<Y, D> r )
^
/usr/include/boost/smart_ptr/shared_ptr.hpp:584:18: note: template argument deduction/substitution failed:
btfs.cc:632:8: note: mismatched types 'boost::movelib::unique_ptr<Y, D>' and 'libtorrent::torrent_info*'
p.ti = new libtorrent::torrent_info((const char *) output.buf,
^
btfs.cc:657:8: error: no match for 'operator=' (operand types are 'boost::shared_ptr<libtorrent::torrent_info>' and 'libtorrent::torrent_info*')
p.ti = new libtorrent::torrent_info(r, ec);
^
In file included from /usr/include/boost/smart_ptr/shared_array.hpp:24:0,
from /usr/include/boost/shared_array.hpp:17,
from /usr/include/libtorrent/torrent_info.hpp:42,
from btfs.cc:32:
/usr/include/boost/smart_ptr/shared_ptr.hpp:524:18: note: candidate: boost::shared_ptr<T>& boost::shared_ptr<T>::operator=(const boost::shared_ptr<T>&) [with T = libtorrent::torrent_info]
shared_ptr & operator=( shared_ptr const & r ) BOOST_NOEXCEPT
^
/usr/include/boost/smart_ptr/shared_ptr.hpp:524:18: note: no known conversion for argument 1 from 'libtorrent::torrent_info*' to 'const boost::shared_ptr<libtorrent::torrent_info>&'
/usr/include/boost/smart_ptr/shared_ptr.hpp:533:18: note: candidate: template<class Y> boost::shared_ptr<T>& boost::shared_ptr<T>::operator=(const boost::shared_ptr<Y>&) [with Y = Y; T = libtorrent::torrent_info]
shared_ptr & operator=(shared_ptr<Y> const & r) BOOST_NOEXCEPT
^
/usr/include/boost/smart_ptr/shared_ptr.hpp:533:18: note: template argument deduction/substitution failed:
btfs.cc:657:8: note: mismatched types 'const boost::shared_ptr<X>' and 'libtorrent::torrent_info*'
p.ti = new libtorrent::torrent_info(r, ec);
^
In file included from /usr/include/boost/smart_ptr/shared_array.hpp:24:0,
from /usr/include/boost/shared_array.hpp:17,
from /usr/include/libtorrent/torrent_info.hpp:42,
from btfs.cc:32:
/usr/include/boost/smart_ptr/shared_ptr.hpp:544:18: note: candidate: template<class Y> boost::shared_ptr<T>& boost::shared_ptr<T>::operator=(std::auto_ptr<_Tp1>&) [with Y = Y; T = libtorrent::torrent_info]
shared_ptr & operator=( std::auto_ptr<Y> & r )
^
/usr/include/boost/smart_ptr/shared_ptr.hpp:544:18: note: template argument deduction/substitution failed:
btfs.cc:657:8: note: mismatched types 'std::auto_ptr<Y>' and 'libtorrent::torrent_info*'
p.ti = new libtorrent::torrent_info(r, ec);
^
In file included from /usr/include/boost/smart_ptr/shared_array.hpp:24:0,
from /usr/include/boost/shared_array.hpp:17,
from /usr/include/libtorrent/torrent_info.hpp:42,
from btfs.cc:32:
/usr/include/boost/smart_ptr/shared_ptr.hpp:562:77: note: candidate: template<class Ap> typename boost::detail::sp_enable_if_auto_ptr<Ap, boost::shared_ptr<T>&>::type boost::shared_ptr<T>::operator=(Ap) [with Ap = Ap; T = libtorrent::torrent_info]
typename boost::detail::sp_enable_if_auto_ptr< Ap, shared_ptr & >::type operator=( Ap r )
^
/usr/include/boost/smart_ptr/shared_ptr.hpp:562:77: note: template argument deduction/substitution failed:
/usr/include/boost/smart_ptr/shared_ptr.hpp: In substitution of 'template<class Ap> typename boost::detail::sp_enable_if_auto_ptr<Ap, boost::shared_ptr<T>&>::type boost::shared_ptr<T>::operator=(Ap) [with Ap = libtorrent::torrent_info*]':
btfs.cc:657:8: required from here
/usr/include/boost/smart_ptr/shared_ptr.hpp:562:77: error: no type named 'type' in 'struct boost::detail::sp_enable_if_auto_ptr<libtorrent::torrent_info*, boost::shared_ptr<libtorrent::torrent_info>&>'
/usr/include/boost/smart_ptr/shared_ptr.hpp:584:18: note: candidate: template<class Y, class D> boost::shared_ptr<T>& boost::shared_ptr<T>::operator=(boost::movelib::unique_ptr<Y, D>) [with Y = Y; D = D; T = libtorrent::torrent_info]
shared_ptr & operator=( boost::movelib::unique_ptr<Y, D> r )
^
/usr/include/boost/smart_ptr/shared_ptr.hpp:584:18: note: template argument deduction/substitution failed:
btfs.cc:657:8: note: mismatched types 'boost::movelib::unique_ptr<Y, D>' and 'libtorrent::torrent_info*'
p.ti = new libtorrent::torrent_info(r, ec);
^
Makefile:385: recipe for target 'btfs-btfs.o' failed
make[1]: *** [btfs-btfs.o] Error 1
make[1]: Leaving directory '/build/btfs/src/btfs/src'
Makefile:346: recipe for target 'all-recursive' failed
make: *** [all-recursive] Error 1
Thanks for testing btfs with newest libtorrent.
You have any patches?
Not yet, sorry. I am not familiar with libtorrent myself :(
From libtorrent-rasterbar 1.1 changelog: "torrent_info is no longer an intrusive_ptr type. It is held by shared_ptr." So patch should be something like:
diff --git a/src/btfs.cc b/src/btfs.cc
index bbdf6d3..036347f 100644
--- a/src/btfs.cc
+++ b/src/btfs.cc
@@ -629,7 +629,7 @@ populate_metadata(libtorrent::add_torrent_params& p, const char *arg) {
libtorrent::error_code ec;
- p.ti = new libtorrent::torrent_info((const char *) output.buf,
+ p.ti = boost::make_shared<libtorrent::torrent_info>((const char *) output.buf,
(int) output.size, ec);
if (ec)
@@ -654,7 +654,7 @@ populate_metadata(libtorrent::add_torrent_params& p, const char *arg) {
libtorrent::error_code ec;
- p.ti = new libtorrent::torrent_info(r, ec);
+ p.ti = boost::make_shared<libtorrent::torrent_info>(r, ec);
free(r);
Note: I haven't tried it.
Thank you, and really sorry for the late reply. I have applied the change, and now it's getting another error:
g++ -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -Wl,-O1,--sort-common,--as-needed,-z,relro -o btfs btfs-btfs.o -lfuse -pthread -ltorrent-rasterbar -lboost_system -lcurl
btfs-btfs.o: In function `alert_queue_loop(void*)':
btfs.cc:(.text+0x2cbd): undefined reference to `libtorrent::session_handle::wait_for_alert(std::chrono::duration<long, std::ratio<1l, 1000000000l> >)'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:360: btfs] Error 1
I don't have this error. btfs
compiled successfully with patch from #28 (comment). But I installed libtorrent-rasterbar-1.1
to custom directory and exported PKG_CONFIG_PATH
before running configure
:
$ export PKG_CONFIG_PATH=/main/work/btfs/libtorrent-libtorrent-1_1/build/lib/pkgconfig/
which resulted in following compilation command:
g++ -g -O2 -o btfs btfs-btfs.o -lfuse -pthread -L/main/work/btfs/libtorrent-libtorrent-1_1/build/lib -ltorrent-rasterbar -lboost_system -lcurl -lpthread
Unfortunately this patch breaks build with previous libtorrent version.
What about this one:
diff --git a/src/btfs.cc b/src/btfs.cc
index bbdf6d3..6c0a885
--- a/src/btfs.cc
+++ b/src/btfs.cc
@@ -629,7 +629,11 @@ populate_metadata(libtorrent::add_torrent_params& p, const char *arg) {
libtorrent::error_code ec;
+#if LIBTORRENT_VERSION_NUM < 10100
p.ti = new libtorrent::torrent_info((const char *) output.buf,
+#else
+ p.ti = boost::make_shared<libtorrent::torrent_info>((const char *) output.buf,
+#endif
(int) output.size, ec);
if (ec)
@@ -654,7 +658,11 @@ populate_metadata(libtorrent::add_torrent_params& p, const char *arg) {
libtorrent::error_code ec;
+#if LIBTORRENT_VERSION_NUM < 10100
p.ti = new libtorrent::torrent_info(r, ec);
+#else
+ p.ti = boost::make_shared<libtorrent::torrent_info>(r, ec);
+#endif
free(r);
It builds on both 1.0.x and 1.1.x on my machine (Arch Linux x64).
Yes, that's better.
Fixed on master.