camsas / firmament

The Firmament cluster scheduling platform
Apache License 2.0
415 stars 79 forks source link

Circular dependencies during `make` process #52

Closed dalanlan closed 7 years ago

dalanlan commented 7 years ago

I was involved into a small issue during make process in the following, which maybe I shouldn't have popped it up here.

$ mkdir build
$ cd build
$ cmake ..
$ make

The problem is shown below,

root@ubuntu:~/firmament/build# make
/usr/bin/ld: //usr/local/lib/libgflags.a(gflags.cc.o): undefined reference to symbol 'pthread_rwlock_wrlock@@GLIBC_2.2.5'
//lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[5]: *** [/root/firmament/build/third_party/flowlessly/src/flowlessly/build/flow_scheduler] Error 1
make[4]: *** [src/CMakeFiles/flow_scheduler.dir/all] Error 2
make[3]: *** [all] Error 2

basically I suspected that it's a circular dependencies issue, and I think that some required knobs are needed for Makefile. I tried this and other similar solution, yet no luck. Any suggestions, please?

ms705 commented 7 years ago

Hi @dalanlan,

Thanks for reporting this!

We haven't seen this issue before, but it sounds like there's something wrong with the libraries being linked. To better debug this, can you let us know some information about your setup, e.g., which version of Ubuntu you're running, what architecture you're on, and whether you have the libpthread-stubs0-dev and libgflags-dev packages installed. Can you please also share the output from the cmake .. command?

The specific issue you're encountering is in the build process for the Flowlessly solver, which is an external depency of Firmament's, but I suspect you would encounter errors when building Firmament too, since it depends on GFlags as well.

dalanlan commented 7 years ago

@ms705 Thanks so much for your help. I've found a way out of the previous issue myself, yet trapped into another headache shown below.

make[2]: *** No rule to make target `/usr/lib/x86_64-linux-gnu/libboost_filesystem.so', needed by `src/coordinator'.  Stop.
make[1]: *** [src/CMakeFiles/coordinator.dir/all] Error 2
make: *** [all] Error 2

And

# locate libboost_filesystem.so
/usr/lib/x86_64-linux-gnu/libboost_filesystem.so.1.54.0

And the fact is I've installed GLOG, GFLAGS and ctemplate manually, which causes a little trouble. Yet I didn't have a good luck with /script/fetch-externals.sh though (I guess the main reason is that I live in China and could have a networking issue). All I'm saying is that we could have a better guide in README for those required libraries, or it's just me that suffer?

# cmake ..
-- Boost version: 1.55.0
-- Found the following Boost libraries:
--   chrono
--   date_time
--   filesystem
--   regex
--   system
--   thread
--   timer
-- Configuring done
-- Generating done
-- Build files have been written to: /root/firmament/build
# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.5 LTS
Release:    14.04
Codename:   trusty
WIZARD-CXY commented 7 years ago

@ms705 I build a docker image with base os ubuntu 14.04, and finish doing fetch-externals.sh. software like boost is already in the image. All new developers have to do is "cmake and make", just wanna do a little contribution to this project. I think it makes easier to set up a new developing environment. The image is here https://hub.docker.com/r/wizardcxy/firmament/

ms705 commented 7 years ago

Thanks for the comments and the Docker image! We've tried to improve the build system (e.g., in ) to better notify developers of missing libraries, but the boostrap can still be a bit painful.

fetch-externals.sh is an old script that we used before moving to the CMake build system, and it will be removed soon (and replaced by a package installation script for Ubuntu).

@dalanlan: This sounds like you're missing a symlink from /usr/lib/x86_64-linux-gnu/libboost_filesystem.so to /usr/lib/x86_64-linux-gnu/libboost_filesystem.so.1.54.0. It's odd that this would be missing though -- can you share a full build log with us?

@WIZARD-CXY: Thanks, that's very useful! :+1: We've actually been thinking about offering Docker images (both for development and deployment) ourselves, and we have a Dockerfile in contrib/docker already. I'll check out your development image.

WIZARD-CXY commented 7 years ago

@ms705 your Dockerfile is good, sorry for not noticing, if there is a public docker image that developer can pull is better

dalanlan commented 7 years ago

@ms705

# make
[  1%] Built target cpplint
[  3%] Built target cs2
[  3%] Performing update step for 'flowlessly'
Already on 'master'
Your branch is behind 'origin/master' by 4 commits, and can be fast-forwarded.
  (use "git pull" to update your local branch)
