direct-code-execution / ns-3-dce

Run real programs in the discrete time simulator ns3
http://www.nsnam.org/projects/direct-code-execution/
75 stars 46 forks source link

Up-to-date Docker image? #143

Closed larseggert closed 4 months ago

larseggert commented 6 months ago

Is a Docker image (or Dockerfile) available with a recent ns3/DCE combo? I found https://hub.docker.com/r/thehajime/ns-3-dce, but that seems several years old.

thehajime commented 6 months ago

hello lars,

sorry the docker image repository isn't currently well maintained and only store a snapshot when the automated build was working last time.

it would be great if somebody work on revitalize the docker image.

tomhenderson commented 6 months ago

Hi Lars and Hajime, I have been using an image that I created for DCE 1.11 (Ubuntu16) privately, but I haven't had time to document it fully. I just pushed a branch if you want to try it out as-is.

git clone https://github.com/tomhenderson/dce-docker-beta.git
cd dce-docker-beta
git checkout -b dce-1.11-ubuntu-16 origin/dce-1.11-ubuntu-16
sudo docker-compose -p ubuntu16 up -d

should say:

Creating network "ubuntu16_default" with the default driver
Creating ns-3-dce-ubuntu-16 ... done

Then do:

sudo docker exec -it ns-3-dce-ubuntu-16 /bin/bash
cd bake
git init
git remote add origin https://gitlab.com/nsnam/bake.git
git fetch origin
git checkout master

Next, in the bakeconf.xml, you need to change line 2537:

      <depends_on name="net-next-nuse-4.4.0" optional="False"/>

to this:

      <depends_on name="net-next-nuse-4.4.0-fix1" optional="False"/>

Finally, add Python distro and requests modules:

pip install requests distro

Then, you can configure bake and try to build and test everything like:

./bake.py configure -e dce-linux-1.11
./bake.py download
./bake.py build
cd source/ns-3-dce
./test.py

Finally, after exiting the docker shell when you are done:

sudo docker-compose down

The above configuration will leave any checked out files on your local filesystem for later reuse.

The above is copied from my notes, but not tested again here-- I don't have disk space to give it a full try at the moment. Let me know if you hit any snags.

The above provides ns-3.34. I also privately created a version of the above that is compatible with ns-3.40 (latest release) but it involves doing more work installing gcc-9, cmake-3.11, and python3.6 on top of the above, and some library renaming. I will work on a new image with that when I get time.

The latest DCE 1.12 release is not stable; it would be a better environment (Ubuntu 20.04) but I discovered this fall that it is not complete and stable (and the 1.12 release was premature).

larseggert commented 6 months ago

Thank you for the detailed info! I'll take a look.

larseggert commented 5 months ago
sudo docker-compose -p ubuntu16 up -d
[+] Running 1/1
 ✘ bake-ns-3-dce Error                                                                                             1.9s
Error response from daemon: pull access denied for tomhend/ns-3-dce-ubuntu-16, repository does not exist or may require 'docker login': denied: requested access to the resource is denied
larseggert commented 5 months ago

I've also tried to build my own Dockerfile, but ubuntu:16.04 is just much too old to be a base for us.

larseggert commented 5 months ago

Here's what I have so far:

