facebook / wangle

Wangle is a framework providing a set of common client/server abstractions for building services in a consistent, modular, and composable way.
Apache License 2.0
3.04k stars 536 forks source link

Installation: zstd reference not resolved #73

Closed hcl14 closed 7 years ago

hcl14 commented 7 years ago

While installing on Ubuntu 16.04 64-bit installation breaks with a number of errors:

recipe for target 'bin/ObservingHandlerTest' failed:
libfolly.so: undefined reference  to `ZSTD_initCStream'
...

etc...

zstd-1.1.0 is installed, the libraries are located at /usr/local/lib.

Fixed: added manually to CMakeLists.txt:

LINK_DIRECTORIES(/usr/local/lib)
set(zstd_DIR "/usr/local/lib")

target_link_libraries(wangle
  ${FOLLY_LIBRARIES}
  ${Boost_LIBRARIES}
  ${OPENSSL_LIBRARIES}
  ${GLOG_LIBRARY_PATH}
  ${GFLAGS_LIBRARY_PATH} libzstd.so)

The installer still reports a warning about possible conflict:

/usr/bin/ld: warning: libzstd.so.0, needed by /usr/local/lib/libfolly.so, may conflict with libzstd.so.1
Cyan4973 commented 7 years ago

Is it a double-installation issue ?

the older zstd version from Ubuntu in /usr/bin/ld, which is only v0.5.1 hence is missing quite a few prototypes, while the new zstd is within /usr/local/lib, is supposed to be v1.1.0, and therefore should work correctly ?

I suspect there are 2 libzstd.so, and the one selected is from the older installation, hence it targets libzstd.so.0. The newer version should be libzstd.so.1. Suggest to target this one instead.

Another alternative is to uninstall Ubuntu version, so that the only remaining one is the manually installed one, within /usr/local/lib.

Another idea is to play with path priority, and ensure that usr/local/lib get precedence.

hcl14 commented 7 years ago

Yes, looks like the last warning was because of double installation issue, it was gone after I uninstalled everything connected with zstd and installed again new version from sources. Now the shortcut libzstd.so points to libzstd.1.1.1024.so and shortcut libzstd.so.1 points to libzstd.so.1.1.1.

However, a huge pile of zstd dependency issues for libfolly also appear when I try to install fbthrift (my final goal is fblualib), you can check another my opened issue.

EDIT: tried to rebuild wangle again, removing my fix - no, the problem persists:

[ 50%] Linking CXX executable bin/ObservingHandlerTest
/usr/bin/ld: warning: libzstd.so.0, needed by /usr/local/lib/libfolly.so, not found (try using -rpath or -rpath-link)
/usr/local/lib/libfolly.so: undefined reference to `ZSTD_initCStream'
/usr/local/lib/libfolly.so: undefined reference to `ZSTD_freeCStream'
/usr/local/lib/libfolly.so: undefined reference to `ZSTD_maxCLevel'
/usr/local/lib/libfolly.so: undefined reference to `ZSTD_createCStream'
/usr/local/lib/libfolly.so: undefined reference to `ZSTD_isError'
/usr/local/lib/libfolly.so: undefined reference to `ZSTD_getDecompressedSize'
/usr/local/lib/libfolly.so: undefined reference to `ZSTD_getErrorName'
/usr/local/lib/libfolly.so: undefined reference to `ZSTD_endStream'
/usr/local/lib/libfolly.so: undefined reference to `ZSTD_compressBound'
/usr/local/lib/libfolly.so: undefined reference to `ZSTD_DStreamOutSize'
/usr/local/lib/libfolly.so: undefined reference to `ZSTD_createDStream'
/usr/local/lib/libfolly.so: undefined reference to `ZSTD_initDStream'
/usr/local/lib/libfolly.so: undefined reference to `ZSTD_freeDStream'
/usr/local/lib/libfolly.so: undefined reference to `ZSTD_compress'
/usr/local/lib/libfolly.so: undefined reference to `ZSTD_compressStream'
/usr/local/lib/libfolly.so: undefined reference to `ZSTD_decompressStream'
collect2: error: ld returned 1 exit status
CMakeFiles/ObservingHandlerTest.dir/build.make:109: recipe for target 'bin/ObservingHandlerTest' failed
make[2]: *** [bin/ObservingHandlerTest] Error 1
CMakeFiles/Makefile2:68: recipe for target 'CMakeFiles/ObservingHandlerTest.dir/all' failed
make[1]: *** [CMakeFiles/ObservingHandlerTest.dir/all] Error 2

EDIT2:

Fixed!

/usr/local/lib$ sudo cp libzstd.so.1.1.1 libzstd.so.0

I do not understand, all ubuntu packages were removed and it didn't say that it can't find the file, just unresolved dependencies...

Maybe libzstd.so.0 still existed somewhere.