[  3%] Performing configure step for 'flowlessly'
-- Configuring done
-- Generating done
-- Build files have been written to: /root/firmament/build/third_party/flowlessly/src/flowlessly-build
[  3%] Performing build step for 'flowlessly'
-- flowlessly build command succeeded.  See also /root/firmament/build/third_party/flowlessly/src/flowlessly-stamp/flowlessly-build-*.log

[  4%] No install step for 'flowlessly'
[  4%] Completed 'flowlessly'
[  5%] Built target flowlessly
[  5%] Performing update step for 'gtest'
Already on 'master'
Your branch is behind 'origin/master' by 4 commits, and can be fast-forwarded.
  (use "git pull" to update your local branch)
[  5%] Performing configure step for 'gtest'
-- Configuring done
-- Generating done
-- Build files have been written to: /root/firmament/build/third_party/gtest/src/gtest-build
[  5%] Performing build step for 'gtest'
-- gtest build command succeeded.  See also /root/firmament/build/third_party/gtest/src/gtest-stamp/gtest-build-*.log

[  5%] No install step for 'gtest'
[  6%] Completed 'gtest'
[  7%] Built target gtest
[  7%] Performing update step for 'pion'
Already on 'develop'
Your branch is up-to-date with 'origin/develop'.
[  7%] Performing configure step for 'pion'
CMAKE_CXX_COMPILER_VERSION = 4.8.4
>>> Building Pion version: 5.0.7
>>> EXECUTABLE_OUTPUT_PATH = /root/firmament/build/third_party/pion/src/pion-build/Bin/
-- Boost version: 1.55.0
-- Found the following Boost libraries:
--   thread
--   system
--   filesystem
--   regex
--   unit_test_framework
-- Could NOT find Doxygen (missing:  DOXYGEN_EXECUTABLE) 
BUILD_ALLOWNOTHINGSERVICE = off
BUILD_HELLOSERVICE = off
BUILD_ECHOSERVICE = off
BUILD_COOKIESERVICE = off
BUILD_LOGSERVICE = off
BUILD_FILESERVICE = off
BUILD_PIOND = off
BUILD_HELLOSERVER = off
-- Configuring done
-- Generating done
-- Build files have been written to: /root/firmament/build/third_party/pion/src/pion-build
[  7%] Performing build step for 'pion'
-- pion build command succeeded.  See also /root/firmament/build/third_party/pion/src/pion-stamp/pion-build-*.log

[  7%] Performing install step for 'pion'
-- pion install command succeeded.  See also /root/firmament/build/third_party/pion/src/pion-stamp/pion-install-*.log

[  8%] Completed 'pion'
[  9%] Built target pion
[  9%] Performing update step for 'protobuf3'
[  9%] Performing configure step for 'protobuf3'
-- Configuring done
-- Generating done
-- Build files have been written to: /root/firmament/build/third_party/protobuf3/src/protobuf3-build
[ 10%] Performing build step for 'protobuf3'
[ 39%] Built target libprotobuf
[ 51%] Built target libprotobuf-lite
[ 99%] Built target libprotoc
[100%] Built target protoc
[ 10%] No install step for 'protobuf3'
[ 10%] Completed 'protobuf3'
[ 11%] Built target protobuf3
[ 13%] Built target spooky-hash
[ 13%] Performing update step for 'thread-safe-stl-containers'
Already on 'master'
Your branch is up-to-date with 'origin/master'.
[ 13%] No configure step for 'thread-safe-stl-containers'
[ 14%] No build step for 'thread-safe-stl-containers'
[ 14%] No install step for 'thread-safe-stl-containers'
[ 14%] Completed 'thread-safe-stl-containers'
[ 15%] Built target thread-safe-stl-containers
[ 19%] Built target base
[ 23%] Built target storage
[ 23%] Generating job submission script protobufs...
[ 23%] Built target scripts_job
[ 27%] Built target engine
[ 32%] Built target executors
[ 38%] Built target messages
[ 41%] Built target misc
[ 41%] Built target misc_trace_generator
[ 43%] Built target platforms_unix
[ 53%] Built target scheduling
make[2]: *** No rule to make target `/usr/lib/x86_64-linux-gnu/libboost_filesystem.so', needed by `src/coordinator'.  Stop.
make[1]: *** [src/CMakeFiles/coordinator.dir/all] Error 2
make: *** [all] Error 2
ICGog commented 7 years ago

@dalanlan We have updated the script that installs Firmament's dependencies. Can you please go to your Firmament root directory and run the following: git pull ; ./scripts/install_packages.sh ; make ; cd build; make

Please let us know if it works. Alternatively, you could just install your missing dependency by running sudo apt-get install libboost-filesystem-dev.

dalanlan commented 7 years ago

It works! Thank you so much.