facebookincubator / velox

A C++ vectorized database acceleration library aimed to optimizing query engines and data processing systems.
https://velox-lib.io/
Apache License 2.0
3.28k stars 1.09k forks source link

Incompatibility with newer re2 due to changes to re2::StringPiece #7717

Open Swthaochen opened 7 months ago

Swthaochen commented 7 months ago

Problem description

I have some problems when build velox. I find that groupName is re2::StringPiece, but log says it is std::string_view and can not find as_string() function.

FAILED: velox/functions/prestosql/registration/CMakeFiles/velox_functions_prestosql.dir/StringFunctionsRegistration.cpp.o
ccache /Library/Developer/CommandLineTools/usr/bin/c++ -DBOOST_ATOMIC_DYN_LINK -DBOOST_ATOMIC_NO_LIB -DBOOST_CONTEXT_DYN_LINK -DBOOST_CONTEXT_NO_LIB -DBOOST_FILESYSTEM_DYN_LINK -DBOOST_FILESYSTEM_NO_LIB -DBOOST_PROGRAM_OPTIONS_DYN_LINK -DBOOST_PROGRAM_OPTIONS_NO_LIB -DBOOST_REGEX_DYN_LINK -DBOOST_REGEX_NO_LIB -DBOOST_SYSTEM_DYN_LINK -DBOOST_SYSTEM_NO_LIB -DBOOST_THREAD_DYN_LINK -DBOOST_THREAD_NO_LIB -DFMT_LOCALE -DFOLLY_HAVE_INT128_T=1 -DGFLAGS_IS_A_DLL=0 -DSIMDJSON_THREADS_ENABLED=1 -I/Users/user/code/cpp/velox/_build/release/_deps/protobuf-src/src -I/Users/user/code/cpp/velox/. -I/Users/user/code/cpp/velox/velox/external/xxhash -I/Users/user/code/cpp/velox/_build/release/_deps/xsimd-src/include -I/Users/user/code/cpp/velox/_build/release/_deps/simdjson-src/include -isystem /Users/user/code/cpp/velox/velox -isystem /Users/user/code/cpp/velox/velox/external -isystem /opt/homebrew/include -isystem /opt/homebrew/opt/openssl@1.1/include -isystem /usr/local/include -mcpu=apple-m1+crc -std=c++17 -fvisibility=hidden -D USE_VELOX_COMMON_BASE -D HAS_UNCAUGHT_EXCEPTIONS -Wall -Wextra -Wno-unused        -Wno-unused-parameter        -Wno-sign-compare        -Wno-ignored-qualifiers        -Wno-range-loop-analysis          -Wno-mismatched-tags          -Wno-nullability-completeness -Werror -O3 -DNDEBUG -std=gnu++17 -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.0.sdk -fPIC -fcolor-diagnostics -MD -MT velox/functions/prestosql/registration/CMakeFiles/velox_functions_prestosql.dir/StringFunctionsRegistration.cpp.o -MF velox/functions/prestosql/registration/CMakeFiles/velox_functions_prestosql.dir/StringFunctionsRegistration.cpp.o.d -o velox/functions/prestosql/registration/CMakeFiles/velox_functions_prestosql.dir/StringFunctionsRegistration.cpp.o -c /Users/user/code/cpp/velox/velox/functions/prestosql/registration/StringFunctionsRegistration.cpp
In file included from /Users/user/code/cpp/velox/velox/functions/prestosql/registration/StringFunctionsRegistration.cpp:18:
/Users/user/code/cpp/velox/./velox/functions/prestosql/RegexpReplace.h:77:66: error: no member named 'as_string' in 'std::string_view'
    auto groupIter = re.NamedCapturingGroups().find(groupName[1].as_string());
                                                    ~~~~~~~~~~~~ ^
/Users/user/code/cpp/velox/./velox/functions/prestosql/RegexpReplace.h:81:24: error: no member named 'as_string' in 'std::string_view'
          groupName[1].as_string());
          ~~~~~~~~~~~~ ^
/Users/user/code/cpp/velox/./velox/common/base/Exceptions.h:383:9: note: expanded from macro 'VELOX_USER_FAIL'
      ##__VA_ARGS__)
        ^~~~~~~~~~~
/Users/user/code/cpp/velox/./velox/common/base/Exceptions.h:192:38: note: expanded from macro '_VELOX_THROW'
  _VELOX_THROW_IMPL(exception, "", ##__VA_ARGS__)
                                     ^~~~~~~~~~~
/Users/user/code/cpp/velox/./velox/common/base/Exceptions.h:172:60: note: expanded from macro '_VELOX_THROW_IMPL'
    auto message = ::facebook::velox::detail::errorMessage(__VA_ARGS__); \
                                                           ^~~~~~~~~~~
In file included from /Users/user/code/cpp/velox/velox/functions/prestosql/registration/StringFunctionsRegistration.cpp:18:
/Users/user/code/cpp/velox/./velox/functions/prestosql/RegexpReplace.h:86:49: error: no member named 'as_string' in 'std::string_view'
        fmt::format(R"(\${{{}}})", groupName[1].as_string()),
                                   ~~~~~~~~~~~~ ^
3 errors generated.
[23/338] Building CXX object velox/connectors/tpch/tests/CMakeFiles/velox_tpch_connector_test.dir/TpchConnectorTest.cpp.o
ninja: build stopped: subcommand failed.
make[1]: *** [build] Error 1
make: *** [release] Error 2

System information

my system is MacOS 14.4. Here is some information: I build code with Xcode 15 too, here is my information: Apple clang version 15.0.0 (clang-1500.0.40.1) Target: arm64-apple-darwin23.1.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin

CMake log

No response

assignUser commented 5 months ago

It seems we are not compatible with newer versions of re2. You can workaround this by setting the envvar re2_SOURCE=BUNDLED to force use of our older, bundled version.

cc @kgpai

assignUser commented 5 months ago

It's caused by this change: https://github.com/google/re2/commit/49d776b9d29d79b6e2876d5f091d2207d8123dfa#diff-3575b93827d50e6bd516e94b3511782f72bac0315d105c5de8d0c10b7f4a9fb8