Matt,

Below is a long description of what I did to get sprout to compile on Centos 
6.4 x86_64.  I don't claim to have solved all the issues, so you should most 
definitely not consider these diffs safe, but perhaps you'll see what the 
underlying causes are and have better solutions.

--k

# Issue 1: Build dies when building libmemcached
#          libmemcached/csl/parser.cc:283:6: error: "YYENABLE_NLS" is not 
defined
#           and libmemcached/csl/parser.cc:779:6: error: "YYLTYPE_IS_TRIVIAL" 
is not defined
#          Fix sprout/modules/libmemcached/libmemcached/csl/parser.cc
#
#          The manner of the fix avoids simply '#ifdef YY<...>', following some 
conventions
#          found in similar patches online, such as 
#            
http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00000.html
#
[keller@dellserver csl]$ diff parser.cc parser.cc.dist 
283c283
< # if defined YYENABLE_NLS && YYENABLE_NLS
---
> # if YYENABLE_NLS
779c779
< # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
---
> # if YYLTYPE_IS_TRIVIAL

# Issue 2: Build dies looking for atomic include
#          "/home/keller/cw/sprout/include/accumulator.h:40:18: error: atomic: 
No such file or directory"
#          Fix reference to atomic in sprout/include/sas.h and accumulator.h
#
#          Note that Ubuntu ships with GNU g++ 4.7.3, CentOS with 4.4.7, and it 
appears that there were changes in this area
#          between the two. So, this 'fix' may not, ultimately, be complete.
#
[keller@dellserver include]$ diff sas.h sas.h.dist  # Identical diff for 
accumulator.h
43c43
< #include <cstdatomic>
---
> #include <atomic>

# Issue 3: Build dies because to_string function is ambiguous
#          connection_pool.cpp:427: error: call of overloaded ‘to_string(int&)’ 
is ambiguous
#          Fix by casting to long long in sprout/sprout/connection_pool.cpp, 
accumulator.cpp and flowtable.cpp
#
#          Again, this is not so much a real fix as a kludgey workaround for 
the fact that to_string(int)
#          isn't available to the old CentOS compiler.  In particular, there is 
NO suggestion from me
#          that it makes any more sense to cast to long long than one of the 
other options!
#
[keller@dellserver sprout]$ diff connection_pool.cpp connection_pool.cpp.dist
427c427
<     std::string connection_count = std::to_string(static_cast<long 
long>(it->second));
---
>     std::string connection_count = std::to_string(it->second);

[keller@dellserver sprout]$ diff accumulator.cpp accumulator.cpp.dist
138,141c138,141
<   values.push_back(std::to_string(static_cast<long long>(get_mean())));
<   values.push_back(std::to_string(static_cast<long long>(get_variance())));
<   values.push_back(std::to_string(static_cast<long long>(get_lwm())));
<   values.push_back(std::to_string(static_cast<long long>(get_hwm())));
---
>   values.push_back(std::to_string(get_mean()));
>   values.push_back(std::to_string(get_variance()));
>   values.push_back(std::to_string(get_lwm()));
>   values.push_back(std::to_string(get_hwm()));

[keller@dellserver sprout]$ diff flowtable.cpp flowtable.cpp.dist
217c217
<   message.push_back(std::to_string(static_cast<long 
long>(_tp2flow_map.size())));
---
>   message.push_back(std::to_string(_tp2flow_map.size()));


# Issue 4: Build dies because compare_exchange_weak function doesn't have right 
arguments
#          accumulator.cpp:56: error: no matching function for call to 
#           ‘std::__atomic2::__atomic_base<long long unsigned 
int>::compare_exchange_weak(uint_fast64_t&, long unsigned int&)’
#
#          --No fix applied--: comment out the code as it "appears" to be 
non-mainline function.
#                              Obviously, this is not a viable solution!
#          I speculate that the call conventions used in the code only became 
viable in GNU g++ 4.5
#          (per N2427 in http://gcc.gnu.org/projects/cxx0x.html) and therefore 
are not available to 
#          CentOS' GNU g++ 4.4.7 compiler.

# Issue 5: Linker dies because it can't find libboost_thread
#          /usr/bin/ld: cannot find -lboost_thread
#          Fix reference to boost_thread to be boost_thread-mt
#
#          The libraries come in the boost-thread RPM.  Interestingly, the 
other boost libraries 
#          referred to in the Makefile's LDFLAGS (in the same RPM) come in an 
-mt and non-mt variant, but boost_thread
#          only comes as libboost_thread-mt.
#
[keller@dellserver sprout]$ diff sprout/Makefile*
139c139
<            -lboost_thread-mt \
---
>            -lboost_thread \

# Issue 6: Make test fails 
#          ut/test_main.cpp:108: error: ‘PR_SET_PTRACER’ was not declared in 
this scope
#
#          --No fix applied--: Comment out the reference to prctl, since, per 
the prctl(2) man page, 
#                              PR_SET_PTRACER is unique to Ubuntu. However, it 
is not clear whether
#                              disabling this syscall on non-Ubuntu invalidates 
the whole purpose
#                              (e.g. something must be done in its stead to 
allow ptrace on CentOS)
#                              or if other OSes are simply more lenient and 
therefore removing
#                              the call to prctl on CentOS is harmless.
#
[keller@dellserver sprout]$ diff sprout/ut/test_main.cpp 
sprout/ut/test_main.cpp.dist
108,109c108
<   //PR_SET_PTRACER is not available on CentOS - see prctl(2)
<   //prctl(PR_SET_PTRACER, pid, 0, 0, 0);
---
>   prctl(PR_SET_PTRACER, pid, 0, 0, 0);

Thanks
_______________________________________________
Clearwater mailing list
[email protected]
http://lists.projectclearwater.org/listinfo/clearwater

Reply via email to