1

I wanted to build gflags and glog in my project. Below you see the code. I compiles nearly OK, but due to some compatibility error, I am presented with different fatal errors, depending on which gflags version I try to use in which glog version. As shown, I am presented with the error

./src/glog/stl_logging.h:56:11: fatal error: 'ext/slist' file not found
# include <ext/slist>" )

I found the proud message

Now glog's ABI around flags are compatible with gflags

on site, announcing glog 0.3.3 https://code.google.com/p/google-glog/

but I cannot figure out which version of gflags. (which I found strange, because glog depens on gflags)

# Install GFlags
ExternalProject_Add(
    GFlagsLib
    URL https://github.com/gflags/gflags/archive/master.zip
    CONFIGURE_COMMAND <SOURCE_DIR>/configure  --prefix=<INSTALL_DIR>
    )
ExternalProject_Get_Property(GFlagsLib install_dir)
include_directories(${install_dir}/include)
set(GFLAGS_LIBRARIES ${install_dir}/lib/libgflags.${link_library_suffix})
set(GFLAGS_PREFIX ${install_dir})

# Install GLog
ExternalProject_Add(
    GLogLib
    URL http://google-glog.googlecode.com/files/glog-0.3.3.tar.gz
    CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=<INSTALL_DIR> --with-gflags=${GFLAGS_PREFIX}
    )
ExternalProject_Get_Property(GLogLib install_dir)
usr1234567
  • 21,601
  • 16
  • 108
  • 128
katang
  • 2,474
  • 5
  • 24
  • 48
  • Include file `ext/slist` is unrelated with `gflags`. See, e.g., this [bugreport](https://code.google.com/p/google-glog/issues/detail?id=121). – Tsyvarev Nov 22 '15 at 21:41
  • @Tsyvarev This is very nice, but I guessed that a posted version can at least be compiled. I do not want to make patches, and worry about the fixes. Can I get two compatible versions (of gflags and glog), which I could use? – katang Nov 24 '15 at 20:59
  • 1
    Again, there is **no problem in compatibility between `gflags` and `glog`**. It is compatibility issue between `glog` and `c++` library: `glog` needs feature from `c++`, which is not specified by the C++ standard. According to [this answer](http://stackoverflow.com/a/19758541/3440745), this feature is accessible only in `libstdc++`, which is gcc-related library. – Tsyvarev Nov 24 '15 at 21:59

1 Answers1

0

I know this is an old question but I figured I'd give it a shot in case people from the future have a similar question. First off, it looks like you're pulling gflags from GitHub and glog from the old Google Code hosting site. At the time the question was posted glog had already moved to GitHub and made a newer release (0.3.4). That could have been a reason for the incompatibility.

Next, while CMake's ExternalProject_Add() function is useful for package management, it often results in having to having to roll your own version of find_package() via ExternalProject_Get_Property() to identify header and library locations for subsequent targets. As you can see, and I've run through the same headaches, it can get rather fragile.

Recently I've started using the Hunter package manager to handle dependencies in C++ projects and I can recommend it as a great alternative. I've used it in my own projects for gflags, glog and other libraries. Each Hunter release locks down the package versions (via a call to HunterGate() with the appropriate arguments) to help ensure a successful and reproducible build.

Perhaps thanks to competition from Python (pip) and Node.js (npm) C++ package management in general has improved quite a bit lately. You should also look at Conan.io (from JFrog) and Buckaroo (from Facebook) if you're interested.

v1bri
  • 1,398
  • 8
  • 13
  • Just to clarify: Buck build is made by Facebook, but Buckaroo is not. Buck is used as a build system by all Buckaroo packages, hence the name. https://buckaroo.readthedocs.io/en/latest/ – sdgfsdh Aug 08 '17 at 21:37