Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: m0Ray on March 20, 2014, 09:26:29 AM



Title: [SOLVED] 0.9.0 compilation problem, libboost
Post by: m0Ray on March 20, 2014, 09:26:29 AM
Code:
  CXX      util.o
In file included from util.cpp:69:0:
/usr/include/boost/program_options/detail/config_file.hpp: In instantiation of ‘bool boost::program_options::detail::basic_config_file_iterator<charT>::getline(std::string&) [with charT = char; std::string = std::basic_string<char>]’:
util.cpp:1429:1:   required from here
/usr/include/boost/program_options/detail/config_file.hpp:164:13: error: ‘to_internal’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
In file included from /usr/include/boost/program_options/detail/parsers.hpp:9:0,
                 from /usr/include/boost/program_options/parsers.hpp:265,
                 from util.cpp:70:
/usr/include/boost/program_options/detail/convert.hpp:75:34: note: ‘template<class T> std::vector<std::basic_string<char> > boost::program_options::to_internal(const std::vector<T>&)’ declared here, later in the translation unit
make[3]: *** [util.o] Error 1

Linux, libboost 1.49.0 and gcc 4.7.2.

While searching for similar problems and solutions, I found that this problem in bitcoin was eliminated about 2 years ago. I found even special workarounds in util.cpp (bitcoin) and config_file.hpp (libboost includes) code. But now, as I see, this problem is back again.
Version 0.8.6 compiles without any problems. I tried to compile 0.9.0 on another distro with libboost 1.53 and it works. But I need 0.9.0 on my «tried and true» distro...

I never used libboost in my programs and now trying to understand, what happens, but still no success.

Can anyone help?


Title: Re: 0.9.0 compilation problem, libboost
Post by: wumpus on March 20, 2014, 09:49:18 AM
It's requesting another function than in the workaround. Can you try adding this line?
Code:
diff --git a/src/util.cpp b/src/util.cpp
index 36dfd8a..68c6543 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -78,6 +78,7 @@
 namespace boost {
     namespace program_options {
         std::string to_internal(const std::string&);
+        std::string to_internal(const std::vector<char>&);
     }
 }



Title: Re: 0.9.0 compilation problem, libboost
Post by: m0Ray on March 20, 2014, 10:02:42 AM
Applied the patch, still the same error.


Title: Re: 0.9.0 compilation problem, libboost
Post by: justbtcme on March 20, 2014, 04:06:09 PM
Seems like a redundant line.


Title: Re: 0.9.0 compilation problem, libboost
Post by: alienbob on March 25, 2014, 12:48:07 PM
I created a patch to revert the move of the lines that provided the workaround for older boost versions. Someone moved those lines after the boost includes which is not correct.
Can someone please inform the bitcoin developers about this?

Code:
# Between bitcoin 0.8.6 and 0.9.0 a workaround for older versions of boost
# was moved a bit down in the util.cpp file, thereby rendering it useless.
# This patch reverses that move of code.

--- bitcoin-0.9.0/src/util.cpp.orig 2014-03-16 11:05:28.000000000 +0100
+++ bitcoin-0.9.0/src/util.cpp 2014-03-25 12:00:33.825478432 +0100
@@ -66,10 +66,6 @@
 #include <boost/filesystem.hpp>
 #include <boost/filesystem/fstream.hpp>
 #include <boost/foreach.hpp>
-#include <boost/program_options/detail/config_file.hpp>
-#include <boost/program_options/parsers.hpp>
-#include <openssl/crypto.h>
-#include <openssl/rand.h>
 
 // Work around clang compilation problem in Boost 1.46:
 // /usr/include/boost/program_options/detail/config_file.hpp:163:17: error: call to function 'to_internal' that is neither visible in the template definition nor found by argument-dependent lookup
@@ -81,6 +77,10 @@
     }
 }
 
+#include <boost/program_options/detail/config_file.hpp>
+#include <boost/program_options/parsers.hpp>
+#include <openssl/crypto.h>
+#include <openssl/rand.h>
 
 using namespace std;

Eric
Visit my blog: http://alien.slackbook.org/blog/


Title: Re: 0.9.0 compilation problem, libboost
Post by: m0Ray on April 10, 2014, 06:18:45 PM
Applied alienbob's patch, works ok with 0.9.0 and 0.9.1.
Thanks!