facebook / CacheLib

Pluggable in-process caching engine to build and scale high performance services
https://www.cachelib.org
Apache License 2.0
1.18k stars 254 forks source link

Runtime error (seem to be caused by link error) #267

Closed wangyuyue closed 10 months ago

wangyuyue commented 10 months ago

Describe the bug Runtime error (seem to be caused by link error)

To Reproduce

git clone https://github.com/facebook/CacheLib
cd CacheLib
./contrib/build.sh -T -j
cd examples/simple_cache
./build.sh
./build/simple-cache-example

Expected behavior Run example program successfully

Output ERROR: something wrong with flag 'thrift_cpp2_simple_json_base64_allow_padding' in file '/users/glacier/CacheLib/cachelib/external/fbthrift/thrift/lib/cpp2/protocol/JSONProtocolCommon.cpp'. One possibility: file '/users/glacier/CacheLib/cachelib/external/fbthrift/thrift/lib/cpp2/protocol/JSONProtocolCommon.cpp' is being linked both statically and dynamically into this executable.

Desktop (please complete the following information):

siphonelee commented 10 months ago

Same error here on Ubuntu 20.04 when running: ./opt/cachelib/bin/cachebench --help

after:

git clone https://github.com/facebook/CacheLib cd CacheLib ./contrib/build.sh -T -j

jaesoo-fb commented 10 months ago

@wangyuyue @siphonelee Thanks for the report. We are working on the fix. Thanks

rainjuns commented 10 months ago

@jaesoo-fb Thank you for the help.

I met the same issue before.

At this time, ./contrib/build.sh -j -T fails to build fbthrift:

-- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.71.0/BoostConfig.cmake (found version "1.71.0") found components: filesystem
-- Found gflags from package config /CacheLib/opt/cachelib/lib/cmake/gflags/gflags-config.cmake
-- Found gflags as a dependency of glog::glog, include=/CacheLib/opt/cachelib/include, libs=gflags_shared
-- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.71.0/BoostConfig.cmake (found suitable version "1.71.0", minimum required is "1.51.0") found components: context filesystem program_options regex system thread
-- Found folly: /CacheLib/opt/cachelib
-- Found folly: /CacheLib/opt/cachelib
-- Found fizz: /CacheLib/opt/cachelib
-- Found wangle: /CacheLib/opt/cachelib
-- ZSTD: /CacheLib/opt/cachelib/include
-- Found folly: /CacheLib/opt/cachelib
-- Found folly: /CacheLib/opt/cachelib
-- Found fizz: /CacheLib/opt/cachelib
-- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.71.0/BoostConfig.cmake (found version "1.71.0") found components: iostreams system thread filesystem regex context
-- Found mvfst: /CacheLib/opt/cachelib
CMake Warning at CMakeLists.txt:122 (find_package):
  By not providing "Findpython-six.cmake" in CMAKE_MODULE_PATH this project
  has asked CMake to find a package configuration file provided by
  "python-six", but CMake did not find one.

  Could not find a package configuration file provided by "python-six" with
  any of the following names:

    python-sixConfig.cmake
    python-six-config.cmake

  Add the installation prefix of "python-six" to CMAKE_PREFIX_PATH or set
  "python-six_DIR" to a directory containing one of the above files.  If
  "python-six" provides a separate development package or SDK, be sure it has
  been installed.

-- Python dependencies not found, will not build thrift/lib/py
-- Configuring done
CMake Error: The inter-target dependency graph contains the following strongly connected component (cycle):
  "async" of type SHARED_LIBRARY
    depends on "transport" (weak)
    depends on "rpcmetadata" (weak)
    depends on "thriftprotocol" (weak)
  "transport" of type SHARED_LIBRARY
    depends on "rpcmetadata" (weak)
    depends on "thriftprotocol" (weak)
    depends on "async" (weak)
    depends on "rpcmetadata" (strong)
  "rpcmetadata" of type SHARED_LIBRARY
    depends on "thriftprotocol" (weak)
    depends on "async" (weak)
    depends on "transport" (weak)
  "thriftprotocol" of type SHARED_LIBRARY
    depends on "async" (weak)
    depends on "transport" (weak)
    depends on "rpcmetadata" (weak)
At least one of these targets is not a STATIC_LIBRARY.  Cyclic dependencies are allowed only among static libraries.
CMake Generate step failed.  Build files cannot be regenerated correctly.
build-package.sh: error: cmake failed on cachelib/external/fbthrift
build.sh: error: failed to build dependency 'fbthrift'
jaesoo-fb commented 10 months ago

Fixed by fbthrift change 0f3b4bf922b7 (Remove gflag in JSONProtocolCommon)