facebook / CacheLib

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

Build error #62

Closed skyelves closed 3 years ago

skyelves commented 3 years ago

When I run ./contrib/build.sh -j -T, an error is thrown:

[ 94%] Linking CXX shared library libfolly.so /usr/bin/ld: /usr/local/lib/libfmt.a(format.cc.o): relocation R_X86_64_PC32 against symbol `stderr@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: final link failed: Bad value collect2: error: ld returned 1 exit status CMakeFiles/folly.dir/build.make:653: recipe for target 'libfolly.so.0.58.0-dev' failed make[2]: [libfolly.so.0.58.0-dev] Error 1 CMakeFiles/Makefile2:173: recipe for target 'CMakeFiles/folly.dir/all' failed make[1]: [CMakeFiles/folly.dir/all] Error 2 Makefile:129: recipe for target 'all' failed make: *** [all] Error 2 build-package.sh: error: make failed build.sh: error: failed to build dependency 'folly'

I tried -DCMAKE_POSITION_INDEPENDENT_CODE=TRUE and -fPIC and it doesn't work.

skyelves commented 3 years ago

I try to build and install all the independencies separately. And I seem to successfully install all of them, though with great effort. Then I successfully run ./contrib/build-package.sh -j -i -d -v -t cachelib and it says 'cachelib' is now installed. However, when I try the command ./bin/cachebench --help it returns ./bin/cachebench: symbol lookup error: ./bin/cachebench: undefined symbol: _ZN6google21kLogSiteUninitializedE Have no idea about the problem.

skyelves commented 3 years ago

It seems CacheLib relies an certain versions of its dependencies such as glogs and fmt. Can anyone specify the versions of them?

sathyaphoenix commented 3 years ago

It seems CacheLib relies an certain versions of its dependencies such as glogs and fmt. Can anyone specify the versions of them?

cc @agordon for information on that.

Can you share which platform you are trying this on ? We have github actions building the repo on a few platforms (ubuntu, debian, centos) and they seem to be green (except for the ubuntu one which looks like a configuration error).

skyelves commented 3 years ago

It seems CacheLib relies an certain versions of its dependencies such as glogs and fmt. Can anyone specify the versions of them?

cc @agordon for information on that.

Can you share which platform you are trying this on ? We have github actions building the repo on a few platforms (ubuntu, debian, centos) and they seem to be green (except for the ubuntu one which looks like a configuration error).

I am working on Ubuntu 18.04, 4.15.0-156-generic, with gcc (Ubuntu 7.5.0-3ubuntu1 18.04) 7.5.0 g++ (Ubuntu 7.5.0-3ubuntu1 18.04) 7.5.0

agordon commented 3 years ago

It seems CacheLib relies an certain versions of its dependencies such as glogs and fmt. Can anyone specify the versions of them?

@skyelves, it seems you have glog or fmt installed on the system (using apt-get) - this might be the reason for the conflict. CacheLib indeed uses its own versions of all packages (compiled and installed into a user subdirectory, so never override the system ones). This error hints to me we need to improve our build script to force it to ignore system-wide installation - I'll have a patch for that soon.

BTW, For glog we use version 0.5.0 - the last official release (see here: https://github.com/facebook/CacheLib/blob/main/contrib/build-package.sh#L120 ). For fmt - we use the latest git commit.

skyelves commented 3 years ago

Thanks, I have figured out the problem. Actually I am trying to build all the wrong dependencies myself. The first problem is because I didn't built the libfmt as a share lib so the link failed. After I built the libfmt as the shared lib, it works, though another problem occurs.

agordon commented 3 years ago

@skyelves - thanks for the update.

May I ask, was there a technical reason you tried to build the dependencies yourself? The build script (./contrib/build.sh) should take care of all the dependencies under normal conditions. was something not working? Or perhaps our documentation isn't clear about it?

skyelves commented 3 years ago

@skyelves - thanks for the update.

May I ask, was there a technical reason you tried to build the dependencies yourself? The build script (./contrib/build.sh) should take care of all the dependencies under normal conditions. was something not working? Or perhaps our documentation isn't clear about it?

Thanks for the reply! I have successfully built the CacheLib and ran the benchmark. In a nutshell, my problems come from two aspects.

  1. inconsistent libboost version.
  2. glog and fmt already installed on my server, which are built as static lib with different version.

Just as you mentioned before, "This error hints to me we need to improve our build script to force it to ignore system-wide installation - I'll have a patch for that soon." This would be quite beneficial for cases like me. Thanks again for your help!