Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix build with gflags 2.1.x #6628

Open
ajkr opened this issue Apr 1, 2020 · 2 comments
Open

fix build with gflags 2.1.x #6628

ajkr opened this issue Apr 1, 2020 · 2 comments
Labels
bug Confirmed RocksDB bugs up-for-grabs Up for grabs

Comments

@ajkr
Copy link
Contributor

ajkr commented Apr 1, 2020

Builds against gflags 2.1.x built with default namespace may encounter errors like:

In file included from /home/andrewkr/local/rocksdb/tools/trace_analyzer_tool.cc:49:0:
/home/andrewkr/local/rocksdb/util/gflags_compat.h:11:26: error: ‘google’ has not been declared
 #define GFLAGS_NAMESPACE google

In gflags 2.1, the namespace changed from google to gflags. Meanwhile, it wasn't until 2.2 that the macro #define GFLAGS_NAMESPACE ... was introduced to a header file. So for 2.1 versions, this logic improperly guesses the namespace:

#ifndef GFLAGS_NAMESPACE
// in case it's not defined in old versions, that's probably because it was
// still google by default.
#define GFLAGS_NAMESPACE google
#endif
.

@ajkr ajkr added bug Confirmed RocksDB bugs up-for-grabs Up for grabs labels Apr 1, 2020
@iFA88
Copy link

iFA88 commented Feb 17, 2021

Hey @ajkr , sorry but i have still issue with this workaround -D GFLAGS_NAMESPACE=gflags :

CMake Warning:
  Manually-specified variables were not used by the project:

    GFLAGS_NAMESPACE

After build i can not use the library:
/usr/lib/x86_64-linux-gnu/librocksdb.so.6: undefined symbol: _ZN6google21ParseCommandLineFlagsEPiPPPcb

libgflags-dev has v2.1.2-4 on debian 9.

Rocksdb v6.8.1 works fine.

@ajkr
Copy link
Contributor Author

ajkr commented Jun 1, 2021

For the workaround, -DGFLAGS_NAMESPACE should be provided as a compiler flag, not as a CMake build option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Confirmed RocksDB bugs up-for-grabs Up for grabs
Projects
None yet
Development

No branches or pull requests

2 participants