rakshasa / libtorrent

libTorrent BitTorrent library
http://rtorrent.net/downloads/
GNU General Public License v2.0
885 stars 209 forks source link

Building libtorrent leaves torrent::request_list_constants::bucket_count undefined [with patch] #158

Open Rhialto opened 6 years ago

Rhialto commented 6 years ago

On NetBSD 7.0, using gcc 4.8, 4.9 or clang, configuring rtorrent fails on the xmlrpc-c test, not because of a failure to detect xmlrpc, but due to a linking problem with libtorrent.so:

configure:18003: checking for XMLRPC-C                                          
configure:18037: c++ -o conftest -O2 -D_FORTIFY_SOURCE=2 -I/usr/include
-I/usr/pkg/include -I/usr/include/krb5 -I/usr/pkg/include/ncurses -g -DDEBUG    
-pthread   -I/usr/pkg/include  -I/usr/pkg/include  -I/usr/pkg/include           
-I/usr/include -I/usr/pkg/include -I/usr/include/krb5 -I/usr/pkg/include/ncurses
-pthread -L/usr/lib -Wl,-R/usr/lib -L/usr/pkg/lib -Wl,-R/usr/pkg/lib     
conftest.cpp  -lncurses  -Wl,-R/usr/pkg/lib -L/usr/pkg/lib -lcurl               
-L/usr/pkg/lib -ltorrent  -L/usr/pkg/lib  -Wl,-rpath,/usr/pkg/lib          
-lxmlrpc_server -lxmlrpc -lxmlrpc_util -lxmlrpc_xmlparse -lxmlrpc_xmltok  >&5
/pkg_comp/obj/pkgsrc/net/rtorrent/default/.buildlink/lib/libtorrent.so:         
undefined reference to `torrent::request_list_constants::bucket_count'          
configure:18037: $? = 1                                                         
configure: failed program was:                                 
| /* confdefs.h */                                                              
| #define PACKAGE_NAME "rtorrent"                                               
| #define PACKAGE_TARNAME "rtorrent"                                            
| #define PACKAGE_VERSION "0.9.6"                                               
| #define PACKAGE_STRING "rtorrent 0.9.6"                                       
| #define PACKAGE_BUGREPORT "sundell.software@gmail.com"                        
| #define PACKAGE_URL ""                                                        
| #define API_VERSION 9                                                         
| #define PACKAGE "rtorrent"                                                    
| #define VERSION "0.9.6"                                                       
| #define STDC_HEADERS 1                                                        
| #define HAVE_SYS_TYPES_H 1                                                    
| #define HAVE_SYS_STAT_H 1                                                     
| #define HAVE_STDLIB_H 1                                                       
| #define HAVE_STRING_H 1                                                       
| #define HAVE_MEMORY_H 1                                                       
| #define HAVE_STRINGS_H 1                                                      
| #define HAVE_INTTYPES_H 1                                                     
| #define HAVE_STDINT_H 1                                                       
| #define HAVE_UNISTD_H 1                                                       
| #define HAVE_DLFCN_H 1                                                        
| #define LT_OBJDIR ".libs/"                                                    
| #define HAVE_TR1 1                                                            
| #define HAVE_CXX11 1                                                          
| #define RAK_USE_INET6 1                                                       
| #define USE_VARIABLE_FDSET 1                                                  
| #define HAVE_SYS_STATVFS_H 1                                                  
| #define FS_STAT_FD fstatvfs(fd, &m_stat) == 0                                 
| #define FS_STAT_FN statvfs(fn, &m_stat) == 0                                  
| #define FS_STAT_STRUCT struct statvfs                                         
| #define FS_STAT_SIZE_TYPE unsigned long                                       
| #define FS_STAT_COUNT_TYPE fsblkcnt_t                                         
| #define FS_STAT_BLOCK_SIZE (m_stat.f_frsize)                                  
| #define HAVE_PTHREAD 1                                                        
| #define HAVE_NCURSES 1                                                        
| #define HAVE_CURSES 1                                                         
| #define HAVE_CURSES_COLOR 1                                                   
| #define HAVE_CURSES_OBSOLETE 1                                                
| #define HAVE_NCURSES_CURSES_H 1                                               
| #define HAVE_CURSES_COLOR 1                                                   
| #define HAVE_CURSES_OBSOLETE 1                                                
| #define HAVE_NCURSES_H 1                                                      
| /* end confdefs.h.  */                                                        
|  #include <xmlrpc-c/server.h>                                                 
|                                                                               
| int                                                                           
| main ()                                                                       
| {                                                                             
|  xmlrpc_registry_new(NULL);                                                   
|   ;                                                                           
|   return 0;                                                                   
| }                                                                             
configure:18044: result: failed                                                 
configure:18046: error: Could not compile XMLRPC-C test.                        

Note the undefined reference to 'torrent::request_list_constants::bucket_count'

This patch will add that symbol:

--- src/protocol/request_list.cc.orig   2015-08-08 15:01:49.000000000 +0000     
+++ src/protocol/request_list.cc                                                
@@ -51,6 +51,7 @@                                                               
 #include "request_list.h"                                                      

 namespace torrent {                                                            
+  const int request_list_constants::bucket_count;                              

 const instrumentation_enum request_list_constants::instrumentation_added[bucket
_count] = {                                                                     
   INSTRUMENTATION_TRANSFER_REQUESTS_QUEUED_ADDED,