I was trying to create my own module for lighttpd, after some minutes i've discovered that this is all in c! and i need maps and some other class i've made in c++. so i come across http://redmine.lighttpd.net/wiki/lighttpd/CppModules and also http://redmine.lighttpd.net/wiki/lighttpd/CppHelperClasses there is (for lighttpd-cpp) a mercurial project with some demo modules written here, but no explanation on how to copile and integrate these in the lighttpd environment.. these also in the /src/ directory didn't compile (obviously, all dependancies are missing..
src]# cpp mod_blank.cpp -o a
In file included from mod_blank.cpp:5:
mod_blank.hpp:5:35: error: lighttpd-cpp/plugin.hpp: No such file or directory
mod_blank.hpp:7:30: error: boost/mpl/list.hpp: No such file or directory
anyone have some idea? similar experience or other way to do a custome module using c++ ?
Update
Thanks to messa i have installed scons, tryed to compile and i got these errors
./include/lighttpd-cpp/datatype_helpers.hpp:86: error: invalid conversion from 'long unsigned int' to 'config_values_type_t'
./include/lighttpd-cpp/datatype_helpers.hpp: In instantiation of 'const config_values_type_t config_option_traits_base<short int, 2ul>::value_enum':
./include/lighttpd-cpp/datatype_helpers.hpp:347: instantiated from 'handler_t config_option<OptionType, ConfigScopeType, OptionTraits>::set_defaults(const server&) [with OptionType = short int, long unsigned int ConfigScopeType = 2ul, OptionTraits = config_option_traits<short int>]'
src/mod_blank.cpp:6: instantiated from here
./include/lighttpd-cpp/datatype_helpers.hpp:243: error: uninitialized const 'config_option_traits_base<short int, 2ul>::value_enum'
./include/lighttpd-cpp/datatype_helpers.hpp: In instantiation of 'const config_values_type_t config_option_traits_base<bool, 4ul>::value_enum':
./include/lighttpd-cpp/datatype_helpers.hpp:347: instantiated from 'handler_t config_option<OptionType, ConfigScopeType, OptionTraits>::set_defaults(const server&) [with OptionType = bool, long unsigned int ConfigScopeType = 2ul, OptionTraits = config_option_traits<bool>]'
src/mod_blank.cpp:6: instantiated from here
./include/lighttpd-cpp/datatype_helpers.hpp:243: error: uninitialized const 'config_option_traits_base<bool, 4ul>::value_enum'
./include/lighttpd-cpp/datatype_helpers.hpp: In instantiation of 'const config_values_type_t config_option_traits_base<int, 3ul>::value_enum':
./include/lighttpd-cpp/datatype_helpers.hpp:347: instantiated from 'handler_t config_option<OptionType, ConfigScopeType, OptionTraits>::set_defaults(const server&) [with OptionType = int, long unsigned int ConfigScopeType = 2ul, OptionTraits = config_option_traits<int>]'
src/mod_blank.cpp:6: instantiated from here
./include/lighttpd-cpp/datatype_helpers.hpp:243: error: uninitialized const 'config_option_traits_base<int, 3ul>::value_enum'
./include/lighttpd-cpp/datatype_helpers.hpp: In instantiation of 'const config_values_type_t config_option_traits_base<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, 1ul>::value_enum':
./include/lighttpd-cpp/datatype_helpers.hpp:347: instantiated from 'handler_t config_option<OptionType, ConfigScopeType, OptionTraits>::set_defaults(const server&) [with OptionType = std::basic_string<char, std::char_traits<char>, std::allocator<char> >, long unsigned int ConfigScopeType = 2ul, OptionTraits = config_option_traits<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >]'
src/mod_blank.cpp:6: instantiated from here
./include/lighttpd-cpp/datatype_helpers.hpp:243: error: uninitialized const 'config_option_traits_base<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, 1ul>::value_enum'
i'm running centos 5.5 64bit i have already a version of lighttpd compiled and installed here, also i didn't understood what's the role of lighttpd-cpp in building new lighttpd modules using cpp, i have to build everything from lighttpd-cpp and use this version instead of my lighttpd 1.4.28 downloaded from http://www.lighttpd.net/? if yes that's sad because i may loose updates and version stability using not so well tested lighttpd source, and instead, if i have to implement then new modules in old lighttpd, how to do that? :)
You are compiling it wrong - paths to header files are missing. You should use a build system, which is SCons in case of lighttpd-cpp. Install scons and then continue with README :)
Related
I'm trying to compile a piece of software called Bagel (a quantum chemistry program, some info are here) written in C++ and which uses Boost.
I get a compilation error, and as I don't know C++ and I've never used boost I'm essentially lost. The author of the program says the problem I'm experiences depends on my boost installation and not on the program itself.
I installed boost 1.73.0 (Linux Mint 20, g++ 9.3.0) doing:
sudo ./bootstrap.sh --prefix=/usr/local
sudo ./b2 install
When compiling the program I get the following error:
/usr/local/include/boost/serialization/access.hpp:119:11: error: ‘class std::unordered_set<long unsigned int>’ has no member named ‘serialize’
119 | t.serialize(ar, file_version);
| ~~^~~~~~~~~
/usr/local/include/boost/serialization/access.hpp: In instantiation of ‘static void boost::serialization::access::serialize(Archive&, T&, unsigned
int) [with Archive = boost::archive::binary_oarchive; T = std::unordered_set<long unsigned int>]’:
/usr/local/include/boost/serialization/serialization.hpp:69:22: required from ‘void boost::serialization::serialize(Archive&, T&, unsigned int)
[with Archive = boost::archive::binary_oarchive; T = std::unordered_set<long unsigned int>]’
/usr/local/include/boost/serialization/serialization.hpp:128:18: required from ‘void boost::serialization::serialize_adl(Archive&, T&, unsigned int) [with Archive = boost::archive::binary_oarchive; T = std::unordered_set<long unsigned int>]’
/usr/local/include/boost/archive/detail/oserializer.hpp:148:40: required from ‘void boost::archive::detail::oserializer<Archive, T>::save_object_data(boost::archive::detail::basic_oarchive&, const void*) const [with Archive = boost::archive::binary_oarchive; T = std::unordered_set<long unsigned int>]’
/usr/local/include/boost/archive/detail/oserializer.hpp:101:1: required from ‘class boost::archive::detail::oserializer<boost::archive::binary_oarchive, std::unordered_set<long unsigned int> >’
/usr/local/include/boost/archive/detail/oserializer.hpp:253:13: required from ‘static void boost::archive::detail::save_non_pointer_type<Archive>::save_standard::invoke(Archive&, const T&) [with T = std::unordered_set<long unsigned int>; Archive = boost::archive::binary_oarchive]’
/usr/local/include/boost/archive/detail/oserializer.hpp:308:22: [ skipping 21 instantiation contexts, use -ftemplate-backtrace-limit=0 to disable ]
...
The following post https://lists.boost.org/boost-users//2014/03/81583.php report on a similar error, but I don't understand what I should to solve it.
Any help would be appreciated!
Requirements say
Boost C++ Libraries - Version 1.53.0 or newer
Boost is famous of making non-backward compatible changes. 1.73 is quite distant from 1.53. I would try to install 1.53 which author of Bagel had to use and this one worked at least for him/her.
I'm using Clang 3.4.2. Whilst looking at a solution provided here:
Shared memory Vectors in boost with
The line:
typedef basic_string<char, std::char_traits<char>, salloc::rebind<char>::other> shared_string;
gives me the error:
error: use 'template' keyword to treat 'rebind' as a dependent template name
typedef basic_string<char, std::char_traits<char>, salloc::rebind<char>::other> shared_string;
I tried:
typedef basic_string<char, std::char_traits<char>, salloc::template rebind<char>::other> shared_string;
and even:
typedef basic_string<char, std::char_traits<char>, template salloc::rebind<char>::other> shared_string;
but I still get the error.
Could someone please help correct me in my ways?
I have an issue trying to compile a project under Mac OS X 10.8.5 using Boost libraries, version 1.34.1. I am using Xcode 4.6.3 and accompanying Command Line Tools. This must be an OS X specific issue, since the project compiles under CentOS Linux.
I am asking this here in hopes that someone has used Boost in OS X development and has maybe come across a similar issue.
I attach an excerpt of the compiler messages below. I have tried googling for the error, but can't seem to find satisfying answers. Please let me know if you can think of something from the top of your head or, which is more likely, if you need more info (e.g., source code excerpts) to be able to help me.
Thank you very much,
Best,
Sebastian
g++ -DPARC -DCPPPA_EXPORT= -fPIC -fno-common -D__STDC_LIMIT_MACROS -g -fno-inline -Wpointer-arith -Wwrite-strings -Wno-deprecated -Wreturn-type -W -I/usr/local/include -O2 -I../../src/include -I../../LexBase/src -I/include -I/usr/local/include/boost-1_34_1 -I/Users/sebastiansulger/projects/xle/dev/xfr/src/../../bgdb -Idb_client -I./ -I../include -Ifacts -Irules -Ichoices -Iterms -Imatches -Idriver -Iparser -Itriples -Iprolog -Idebug -Inew_parser -o terms/TermStorage.o -c terms/TermStorage.cpp
In file included from terms/TermStorage.cpp:9:
In file included from terms/TermStorage.h:28:
In file included from ./Types.h:26:
In file included from /usr/local/include/boost-1_34_1/boost/functional/hash.hpp:10:
/usr/local/include/boost-1_34_1/boost/functional/hash/hash.hpp:487:20: error:
call to 'hash_value' is ambiguous
return hash_value(val);
^~~~~~~~~~
/usr/include/c++/4.2.1/ext/hashtable.h:595:16: note: in instantiation of member
function 'boost::hash<long long>::operator()' requested here
{ return _M_hash(__key) % __n; }
^
/usr/include/c++/4.2.1/ext/hashtable.h:587:16: note: in instantiation of member
function '__gnu_cxx::hashtable<std::pair<const long long, unsigned int>,
long long, boost::hash<long long>, std::_Select1st<std::pair<const long
long, unsigned int> >, std::equal_to<long long>, std::allocator<unsigned
int> >::_M_bkt_num_key' requested here
{ return _M_bkt_num_key(__key, _M_buckets.size()); }
^
/usr/include/c++/4.2.1/ext/hashtable.h:522:18: note: in instantiation of member
function '__gnu_cxx::hashtable<std::pair<const long long, unsigned int>,
long long, boost::hash<long long>, std::_Select1st<std::pair<const long
long, unsigned int> >, std::equal_to<long long>, std::allocator<unsigned
int> >::_M_bkt_num_key' requested here
size_type __n = _M_bkt_num_key(__key);
^
/usr/include/c++/4.2.1/ext/hash_map:219:22: note: in instantiation of member
function '__gnu_cxx::hashtable<std::pair<const long long, unsigned int>,
long long, boost::hash<long long>, std::_Select1st<std::pair<const long
long, unsigned int> >, std::equal_to<long long>, std::allocator<unsigned
int> >::find' requested here
{ return _M_ht.find(__key); }
^
terms/TermStorage.h:97:46: note: in instantiation of member function
'__gnu_cxx::hash_map<long long, unsigned int, boost::hash<long long>,
std::equal_to<long long>, std::allocator<unsigned int> >::find' requested
here
TsHashMapIter iter = mParent->mHashMap.find(t);
^
terms/TermStorage.cpp:85:47: note: in instantiation of member function
'powerset::xfr::TermHashStorage<long long>::hashInsert' requested here
uint32_t index = (uint32_t) mIntTermStorage.hashInsert(intVal);
^
/usr/local/include/boost-1_34_1/boost/functional/hash/hash.hpp:105:24: note:
candidate function
inline std::size_t hash_value(int v)
^
/usr/local/include/boost-1_34_1/boost/functional/hash/hash.hpp:110:24: note:
candidate function
inline std::size_t hash_value(unsigned int v)
^
/usr/local/include/boost-1_34_1/boost/functional/hash/hash.hpp:115:24: note:
candidate function
inline std::size_t hash_value(long v)
^
/usr/local/include/boost-1_34_1/boost/functional/hash/hash.hpp:120:24: note:
candidate function
inline std::size_t hash_value(unsigned long v)
^
/usr/local/include/boost-1_34_1/boost/functional/hash/hash.hpp:229:24: note:
candidate function
inline std::size_t hash_value(float v)
^
/usr/local/include/boost-1_34_1/boost/functional/hash/hash.hpp:234:24: note:
candidate function
inline std::size_t hash_value(double v)
^
/usr/local/include/boost-1_34_1/boost/functional/hash/hash.hpp:239:24: note:
candidate function
inline std::size_t hash_value(long double v)
^
1 error generated.
make[1]: *** [terms/TermStorage.o] Error 1
make: *** [build] Error 2
Sebastian-Sulgers-MacBook-Pro:dev sebastiansulger$
EDIT: I have noticed that boost/functional/hash/hash.hpp includes the following:
#if defined(BOOST_HAS_LONG_LONG) && defined(_M_X64) && defined(_WIN64)
// On 64-bit windows std::size_t is a typedef for unsigned long long, which
// isn't due to be supported until Boost 1.35. So add support here.
// (Technically, Boost.Hash isn't actually documented as supporting
// std::size_t. But it would be pretty silly not to).
std::size_t hash_value(long long);
std::size_t hash_value(unsigned long long);
#endif
So it seems that the definition of the type is there, but not available for my system. Does that make any sense? Can I circumvent this somehow?
It basically says that there are lots of hash_value functions in hash.hpp, but none of them works for the type in your hash table (apparently long long).
Either your tools are too old for that type, or you don't compile with the proper -std=... parameter for the compiler.
I am getting this STATIC_ASSERT failure just by including karma.hpp:
In file included from /apps/boost/include/boost/math/special_functions/detail/round_fwd.hpp:12:0,
from /apps/boost/include/boost/math/special_functions/math_fwd.hpp:26,
from /apps/boost/include/boost/math/special_functions/fpclassify.hpp:19,
from /apps/boost/include/boost/spirit/home/support/detail/sign.hpp:22,
from /apps/boost/include/boost/spirit/home/karma/numeric/detail/numeric_utils.hpp:22,
from /apps/boost/include/boost/spirit/home/karma/numeric/bool_policies.hpp:16,
from /apps/boost/include/boost/spirit/home/karma/numeric/bool.hpp:29,
from /apps/boost/include/boost/spirit/home/karma/numeric.hpp:13,
from /apps/boost/include/boost/spirit/home/karma.hpp:15,
from /apps/boost/include/boost/spirit/include/karma.hpp:16,
from /home/<my header file that includes boost/spirit/include/karma.hpp>
from /home/<my other header file that includes the above>
/apps/boost/include/boost/math/tools/promotion.hpp: In instantiation of `struct boost::math::tools::promote_args<long double, float, float, float, float, float>':
/apps/boost/include/boost/math/special_functions/sign.hpp:114:50: required from `int boost::math::signbit(T) [with T = long double]'
/apps/boost/include/boost/spirit/home/support/detail/sign.hpp:47:51: required from `bool boost::spirit::detail::signbit(T) [with T = long double]'
/apps/boost/include/boost/spirit/home/karma/numeric/detail/numeric_utils.hpp:130:47: required from here
/apps/boost/include/boost/math/tools/promotion.hpp:141:10: error: invalid application of `sizeof' to incomplete type `boost::STATIC_ASSERTION_FAILURE<false>'
What gives? The best I can figure is that the static assert guards against use of long double where it is not supported. But, I use long double elsewhere and it is fine.
**EDIT: latest development release of Boost provides a fix-ish. Grab it from SVN.
When programming in c++ STL, or intensively using 'templatization', and some compiling error happens, often the error report is really long, and often too much not needed information is given.
I'm talking about gcc, i don't know if with other compilers is different, but some times even for just a typo, it takes a while to catch the error purging the
<ns::type<ns::type<ns::type, ns::type<...><ns::type<...> > > > >
I'm looking for some compiler flag, trick, workaround or methodology ( i currently copy past the error and put on two lines what i have and what compiler use to want and removing variables bookmarks... (kinda sad procedure for a not-so-uncommon ctrl+s non well performed)) that could make this task quicker or just helping me ( even only some IDE error syntax highlight... )
STLFilt: An STL Error Message Decryptor for C++ is a popular tool to filter these verbose error messages and turn them into something more legible.
From their website:
STLFilt was initially conceived as a teaching aid, to allow students
taking C++ and/or STL-specific workshops to make sense of typically
overbloated STL error messages. Today, however, even some C++ experts
have adopted STLFilt for use in everyday development. The results may
not always be perfect, but most of the time the information lost
during Decryption is not critical to the application being debugged.
The rest of the time, Decryption is easy enough to bypass.
The distribution for each platform (compiler/library set) is
self-contained and tuned to the idiosyncrasies of that platform. Each
Perl script performs basic regex substitutions for all the standard
(and extended, if present in the library) STL components, while
certain versions of the script go further with respect to message
ordering, line wrapping, library header error treatment, etc., as I
unilaterally deemed appropriate for that platform.
Here's a demo run that shows how it can be useful:
The source program:
#include <map>
#include <algorithm>
#include <cmath>
const int values[] = { 1,2,3,4,5 };
const int NVALS = sizeof values / sizeof (int);
int main()
{
using namespace std;
typedef map<int, double> valmap;
valmap m;
for (int i = 0; i < NVALS; i++)
m.insert(make_pair(values[i], pow(values[i], .5)));
valmap::iterator it = 100; // error
valmap::iterator it2(100); // error
m.insert(1,2); // error
return 0;
}
First, an unfiltered run using the MinGW gcc 3.2 compiler:
d:\src\cl\demo>c++2 rtmap.cpp
rtmap.cpp: In function `int main()':
rtmap.cpp:19: invalid conversion from `int' to `
std::_Rb_tree_node<std::pair<const int, double> >*'
rtmap.cpp:19: initializing argument 1 of `std::_Rb_tree_iterator<_Val, _Ref,
_Ptr>::_Rb_tree_iterator(std::_Rb_tree_node<_Val>*) [with _Val =
std::pair<const int, double>, _Ref = std::pair<const int, double>&, _Ptr =
std::pair<const int, double>*]'
rtmap.cpp:20: invalid conversion from `int' to `
std::_Rb_tree_node<std::pair<const int, double> >*'
rtmap.cpp:20: initializing argument 1 of `std::_Rb_tree_iterator<_Val, _Ref,
_Ptr>::_Rb_tree_iterator(std::_Rb_tree_node<_Val>*) [with _Val =
std::pair<const int, double>, _Ref = std::pair<const int, double>&, _Ptr =
std::pair<const int, double>*]'
E:/GCC3/include/c++/3.2/bits/stl_tree.h: In member function `void
std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::insert_unique(_II,
_II) [with _InputIterator = int, _Key = int, _Val = std::pair<const int,
double>, _KeyOfValue = std::_Select1st<std::pair<const int, double> >,
_Compare = std::less<int>, _Alloc = std::allocator<std::pair<const int,
double> >]':
E:/GCC3/include/c++/3.2/bits/stl_map.h:272: instantiated from `void std::map<_
Key, _Tp, _Compare, _Alloc>::insert(_InputIterator, _InputIterator) [with _Input
Iterator = int, _Key = int, _Tp = double, _Compare = std::less<int>, _Alloc = st
d::allocator<std::pair<const int, double> >]'
rtmap.cpp:21: instantiated from here
E:/GCC3/include/c++/3.2/bits/stl_tree.h:1161: invalid type argument of `unary *
'
And a filtered run using the gcc-specific Proxy c++:
d:\src\cl\demo>c++ rtmap.cpp
*** {BD Software Proxy c++ for gcc v3.01} STL Message Decryption is ON! ***
rtmap.cpp: In function `int main()':
rtmap.cpp:19: invalid conversion from `int' to `iter'
rtmap.cpp:19: initializing argument 1 of `iter(iter)'
rtmap.cpp:20: invalid conversion from `int' to `iter'
rtmap.cpp:20: initializing argument 1 of `iter(iter)'
stl_tree.h: In member function `void map<int,double>::insert_unique(_II, _II)':
[STL Decryptor: Suppressed 1 more STL standard header message]
rtmap.cpp:21: instantiated from here
stl_tree.h:1161: invalid type argument of `unary *'
STL Decryptor reminder:
Use the /hdr:L option to see all suppressed standard lib headers
[Note: demo runs were performed in an 80-column console window with
STLFilt's intelligent line wrapping enabled, and with internal
switches set to produce messages as terse as possible. More detail is
available by tailoring the Decryptor's options.]
The only downside I can see is that it mislabels the C++ Standard Library. :(
Here's a relevant journal article by STLFilt's author.
A few people have made tools to perform this, as there's nothing inbuilt. Tonnes on Google, but the top result returns: http://www.bdsoft.com/tools/stlfilt.html
It should be compatible with visual studio and gcc.
edit::
I need to type less to actually get input in time :)