Add a disgusting and terrible hack to avoid "undefined std::istream::ignore(long)" linking errors.

This makes building our bindings in the provided docker image possible again.
This commit is contained in:
Alex Miller 2018-04-26 14:04:51 -07:00
parent e7e4beed9c
commit 11bd7d7daf
1 changed files with 22 additions and 0 deletions

View File

@ -2645,6 +2645,28 @@ void setupSlowTaskProfiler() {
#endif #endif
} }
#ifdef __linux__
// There's no good place to put this, so it's here.
// Ubuntu's packaging of libstdc++_pic offers different symbols than libstdc++. Go figure.
// Notably, it's missing a definition of std::istream::ignore(long), which causes compilation errors
// in the bindings. Thus, we provide weak versions of their definitions, so that if the
// linked-against libstdc++ is missing their definitions, we'll be able to use the provided
// ignore(long, int) version.
#include <istream>
namespace std {
typedef basic_istream<char, std::char_traits<char>> char_basic_istream;
template <>
char_basic_istream& __attribute__((weak)) char_basic_istream::ignore(streamsize count) {
return ignore(count, std::char_traits<char>::eof());
}
typedef basic_istream<wchar_t, std::char_traits<wchar_t>> wchar_basic_istream;
template <>
wchar_basic_istream& __attribute__((weak)) wchar_basic_istream::ignore(streamsize count) {
return ignore(count, std::char_traits<wchar_t>::eof());
}
}
#endif
// UnitTest for getMemoryInfo // UnitTest for getMemoryInfo
#ifdef __linux__ #ifdef __linux__
TEST_CASE("flow/Platform/getMemoryInfo") { TEST_CASE("flow/Platform/getMemoryInfo") {