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

Samples get linked with system glog.so and glogd.so built from source resulting in conflicts #51

Closed
vicvicg opened this issue Sep 14, 2021 · 8 comments

Comments

@vicvicg
Copy link

vicvicg commented Sep 14, 2021

Samples from ./examples/[simple_cache|simple_compact_cache] get linked with system glog.so and glogd.so built from source resulting in conflicts.

Steps to reproduce:

./contrib/build.sh -d -v # Build CacheLib
cd examples/simple_cache/
./build.sh # Build simple_cache example
ldd build/simple-cache-example | grep glog
libglog.so.0 => /lib/x86_64-linux-gnu/libglog.so.0 (0x00007f0d95bae000)
libglogd.so.0 => /home//CacheLib/opt/cachelib/lib/libglogd.so.0 (0x00007f0d941ef000)
./build/simple-cache-example
ERROR: flag 'logtostderr' was defined more than once (in files '/home//CacheLib/cachelib/external/glog/src/logging.cc' and 'src/logging.cc').

OS: Ubuntu 20.04 running on WSL2.

@decibel26
Copy link

Getting the same error. I tried on a new VM Ubuntu 20.04.3 LTS, still getting the error.
ERROR: flag 'logtostderr' was defined more than once (in files '/home/student/CacheLib/cachelib/external/glog/src/logging.cc' and 'src/logging.cc').

@agordon
Copy link
Contributor

agordon commented Sep 15, 2021

Thank you for the bug report @vicvicg and @decibel26 - you stumbled on an edge case - building "cachelib" in debug mode (build.sh -d) and the sample in release mode (the default of the build.sh script).
I'll commit a fix that allows building the sample in debug mode as well.
As a temporary work-around, please try adding -DCMAKE_BUILD_TYPE=Debug to the CMAKE_PARAMS in line 28 of:

CMAKE_PARAMS="-DCMAKE_INSTALL_PREFIX='$PREFIX' -DCMAKE_MODULE_PATH='$CLCMAKE'"

@vicvicg
Copy link
Author

vicvicg commented Sep 15, 2021

-DCMAKE_BUILD_TYPE=Debug

Thank you, @agordon - this workaround works.

@sathyaphoenix
Copy link
Contributor

Thanks for the quick work-around @agordon !

@decibel26
Copy link

Worked for me as well. Thanks, @agordon.

@sathyaphoenix
Copy link
Contributor

@vicvicg Is this still an issue for you ?

@vicvicg
Copy link
Author

vicvicg commented Dec 9, 2021

@sathyaphoenix What is the recommended way to switch between release and debug builds for samples without modifying the build file itself?

@sathyaphoenix
Copy link
Contributor

@agordon is the fix that you mention committed to main branch ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants