facebook / openr

Distributed platform for building autonomic network functions.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't compile in ubuntu docker images

jeroen-dhollander opened this issue · comments

Issue Description

I'm trying to compile open/r using the docker images, but it fails for both the Ubuntu 14 and 16 images

Environment

  • tag or commit hash on which this occured
    master
  • OS version: <e.g. ubuntu-16.04>
    host: CentOS 7
    docker: Ubuntu-16.04 and Ubuntu-14.04

Minimal test code / Steps to reproduce the issue

For Ubuntu-16.04:

    ./make_docker_context.py --prefix /tmp/openr-output --projects-dir /tmp/openr-output --make-parallelism 5 --os-image ubuntu:16.04 --docker-context-dir /tmp/openr-docker --gcc-version 5
    cd /tmp/openr-docker
    docker build .
    docker run -ti -v /tmp:/tmp -u root <image-id> bash
    cd /tmp/openr/build/
    ./build_openr.sh

For Ubuntu-14.04:

    ./make_docker_context.py --prefix /tmp/openr-output --projects-dir /tmp/openr-output --make-parallelism 5 --os-image ubuntu:14.04 --docker-context-dir /tmp/openr-docker
    cd /tmp/openr-docker
    docker build .
    docker run -ti -v /tmp:/tmp -u root <image-id> bash
    cd /tmp/openr/build/
    ./build_openr.sh

What's the actual result?

For Ubuntu-16.04:

root@8a4eee82e97b:/tmp/openr/build# ./build_openr.sh 
+++ dirname ./build_openr.sh
++ readlink -f .
+ BUILD_DIR=/tmp/openr/build
+ export DESTDIR=
+ DESTDIR=
+ mkdir -p /tmp/openr/build/deps
+ cd /tmp/openr/build/deps
+ sudo apt-get update
<snip lots of updates>
checking if g++ supports C++1y features with -std=gnu++1y... yes
checking whether -Wunknown-warning-option is supported... no
checking whether -Wshadow-local and -Wshadow-compatible-local are supported... no
checking for main in -lgflags... yes
checking for gflags viability... no
configure: error: "gflags invalid, see config.log for details"

And in the ./deps/folly/folly/config.log I see this:

configure:17189: checking for main in -lgflags
configure:17208: g++ -o conftest -std=gnu++1y -g -O2   conftest.cpp -lgflags  -lpthread >&5
configure:17208: $? = 0
configure:17217: result: yes
configure:17231: checking for gflags viability
configure:17253: g++ -o conftest -std=gnu++1y -g -O2   conftest.cpp -lgflags -lpthread >&5
/tmp/ccA8lQpH.o: In function `__static_initialization_and_destruction_0':
/tmp/openr/build/deps/folly/folly/conftest.cpp:27: undefined reference to `google::FlagRegisterer::FlagRegisterer<bool>(char const*, char const*, char const*, bool*, bool*)'
/tmp/openr/build/deps/folly/folly/conftest.cpp:28: undefined reference to `google::FlagRegisterer::FlagRegisterer<bool>(char const*, char const*, char const*, bool*, bool*)'
collect2: error: ld returned 1 exit status
configure:17253: $? = 1
configure: program exited with status 1

For Ubuntu-14.04:

root@e05e6f736ee9:/tmp/openr/build# sudo ./build_openr.sh 
+++ dirname ./build_openr.sh
++ readlink -f .
+ BUILD_DIR=/tmp/openr/build
+ export DESTDIR=
+ DESTDIR=
+ mkdir -p /tmp/openr/build/deps
+ cd /tmp/openr/build/deps
+ sudo apt-get update
<snip lots of updates>
libtool: link: (cd ".libs" && rm -f "libglog.so.0" && ln -s "libglog.so.0.0.0" "libglog.so.0")
libtool: link: (cd ".libs" && rm -f "libglog.so" && ln -s "libglog.so.0.0.0" "libglog.so")
libtool: link: ar cru .libs/libglog.a  src/libglog_la-logging.o src/libglog_la-raw_logging.o src/libglog_la-vlog_is_on.o src/libglog_la-utilities.o src/libglog_la-demangle.o src/libglog_la-symbolize.o src/libglog_la-signalhandler.o
libtool: link: ranlib .libs/libglog.a
libtool: link: ( cd ".libs" && rm -f "libglog.la" && ln -s "../libglog.la" "libglog.la" )
g++ -DHAVE_CONFIG_H -I. -I./src  -I./src  -pthread     -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare  -DNO_FRAME_POINTER  -g -O2 -MT src/logging_unittest-logging_unittest.o -MD -MP -MF src/.deps/logging_unittest-logging_unittest.Tpo -c -o src/logging_unittest-logging_unittest.o `test -f 'src/logging_unittest.cc' || echo './'`src/logging_unittest.cc
src/logging_unittest.cc:64:17: error: 'GFLAGS_NAMESPACE' is not a namespace-name
 using namespace GFLAGS_NAMESPACE;
                 ^
src/logging_unittest.cc:64:33: error: expected namespace-name before ';' token
 using namespace GFLAGS_NAMESPACE;
                                 ^
make: *** [src/logging_unittest-logging_unittest.o] Error 1

What's the expected result?

Being able to build open/r

Can you try running via travis_docker_build.sh? i ran os_image=ubuntu:16.04 gcc_version=5 ./travis_docker_build.sh without issue. That is the workflow we check in travis ci. if that works, you can look through the relevant scripts to see how options are being passed around and hopefully that will solve the problem

Thanks to your suggestion in issue 23 I was now able to generate the docker image correctly,
which also solves this issue (as the docker build . command now generates the openr library).

Thanks a lot!

Jeroen