FROM ubuntu:20.04 AS builder

ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
    apt-get install -y --no-install-recommends \
    bc \
    bison \
    cmake \
    flex \
    g++ \
    gawk \
    git \
    libaspect-perl \
    libc6-dev \
    libc6-dbg \
    libdb-dev \
    libexpat-dev \
    libpcap-dev \
    libssl-dev \
    make \
    mercurial \
    ninja-build \
    patch \
    python3 \
    python3-pip \
    unzip \
    wget \
    && \
    rm -rf /var/lib/apt/lists/*

RUN pip3 install requests distro

WORKDIR /
RUN git clone --depth=1 https://gitlab.com/nsnam/bake.git

ENV PATH $PATH:/bake/build/bin:/bake/build/bin_dce
ENV LD_LIBRARY_PATH /bake/build/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
ENV DCE_PATH /bake/build/bin_dce:/bake/build/sbin

WORKDIR /bake
RUN ./bake.py check
RUN ./bake.py configure -e dce-linux-1.12
RUN ./bake.py download
RUN ./bake.py build -vvvv

It dies when building net-next-nuse-4.4.0-fix1:

#13 33.46 ./include/linux/compiler.h:484:38: error: call to ‘__compiletime_assert_252’ declared with attribute error: BUILD_BUG_ON failed: offsetof(struct dst_entry, __refcnt) & 63
#13 33.46   484 |  _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
#13 33.46       |                                      ^
#13 33.46 ./include/linux/compiler.h:467:4: note: in definition of macro ‘__compiletime_assert’
#13 33.46   467 |    prefix ## suffix();    \
#13 33.46       |    ^~~~~~
#13 33.46 ./include/linux/compiler.h:484:2: note: in expansion of macro ‘_compiletime_assert’
#13 33.46   484 |  _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
#13 33.46       |  ^~~~~~~~~~~~~~~~~~~
#13 33.46 ./include/linux/bug.h:50:37: note: in expansion of macro ‘compiletime_assert’
#13 33.46    50 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
#13 33.46       |                                     ^~~~~~~~~~~~~~~~~~
#13 33.46 ./include/linux/bug.h:74:2: note: in expansion of macro ‘BUILD_BUG_ON_MSG’
#13 33.46    74 |  BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
#13 33.46       |  ^~~~~~~~~~~~~~~~
#13 33.46 ./include/net/dst.h:252:2: note: in expansion of macro ‘BUILD_BUG_ON’
#13 33.46   252 |  BUILD_BUG_ON(offsetof(struct dst_entry, __refcnt) & 63);
#13 33.46       |  ^~~~~~~~~~~~
#13 33.47 make: *** [arch/lib/Makefile:198: net/core/sock.o] Error 1
#13 33.47  test -d /bake/source/net-next-nuse-4.4.0/no dir=/bake/source/net-next-nuse-4.4.0
#13 33.47  make defconfig ARCH=lib dir=/bake/source/net-next-nuse-4.4.0
#13 33.47  make library ARCH=lib dir=/bake/source/net-next-nuse-4.4.0
#13 33.47
#13 33.47  >> Building net-next-nuse-4.4.0-fix1 - Problem
#13 33.48    > Subprocess failed with error 2: ['make', 'library', 'ARCH=lib']
#13 33.48  > Error:  Critical dependency, module "net-next-nuse-4.4.0-fix1" failed
#13 33.48    For more information call Bake with --debug and/or -v, -vvv, for full verbose mode (bake --help)
#13 ERROR: process "/bin/sh -c ./bake.py build -vvvv" did not complete successfully: exit code: 1
------
 > [10/11] RUN ./bake.py build -vvvv:
33.46       |  ^~~~~~~~~~~~
33.47 make: *** [arch/lib/Makefile:198: net/core/sock.o] Error 1
33.47  test -d /bake/source/net-next-nuse-4.4.0/no dir=/bake/source/net-next-nuse-4.4.0
33.47  make defconfig ARCH=lib dir=/bake/source/net-next-nuse-4.4.0
33.47  make library ARCH=lib dir=/bake/source/net-next-nuse-4.4.0
33.47
33.47  >> Building net-next-nuse-4.4.0-fix1 - Problem
33.48    > Subprocess failed with error 2: ['make', 'library', 'ARCH=lib']
33.48  > Error:  Critical dependency, module "net-next-nuse-4.4.0-fix1" failed
33.48    For more information call Bake with --debug and/or -v, -vvv, for full verbose mode (bake --help)
------
Dockerfile:56
--------------------
  54 |     RUN ./bake.py configure -e dce-linux-1.12
  55 |     RUN ./bake.py download
  56 | >>> RUN ./bake.py build -vvvv
  57 |
--------------------
ERROR: failed to solve: process "/bin/sh -c ./bake.py build -vvvv" did not complete successfully: exit code: 1
larseggert commented 5 months ago

Some progress. With this Dockerfile

FROM ubuntu:20.04 AS builder

ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
    apt-get install -y --no-install-recommends \
    bison \
    build-essential \
    cmake \
    curl \
    g++ \
    gawk \
    git \
    make \
    mercurial \
    ninja-build \
    patch \
    pkg-config \
    python3-dev \
    python3-distro \
    python3-requests \
    python3-setuptools \
    rsync \
    unzip \
    && \
    rm -rf /var/lib/apt/lists/*

WORKDIR /
RUN git clone --depth=1 https://gitlab.com/nsnam/bake.git

ENV PATH $PATH:/bake/build/bin:/bake/build/bin_dce
ENV LD_LIBRARY_PATH /bake/build/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
ENV DCE_PATH /bake/build/bin_dce:/bake/build/sbin

WORKDIR /bake
RUN ./bake.py check
RUN ./bake.py configure -e dce-ns3-1.12
RUN ./bake.py download

# patch bash
RUN curl -L "http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD" > /bake/source/bash/support/config.guess
RUN curl -L "http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD" > /bake/source/bash/support/config.sub

RUN ./bake.py build -vvv

I now get to the "Building dce-ns3-1.12" step, which then fails quickly:

#14 487.5 [ 93/301] Compiling model/local-stream-socket-fd.cc
#14 487.5 ../model/libc-dce.cc:71:10: fatal error: sys/io.h: No such file or directory
#14 487.5    71 | #include <sys/io.h>
#14 487.5       |          ^~~~~~~~~~
#14 487.5 compilation terminated.
#14 487.5
#14 487.8 Waf: Leaving directory `/bake/source/ns-3-dce/build'
#14 487.8 Build failed
#14 487.8  -> task in './lib/ns3-dce' failed with exit status 1 (run with -v to display more information)
#14 487.8  /usr/bin/python3 /bake/source/ns-3-dce/waf configure --with-ns3=/bake/build --with-glibc=/bake/build/glibc --with-libaspect=/bake/build --prefix=/bake/build dir=/bake/source/ns-3-dce
#14 487.8  /usr/bin/python3 /bake/source/ns-3-dce/waf dir=/bake/source/ns-3-dce
#14 487.8
#14 487.8  >> Building dce-ns3-1.12 - Problem
#14 487.9    > Subprocess failed with error 1: ['/usr/bin/python3', '/bake/source/ns-3-dce/waf']
#14 487.9  > Error:  Critical dependency, module "dce-ns3-1.12" failed
#14 487.9    For more information call Bake with --debug and/or -v, -vvv, for full verbose mode (bake --help)
#14 ERROR: process "/bin/sh -c ./bake.py build -vvv" did not complete successfully: exit code: 1
------
 > [10/11] RUN ./bake.py build -vvv:
487.8 Waf: Leaving directory `/bake/source/ns-3-dce/build'
487.8 Build failed
487.8  -> task in './lib/ns3-dce' failed with exit status 1 (run with -v to display more information)
487.8  /usr/bin/python3 /bake/source/ns-3-dce/waf configure --with-ns3=/bake/build --with-glibc=/bake/build/glibc --with-libaspect=/bake/build --prefix=/bake/build dir=/bake/source/ns-3-dce
487.8  /usr/bin/python3 /bake/source/ns-3-dce/waf dir=/bake/source/ns-3-dce
487.8
487.8  >> Building dce-ns3-1.12 - Problem
487.9    > Subprocess failed with error 1: ['/usr/bin/python3', '/bake/source/ns-3-dce/waf']
487.9  > Error:  Critical dependency, module "dce-ns3-1.12" failed
487.9    For more information call Bake with --debug and/or -v, -vvv, for full verbose mode (bake --help)
------
WARNING: No output specified with docker-container driver. Build result will only remain in the build cache. To push result image into registry use --push or to load image into docker use --load
Dockerfile:43
--------------------
  41 |     RUN curl -L "http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD" > /bake/source/bash/support/config.sub
  42 |
  43 | >>> RUN ./bake.py build -vvv
  44 |
--------------------
ERROR: failed to solve: process "/bin/sh -c ./bake.py build -vvv" did not complete successfully: exit code: 1

View build details: docker-desktop://dashboard/build/distracted_euler/distracted_euler0/olbx61fep45f9jz6pj07ih1jx
tomhenderson commented 5 months ago
sudo docker-compose -p ubuntu16 up -d
[+] Running 1/1
 ✘ bake-ns-3-dce Error                                                                                             1.9s
Error response from daemon: pull access denied for tomhend/ns-3-dce-ubuntu-16, repository does not exist or may require 'docker login': denied: requested access to the resource is denied

Please try again; I forgot to push that image to DockerHub.

tomhenderson commented 5 months ago

I caution against using the Ubuntu 20.04 image and dce-1.12 release. I tried using it on a project recently and the performance was fragile. The DCE 1.12 release is different in that it uses a patched glibc rather than the system glibc of Ubuntu 16. There is something incomplete in that update of DCE that it is not working cleanly against this new glibc. It was not adequately tested before release (we should either fix or deprecate that release).

larseggert commented 5 months ago

I understand, but I can't even get bake to work correctly on xenial. Also, the app I am interested in eventually running via DCE doesn't support it, since it's so old. I'm hoping to get 1.12 to work and then do a relatively painless bump to 1.13 whenever that comes.

tomhenderson commented 5 months ago

I understand, but I can't even get bake to work correctly on xenial. Also, the app I am interested in eventually running via DCE doesn't support it, since it's so old. I'm hoping to get 1.12 to work and then do a relatively painless bump to 1.13 whenever that comes.

Bake works on xenial. I am testing the instructions provided above as I type this. I had to add two Python packages to the base image ('requests' and 'distro')-- please see above.

tomhenderson commented 5 months ago

Just tried with that image, and it is failing the final DCE build step because I added a newer compiler (g++-9) and it fails with this issue: https://github.com/direct-code-execution/ns-3-dce/issues/46

The workaround is to force usage of g++-5 on the final (ns-3-dce) build step.

cd source/ns-3-dce
rm -rf build
CXX=g++-5 ./waf configure --with-ns3=../../build --prefix=/bake/bake/build --disable-python
./waf build
./waf install

The linker relocation error should not be present when using g++-5.

I will create a clean image at some point in the near future.

larseggert commented 5 months ago

@tomhenderson is your Dockerfile available somewhere? I can build the image over here.

tomhenderson commented 5 months ago

@tomhenderson is your Dockerfile available somewhere? I can build the image over here.

I just pushed it here: https://github.com/tomhenderson/dce-docker-beta/tree/dce-1.11-ubuntu-16

I think it should provide a working DCE 1.11 and ns-3.34, on an Ubuntu 16 base. I haven't recently tried to make a brand new image with it.

larseggert commented 5 months ago

@tomhenderson thanks, but that Dockerfile fails for me as follows:

Dockerfile:37
--------------------
  36 |
  37 | >>> RUN add-apt-repository ppa:jblgf0/python -y \
  38 | >>>         && apt-get update \
  39 | >>>         && apt-get install -y python3.6 \
  40 | >>>         && update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 60
  41 |
--------------------
ERROR: failed to solve: process "/bin/sh -c add-apt-repository ppa:jblgf0/python -y         && apt-get update         && apt-get install -y python3.6         && update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 60" did not complete successfully: exit code: 100
tomhenderson commented 5 months ago

@tomhenderson thanks, but that Dockerfile fails for me as follows:

That ppa seems to have disappeared. I modified the Dockerfile to build Python3 from scratch instead; please try the latest commit.

larseggert commented 5 months ago

Thanks, that was helpful. Based on your latest Dockerfile, I now see a build error if I add these steps to the end of it:

WORKDIR /
RUN git clone --depth=1 https://gitlab.com/nsnam/bake.git
WORKDIR /bake
RUN sed -i'' '2537s/net-next-nuse-4.4.0/net-next-nuse-4.4.0-fix1/' bakeconf.xml
RUN ./bake.py check
RUN ./bake.py configure -e dce-linux-1.11
RUN ./bake.py download
RUN ./bake.py build -vvv

This is the error:

  CC      net/core/sock.o
In file included from ./include/uapi/linux/stddef.h:1:0,
                 from ./include/linux/stddef.h:4,
                 from ./include/uapi/linux/posix_types.h:4,
                 from ./include/uapi/linux/types.h:13,
                 from ./include/linux/types.h:5,
                 from ./include/uapi/linux/capability.h:16,
                 from ./include/linux/capability.h:15,
                 from net/core/sock.c:94:
In function 'dst_hold',
    inlined from 'dst_hold_safe' at ./include/net/dst.h:336:2,
    inlined from 'skb_dst_force_safe' at ./include/net/dst.h:351:8,
    inlined from '__sk_add_backlog' at ./include/net/sock.h:816:2,
    inlined from 'sk_add_backlog' at ./include/net/sock.h:854:2,
    inlined from 'sk_receive_skb' at net/core/sock.c:513:13:
./include/linux/compiler.h:484:38: error: call to '__compiletime_assert_252' declared with attribute error: BUILD_BUG_ON failed: offsetof(struct dst_entry, __refcnt) & 63
  _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
                                      ^
./include/linux/compiler.h:467:4: note: in definition of macro '__compiletime_assert'
    prefix ## suffix();    \
    ^
./include/linux/compiler.h:484:2: note: in expansion of macro '_compiletime_assert'
  _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
  ^
./include/linux/bug.h:50:37: note: in expansion of macro 'compiletime_assert'
 #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                     ^
./include/linux/bug.h:74:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
  BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
  ^
./include/net/dst.h:252:2: note: in expansion of macro 'BUILD_BUG_ON'
  BUILD_BUG_ON(offsetof(struct dst_entry, __refcnt) & 63);
  ^
arch/lib/Makefile:198: recipe for target 'net/core/sock.o' failed
make: *** [net/core/sock.o] Error 1

 >> Building net-next-nuse-4.4.0-fix1 - Problem

gcc is gcc version 5.4.0 20160609 (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.12)

larseggert commented 5 months ago

With your original docker-compose instructions I get further! Investigating.

tomhenderson commented 5 months ago

With your original docker-compose instructions I get further! Investigating.

Thanks for bearing with me; I don't have time these recent days to properly test everything as I am stealing some time here and there to respond with some untested code.

My next step will be to try a newer compiler version. I have a native Ubuntu 16 machine on which this builds, and it is using g++-8.

tomhenderson commented 5 months ago

If you want to do this by hand, you should install the ubuntu-toolchain-r ppa and then fetch gcc-8/g++-8 from there. Then, update-alternatives to make gcc-8/g++-8 the default gcc.

gcc-8:
  Installed: 8.4.0-1ubuntu1~16.04.1
  Candidate: 8.4.0-1ubuntu1~16.04.1
  Version table:
 *** 8.4.0-1ubuntu1~16.04.1 500
        500 http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu xenial/main amd64 Packages
        100 /var/lib/dpkg/status
tomhenderson commented 5 months ago

See my latest Dockerfile commit, it adds g++-8. I tested it all the way through this time and it passes all ns-3.34 and ns-3-dce tests.

larseggert commented 5 months ago

With your original docker-compose-based instructions, the bake build step also fails very early on:

 >> Building net-next-nuse-4.4.0-fix1 - Problem
   > Subprocess failed with error 2: ['make', 'library', 'ARCH=lib']
 > Error:  Critical dependency, module "net-next-nuse-4.4.0-fix1" failed
   For more information call Bake with --debug and/or -v, -vvv, for full verbose mode (bake --help)
larseggert commented 5 months ago

See my latest Dockerfile commit, it adds g++-8. I tested it all the way through this time and it passes all ns-3.34 and ns-3-dce tests.

I used your new Dockerfile and added the following lines, which I think are what you suggested above for building things:

WORKDIR /
RUN git clone --depth=1 https://gitlab.com/nsnam/bake.git

ENV PATH $PATH:/bake/build/bin:/bake/build/bin_dce
ENV LD_LIBRARY_PATH /bake/build/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
ENV DCE_PATH /bake/build/bin_dce:/bake/build/sbin

WORKDIR /bake
RUN sed -i'' '2537s/net-next-nuse-4.4.0/net-next-nuse-4.4.0-fix1/' bakeconf.xml
RUN ./bake.py check
RUN ./bake.py configure -e dce-linux-1.11
RUN ./bake.py download
RUN ./bake.py build -vvv

That still fails at the last step with

#16 30.60 ./include/linux/compiler.h:484:38: error: call to '__compiletime_assert_252' declared with attribute error: BUILD_BUG_ON failed: offsetof(struct dst_entry, __refcnt) & 63
#16 30.60   _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
#16 30.60                                       ^
#16 30.60 ./include/linux/compiler.h:467:4: note: in definition of macro '__compiletime_assert'
#16 30.60     prefix ## suffix();    \
#16 30.60     ^~~~~~
#16 30.60 ./include/linux/compiler.h:484:2: note: in expansion of macro '_compiletime_assert'
#16 30.60   _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
#16 30.60   ^~~~~~~~~~~~~~~~~~~
#16 30.60 ./include/linux/bug.h:50:37: note: in expansion of macro 'compiletime_assert'
#16 30.60  #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
#16 30.60                                      ^~~~~~~~~~~~~~~~~~
#16 30.60 ./include/linux/bug.h:74:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
#16 30.60   BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
#16 30.60   ^~~~~~~~~~~~~~~~
#16 30.60 ./include/net/dst.h:252:2: note: in expansion of macro 'BUILD_BUG_ON'
#16 30.60   BUILD_BUG_ON(offsetof(struct dst_entry, __refcnt) & 63);
#16 30.60   ^~~~~~~~~~~~
#16 30.60 arch/lib/Makefile:198: recipe for target 'net/core/sock.o' failed
#16 30.60 make: *** [net/core/sock.o] Error 1
#16 30.60  test -d /bake/source/net-next-nuse-4.4.0/no dir=/bake/source/net-next-nuse-4.4.0
#16 30.60  make defconfig ARCH=lib dir=/bake/source/net-next-nuse-4.4.0
#16 30.60  make library ARCH=lib dir=/bake/source/net-next-nuse-4.4.0
#16 30.60
#16 30.60  >> Building net-next-nuse-4.4.0-fix1 - Problem
#16 30.62    > Subprocess failed with error 2: ['make', 'library', 'ARCH=lib']
#16 30.62  > Error:  Critical dependency, module "net-next-nuse-4.4.0-fix1" failed
#16 30.62    For more information call Bake with --debug and/or -v, -vvv, for full verbose mode (bake --help)
#16 ERROR: process "/bin/sh -c ./bake.py build -vvv" did not complete successfully: exit code: 1
------
 > [13/14] RUN ./bake.py build -vvv:
30.60 arch/lib/Makefile:198: recipe for target 'net/core/sock.o' failed
30.60 make: *** [net/core/sock.o] Error 1
30.60  test -d /bake/source/net-next-nuse-4.4.0/no dir=/bake/source/net-next-nuse-4.4.0
30.60  make defconfig ARCH=lib dir=/bake/source/net-next-nuse-4.4.0
30.60  make library ARCH=lib dir=/bake/source/net-next-nuse-4.4.0
30.60
30.60  >> Building net-next-nuse-4.4.0-fix1 - Problem
30.62    > Subprocess failed with error 2: ['make', 'library', 'ARCH=lib']
30.62  > Error:  Critical dependency, module "net-next-nuse-4.4.0-fix1" failed
30.62    For more information call Bake with --debug and/or -v, -vvv, for full verbose mode (bake --help)

Could I suggest that we start a repository that uses a GitHub workflow to build a docker image for pushing to ghcr.io for everyone's use? That workflow would then also document the way this is supposed to be built.

tomhenderson commented 5 months ago

I'm not sure why your latest attempt failed; is it using cached items? The above error seems to be gcc-5 related.

I pushed the image that worked for me to: tomhend/ns-3-dce-ubuntu-16:1.2 on dockerhub.

Could I suggest that we start a repository

Yes, it's not clear to me whether a separate repository is better than putting the docker-compose.yml and Dockerfile into the existing repository, though. I think we are ready to work out requirements, naming, how it will be tested, etc.

Yes, of course. However, I was trying to get you up and running first.

larseggert commented 5 months ago

This is using gcc-8 and it's not due to caching.

It need not be a separate repo, but I think what would be nice if a GitHub workflow that builds a full image (i.e., with everything compiled).

tomhenderson commented 5 months ago

Perhaps an architecture issue? It is failing onBUILD_BUG_ON(offsetof(struct dst_entry, __refcnt) & 63);. I was using an x86_64 (Intel i7-3770) host.

larseggert commented 5 months ago

I'm on amd64 (and M3 Mac). It would be a pity if DCE was arch-specific.

tomhenderson commented 5 months ago

I'm on amd64 (and M3 Mac). It would be a pity if DCE was arch-specific.

I don't have any knowledge of whether anyone has gotten DCE to work with ARM architectures. If you can find an image and tools that allows you to build the linux-4.4 kernel on a Ubuntu 16 ARM base image, then perhaps DCE could be built on that.

larseggert commented 5 months ago

That's what I'm doing. Using your Dockerfile to build locally will use the ARM64 Ubuntu base image.

larseggert commented 5 months ago

I tried things on an linux/amd64 platform. The bake.py build step there fails with

 >> Building net-next-nuse-4.4.0-fix1 -  test -d /bake/source/net-next-nuse-4.4.0/no dir=/bake/source/net-next-nuse-4.4.0
 make defconfig ARCH=lib dir=/bake/source/net-next-nuse-4.4.0
make[1]: Nothing to be done for '.config'.
scripts/kconfig/conf  --defconfig arch/lib/Kconfig
#
# configuration written to .config
#
 make library ARCH=lib dir=/bake/source/net-next-nuse-4.4.0
  OBJS-MK   arch/lib/objs.mk
make[2]: Nothing to be done for '.config'.
scripts/kconfig/conf  --silentoldconfig arch/lib/Kconfig
  CHK     include/config/kernel.release
  CHK     include/generated/utsrelease.h
  CHK     include/generated/uapi/linux/version.h
  CHK     include/generated/compile.h
  CHK     include/generated/timeconst.h
make: *** No rule to make target 'net/netfilter/xt_RATEEST.o', needed by 'net/netfilter/builtin.o'.  Stop.

On linux/arm64, it is still

In function 'dst_hold',
    inlined from 'dst_hold_safe' at ./include/net/dst.h:336:2,
    inlined from 'skb_dst_force_safe' at ./include/net/dst.h:351:8,
    inlined from '__sk_add_backlog' at ./include/net/sock.h:816:2,
    inlined from 'sk_add_backlog' at ./include/net/sock.h:854:2,
    inlined from 'sk_receive_skb' at net/core/sock.c:513:13:
./include/linux/compiler.h:484:38: error: call to '__compiletime_assert_252' declared with attribute error: BUILD_BUG_ON failed: offsetof(struct dst_entry, __refcnt) & 63
  _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
                                      ^
./include/linux/compiler.h:467:4: note: in definition of macro '__compiletime_assert'
    prefix ## suffix();    \
    ^~~~~~
./include/linux/compiler.h:484:2: note: in expansion of macro '_compiletime_assert'
  _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
  ^~~~~~~~~~~~~~~~~~~
./include/linux/bug.h:50:37: note: in expansion of macro 'compiletime_assert'
 #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                     ^~~~~~~~~~~~~~~~~~
./include/linux/bug.h:74:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
  BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
  ^~~~~~~~~~~~~~~~
./include/net/dst.h:252:2: note: in expansion of macro 'BUILD_BUG_ON'
  BUILD_BUG_ON(offsetof(struct dst_entry, __refcnt) & 63);
  ^~~~~~~~~~~~
arch/lib/Makefile:198: recipe for target 'net/core/sock.o' failed
make: *** [net/core/sock.o] Error 1

In both cases, gcc version 8.4.0.

larseggert commented 4 months ago

I think I'm going to wait with trying to get this to build until there is a new release.

markverick commented 3 months ago

I can confirm that docker image version 1.2 works with dce-ns3-1.11, dce-linux-1.11, and quagga-1.11 and passes sufficient tests.

larseggert commented 3 months ago

@markverick could you post the steps you followed to verify this?

markverick commented 3 months ago

@larseggert I'm running Docker on an Ubuntu VM 20.04 (focal), and I'm able to reproduce this.

  1. Do the following:
    git clone https://github.com/tomhenderson/dce-docker-beta.git
    cd dce-docker-beta
    git checkout -b dce-1.11-ubuntu-16 origin/dce-1.11-ubuntu-16
  2. Edit docker-compose.yml. Change this line image: tomhend/ns-3-dce-ubuntu-16:1.1 to image: tomhend/ns-3-dce-ubuntu-16:1.2. Change Docker compose version from 3 to 2.4.
  3. The rest is done according to the original instructions.
  4. Run sudo docker-compose -p ubuntu16 up -d
  5. Inside the Docker, do the following:
    sudo docker exec -it ns-3-dce-ubuntu-16 /bin/bash
    cd bake
    git init
    git remote add origin https://gitlab.com/nsnam/bake.git
    git fetch origin
    git checkout master
  6. If you want to use dce-linux-1.11, replace its dependency of net-next-nuse-4.4.0 with net-next-nuse-4.4.0-fix1
  7. ./bake.py configure -e dce-linux-1.11
    ./bake.py download
    ./bake.py build
    cd source/ns-3-dce
    ./test.py

    You need to install two packages from apt following the error message from ./bake.py download.

tomhenderson commented 3 months ago

I will try to freshen this image and docker-compose file later this week when I get some time, but @markverick's instructions above look correct to me.

larseggert commented 3 months ago

Thanks @markverick and @tomhenderson!

Would it also be possible to simply have the Dockerfile do all the steps that the instructions say to do manually in the running container? (That's kinda what Dockerfiles are for I think.)