Opened 11 years ago

Closed 10 years ago

#6790 closed Bugs (fixed)

program_options regression in 1.49.0?

Reported by: Konstantin Nikiforov <helllamer@…> Owned by: Vladimir Prus
Milestone: To Be Determined Component: program_options
Version: Boost 1.49.0 Severity: Regression
Keywords: Cc: helllamer@…

Description

Since 1.49, bitcoin unable to compile with error:

g++ -c -pthread -Wextra -Wno-sign-compare -Wno-char-subscripts \
-Wno-invalid-offsetof -Wformat -Wformat-security -g -DNOPCH \
-I/home/shahid/shares/install/linux/bitcoin/bitcoin \
/src/bitcoin-0.6.0-linux/src/src -DUSE_UPNP=1 -DUSE_SSL \
-fno-stack-protector -fstack-protector-all -Wstack-protector \
-Wl,-z,relro -Wl,-z,now -D_FORTIFY_SOURCE=2 -march=native -O3 \
-pipe -ftree-vectorize -msse -msse2 -msse3 -MMD -o obj/util.o \
util.cpp

In file included from util.cpp:8: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:1251:1:   required from here
/usr/include/boost/program_options/detail/config_file.hpp:163: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:9:
/usr/include/boost/program_options/detail/convert.hpp:75:34: замечание: «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
util.cpp: In function «void ShrinkDebugFile()»:
util.cpp:963:41: warning: ignoring return value of «size_t fwrite(const void*, size_t, size_t, FILE*)», declared with attribute warn_unused_result [-Wunused-result]

make: *** [obj/util.o] Error 1

Steps to reproduce:

wget bitcoin-0.6.0 from http://sourceforge.net/projects/bitcoin/files/Bitcoin/bitcoin-0.6.0/bitcoin-0.6.0-linux.tar.gz/download
tar xf bitcoin-0.6.0-linux.tar.gz
cd bitcoin-0.6.0-linux/src/src
make -f makefile.unix bitcoind

Steps to avoid error:

  • Error can be avoided by removing #if around #include <.../convert.hpp> in /usr/include/boost/program_options/detail/config_file.hpp

Change History (5)

comment:1 by Konstantin Nikiforov <helllamer@…>, 11 years ago

Cc: helllamer@… added

(And adding -DBOOST_FILESYSTEM_VERSION=2 does not help.)

comment:2 by Steve Robbins <smr@…>, 10 years ago

Konstantin: does this happen only with gcc 4.7 (as suggested by http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=671409) or generally? If the latter, what architecture?

I can successfully build using gcc 4.6 on Debian/amd64.

comment:3 by Konstantin Nikiforov <helllamer@…>, 10 years ago

Hmm, looks like, error can be fixed using -fpermissive in gcc-4.7.

g++ -c -pthread -Wextra -Wno-sign-compare -Wno-char-subscripts -Wno-invalid-offsetof -Wformat -Wformat-security -DNOPCH -I/home/shahid/shares/install/linux/pkgbuild/bitcoin/src/bitcoin-0.6.0-linux/src/src -DUSE_UPNP=1 -DUSE_SSL -fno-stack-protector -fstack-protector-all -Wstack-protector -Wl,-z,relro -Wl,-z,now -D_FORTIFY_SOURCE=2 -march=native -O3 -pipe -fstack-protector --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2 -ftree-vectorize -fpermissive -MMD -o obj/util.o util.cpp
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:9:
/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:1251:1:   required from here
/usr/include/boost/program_options/detail/convert.hpp:75:34: замечание: «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
util.cpp: В функции «void ShrinkDebugFile()»:
util.cpp:963:41: предупреждение: ignoring return value of «size_t fwrite(const void*, size_t, size_t, FILE*)», declared with attribute warn_unused_result [-Wunused-result]

-fpermissive + gcc-4.7 = no error, only warnings.

comment:4 by Konstantin Nikiforov <helllamer@…>, 10 years ago

In gcc-4.6 error is not reproduceable.

x86_64.

comment:5 by Vladimir Prus, 10 years ago

Resolution: fixed
Status: newclosed

(In [78331]) Include necessary header, don't rely on two-phase lookup not being there.

Fixes #6790.

Note: See TracTickets for help on using tickets.