sogno-platform / dpsim

Real-time power system simulator including powerflow, (dynamic) phasors and EMT
https://sogno.energy/dpsim/
Mozilla Public License 2.0
67 stars 49 forks source link

Building on Ubuntu 22.04 #275

Closed jason95054 closed 1 month ago

jason95054 commented 4 months ago

I used 'docker -l debug -D build -t sogno/dpsim:dev -f packaging/Docker/Dockerfile.dev-debian .' I got these:

 => ERROR [ 6/15] RUN cd /tmp &&  git clone --branch v3.2.1 --recurse-submodules --depth 1 https://github.com/L  233.4s
------
 > [ 6/15] RUN cd /tmp &&       git clone --branch v3.2.1 --recurse-submodules --depth 1 https://github.com/LLNL/sundials.git &&        mkdir -p sundials/build && cd sundials/build &&         cmake ${CMAKE_OPTS} ..          -DCMAKE_BUILD_TYPE=Release &&   make -j4 install:
0.747 Cloning into 'sundials'...
233.1 error: RPC failed; curl 92 HTTP/2 stream 0 was not closed cleanly: CANCEL (err 8)
233.1 error: 5971 bytes of body are still expected
233.1 fetch-pack: unexpected disconnect while reading sideband packet
233.1 fatal: early EOF
233.1 fatal: index-pack failed
------
Dockerfile.dev-debian:43
--------------------
  42 |     # Build & Install sundials
  43 | >>> RUN cd /tmp && \
  44 | >>>      git clone --branch v3.2.1 --recurse-submodules --depth 1 https://github.com/LLNL/sundials.git && \
  45 | >>>      mkdir -p sundials/build && cd sundials/build && \
  46 | >>>      cmake ${CMAKE_OPTS} .. \
  47 | >>>              -DCMAKE_BUILD_TYPE=Release && \
  48 | >>>      make ${MAKE_OPTS} install
  49 |
--------------------
ERROR: failed to solve: process "/bin/sh -c cd /tmp && \tgit clone --branch v3.2.1 --recurse-submodules --depth 1 https://github.com/LLNL/sundials.git && \tmkdir -p sundials/build && cd sundials/build && \tcmake ${CMAKE_OPTS} .. \t\t-DCMAKE_BUILD_TYPE=Release && \tmake ${MAKE_OPTS} install" did not complete successfully: exit code: 128
3873  /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
github.com/moby/buildkit/executor/runcexecutor.exitError
        /root/build-deb/engine/vendor/github.com/moby/buildkit/executor/runcexecutor/executor.go:375
github.com/moby/buildkit/executor/runcexecutor.(*runcExecutor).Run
        /root/build-deb/engine/vendor/github.com/moby/buildkit/executor/runcexecutor/executor.go:336
github.com/moby/buildkit/solver/llbsolver/ops.(*ExecOp).Exec
        /root/build-deb/engine/vendor/github.com/moby/buildkit/solver/llbsolver/ops/exec.go:373
github.com/moby/buildkit/solver.(*sharedOp).Exec.func2
        /root/build-deb/engine/vendor/github.com/moby/buildkit/solver/jobs.go:911
github.com/moby/buildkit/util/flightcontrol.(*call[...]).run
        /root/build-deb/engine/vendor/github.com/moby/buildkit/util/flightcontrol/flightcontrol.go:121
sync.(*Once).doSlow
        /usr/local/go/src/sync/once.go:74
sync.(*Once).Do
        /usr/local/go/src/sync/once.go:65
runtime.goexit
        /usr/local/go/src/runtime/asm_amd64.s:1650

3873  /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
github.com/moby/buildkit/solver/llbsolver/ops.(*ExecOp).Exec
        /root/build-deb/engine/vendor/github.com/moby/buildkit/solver/llbsolver/ops/exec.go:394
github.com/moby/buildkit/solver.(*sharedOp).Exec.func2
        /root/build-deb/engine/vendor/github.com/moby/buildkit/solver/jobs.go:911
github.com/moby/buildkit/util/flightcontrol.(*call[...]).run
        /root/build-deb/engine/vendor/github.com/moby/buildkit/util/flightcontrol/flightcontrol.go:121
sync.(*Once).doSlow
        /usr/local/go/src/sync/once.go:74
sync.(*Once).Do
        /usr/local/go/src/sync/once.go:65
runtime.goexit
        /usr/local/go/src/runtime/asm_amd64.s:1650

3873  /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
github.com/moby/buildkit/solver.(*edge).execOp
        /root/build-deb/engine/vendor/github.com/moby/buildkit/solver/edge.go:906
github.com/moby/buildkit/solver/internal/pipe.NewWithFunction.func2
        /root/build-deb/engine/vendor/github.com/moby/buildkit/solver/internal/pipe/pipe.go:82
runtime.goexit
        /usr/local/go/src/runtime/asm_amd64.s:1650

191731 v0.12.1 /usr/libexec/docker/cli-plugins/docker-buildx -l debug -D buildx build -t sogno/dpsim:dev -f packaging/Docker/Dockerfile.dev-debian .
google.golang.org/grpc.getChainUnaryInvoker.func1
        google.golang.org/grpc@v1.53.0/clientconn.go:361
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc.UnaryClientInterceptor.func1
        go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc@v0.40.0/interceptor.go:99
github.com/moby/buildkit/client.New.filterInterceptor.func6
        github.com/moby/buildkit@v0.13.0-beta1.0.20231023114302-d5c1d785b042/client/client.go:398
google.golang.org/grpc.DialContext.chainUnaryClientInterceptors.func3
        google.golang.org/grpc@v1.53.0/clientconn.go:349
google.golang.org/grpc.(*ClientConn).Invoke
        google.golang.org/grpc@v1.53.0/call.go:35
github.com/moby/buildkit/api/services/control.(*controlClient).Solve
        github.com/moby/buildkit@v0.13.0-beta1.0.20231023114302-d5c1d785b042/api/services/control/control.pb.go:2208
github.com/moby/buildkit/client.(*Client).solve.func2
        github.com/moby/buildkit@v0.13.0-beta1.0.20231023114302-d5c1d785b042/client/solve.go:258
golang.org/x/sync/errgroup.(*Group).Go.func1
        golang.org/x/sync@v0.3.0/errgroup/errgroup.go:75
runtime.goexit
        runtime/asm_amd64.s:1650

191731 v0.12.1 /usr/libexec/docker/cli-plugins/docker-buildx -l debug -D buildx build -t sogno/dpsim:dev -f packaging/Docker/Dockerfile.dev-debian .
github.com/moby/buildkit/client.(*Client).solve.func2
        github.com/moby/buildkit@v0.13.0-beta1.0.20231023114302-d5c1d785b042/client/solve.go:273
golang.org/x/sync/errgroup.(*Group).Go.func1
        golang.org/x/sync@v0.3.0/errgroup/errgroup.go:75
runtime.goexit
        runtime/asm_amd64.s:1650

I modified 'packaging/Docker/Docker/Dockerfile.dev-debian' as:
diff -uN packaging/Docker/Dockerfile.dev-debian packaging/Docker/Dockerfile.
dev-ubuntu
--- packaging/Docker/Dockerfile.dev-debian      2024-02-23 13:51:46.652420350 -0800
+++ packaging/Docker/Dockerfile.dev-ubuntu      2024-02-23 12:36:19.239366618 -0800
@@ -1,4 +1,4 @@
-FROM debian:11
+FROM ubuntu:jammy-20240212

 ARG CIM_VERSION=CGMES_2.4.15_16FEB2016
 ARG VILLAS_VERSION=c976cd62d8c6667a078be0785ca3e623a05f7456
@@ -40,8 +40,9 @@
        libfmt-dev

 # Build & Install sundials
+#      git clone --branch v3.2.1 --recurse-submodules --depth 1 https://github.com/LLNL/sundials.git && \
 RUN cd /tmp && \
-       git clone --branch v3.2.1 --recurse-submodules --depth 1 https://github.com/LLNL/sundials.git && \
+       git clone --recurse-submodules --depth 1 https://github.com/LLNL/sundials.git && \
        mkdir -p sundials/build && cd sundials/build && \
        cmake ${CMAKE_OPTS} .. \
                -DCMAKE_BUILD_TYPE=Release && \
@@ -89,10 +90,10 @@
        rm -rf /tmp/libcimpp

 ## Install VILLASnode from source
+#      git checkout ${VILLAS_VERSION} && \
 RUN cd /tmp && \
        git clone --recurse-submodules https://github.com/VILLASframework/node.git villas-node && \
        mkdir -p villas-node/build && cd villas-node/build && \
-       git checkout ${VILLAS_VERSION} && \
        cmake ${CMAKE_OPTS} .. \
                -DCMAKE_INSTALL_LIBDIR=/usr/local/lib \
                -DDOWNLOAD_GO=OFF && \
Then, the build went fine.

For packaging/Docker/Dockerfile.dev-docs, I got this error:
ERROR: failed to solve: process "/bin/sh -c cd /tmp && \tgit clone --branch v3.2.1 --recurse-submodules --depth 1 https://github.com/LLNL/sundials.git && \tmkdir -p sundials/build && cd sundials/build && \tcmake ${CMAKE_OPTS} .. \t\t-DCMAKE_BUILD_TYPE=Release && \tmake ${MAKE_OPTS} install" did not complete successfully: exit code: 128
3873  /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
github.com/moby/buildkit/executor/runcexecutor.exitError
        /root/build-deb/engine/vendor/github.com/moby/buildkit/executor/runcexecutor/executor.go:375
github.com/moby/buildkit/executor/runcexecutor.(*runcExecutor).Run
        /root/build-deb/engine/vendor/github.com/moby/buildkit/executor/runcexecutor/executor.go:336
github.com/moby/buildkit/solver/llbsolver/ops.(*ExecOp).Exec
        /root/build-deb/engine/vendor/github.com/moby/buildkit/solver/llbsolver/ops/exec.go:373
github.com/moby/buildkit/solver.(*sharedOp).Exec.func2
        /root/build-deb/engine/vendor/github.com/moby/buildkit/solver/jobs.go:911
github.com/moby/buildkit/util/flightcontrol.(*call[...]).run
        /root/build-deb/engine/vendor/github.com/moby/buildkit/util/flightcontrol/flightcontrol.go:121
sync.(*Once).doSlow
        /usr/local/go/src/sync/once.go:74
sync.(*Once).Do
        /usr/local/go/src/sync/once.go:65
runtime.goexit
        /usr/local/go/src/runtime/asm_amd64.s:1650

3873  /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
github.com/moby/buildkit/solver/llbsolver/ops.(*ExecOp).Exec
        /root/build-deb/engine/vendor/github.com/moby/buildkit/solver/llbsolver/ops/exec.go:394
github.com/moby/buildkit/solver.(*sharedOp).Exec.func2
        /root/build-deb/engine/vendor/github.com/moby/buildkit/solver/jobs.go:911
github.com/moby/buildkit/util/flightcontrol.(*call[...]).run
        /root/build-deb/engine/vendor/github.com/moby/buildkit/util/flightcontrol/flightcontrol.go:121
sync.(*Once).doSlow
        /usr/local/go/src/sync/once.go:74
sync.(*Once).Do
        /usr/local/go/src/sync/once.go:65
runtime.goexit
        /usr/local/go/src/runtime/asm_amd64.s:1650

3873  /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
github.com/moby/buildkit/solver.(*edge).execOp
        /root/build-deb/engine/vendor/github.com/moby/buildkit/solver/edge.go:906
github.com/moby/buildkit/solver/internal/pipe.NewWithFunction.func2
        /root/build-deb/engine/vendor/github.com/moby/buildkit/solver/internal/pipe/pipe.go:82
runtime.goexit
        /usr/local/go/src/runtime/asm_amd64.s:1650

191731 v0.12.1 /usr/libexec/docker/cli-plugins/docker-buildx -l debug -D buildx build -t sogno/dpsim:dev -f packaging/Docker/Dockerfile.dev-debian .
google.golang.org/grpc.getChainUnaryInvoker.func1
        google.golang.org/grpc@v1.53.0/clientconn.go:361
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc.UnaryClientInterceptor.func1
        go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc@v0.40.0/interceptor.go:99
github.com/moby/buildkit/client.New.filterInterceptor.func6
        github.com/moby/buildkit@v0.13.0-beta1.0.20231023114302-d5c1d785b042/client/client.go:398
google.golang.org/grpc.DialContext.chainUnaryClientInterceptors.func3
        google.golang.org/grpc@v1.53.0/clientconn.go:349
google.golang.org/grpc.(*ClientConn).Invoke
        google.golang.org/grpc@v1.53.0/call.go:35
github.com/moby/buildkit/api/services/control.(*controlClient).Solve
        github.com/moby/buildkit@v0.13.0-beta1.0.20231023114302-d5c1d785b042/api/services/control/control.pb.go:2208
github.com/moby/buildkit/client.(*Client).solve.func2
        github.com/moby/buildkit@v0.13.0-beta1.0.20231023114302-d5c1d785b042/client/solve.go:258
golang.org/x/sync/errgroup.(*Group).Go.func1
        golang.org/x/sync@v0.3.0/errgroup/errgroup.go:75
runtime.goexit
        runtime/asm_amd64.s:1650

191731 v0.12.1 /usr/libexec/docker/cli-plugins/docker-buildx -l debug -D buildx build -t sogno/dpsim:dev -f packaging/Docker/Dockerfile.dev-debian .
github.com/moby/buildkit/client.(*Client).solve.func2
        github.com/moby/buildkit@v0.13.0-beta1.0.20231023114302-d5c1d785b042/client/solve.go:273
golang.org/x/sync/errgroup.(*Group).Go.func1
        golang.org/x/sync@v0.3.0/errgroup/errgroup.go:75
runtime.goexit
        runtime/asm_amd64.s:1650

intai@intai:~/projects/power-systems/dpsim$ sudo docker -l debug -D build -t sogno/dpsim:dev -f packaging/Docker/Dockerfile.dev-docs .
[+] Building 424.9s (7/10)                                                                               docker:default
 => [internal] load build definition from Dockerfile.dev-docs                                                      0.1s
 => => transferring dockerfile: 376B                                                                               0.0s
 => [internal] load metadata for docker.io/library/ubuntu:latest                                                   1.3s
 => [internal] load .dockerignore                                                                                  0.1s
 => => transferring context: 72B                                                                                   0.0s
 => CACHED [1/7] FROM docker.io/library/ubuntu:latest@sha256:f9d633ff6640178c2d0525017174a688e2c1aef28f0a0130b26b  0.0s
 => [2/7] RUN apt update                                                                                           9.1s
 => [3/7] RUN apt install -y git golang curl sudo                                                                141.6s
 => [4/7] RUN curl -fsSL https://deb.nodesource.com/setup_19.x | sudo -E bash - &&     sudo apt-get install -y   102.2s
 => [5/7] RUN go install -tags extended github.com/gohugoio/hugo@latest                                          170.3s
 => => # c:268: undefined reference to `log10'
 => => # /usr/bin/ld: root/go/pkg/mod/github.com/bep/gowebp@v0.3.0/internal/libwebp/../../libwebp_src/src/enc/webp_enc.
 => => # c:268: undefined reference to `log10'
 => => # /usr/bin/ld: root/go/pkg/mod/github.com/bep/gowebp@v0.3.0/internal/libwebp/../../libwebp_src/src/enc/webp_enc.
 => => # c:268: undefined reference to `log10'
 => => # collect2: error: ld returned 1 exit status

I modified packaging/Docker/Dockerfile.dev-docs as:

diff --git a/packaging/Docker/Dockerfile.dev-docs b/packaging/Docker/Dockerfile.dev-docs
index a5286fcb..ef016299 100644
--- a/packaging/Docker/Dockerfile.dev-docs
+++ b/packaging/Docker/Dockerfile.dev-docs
@@ -1,10 +1,10 @@
-FROM ubuntu:latest
+FROM ubuntu:jammy-20240212

 RUN apt update
-RUN apt install -y git golang curl sudo
+RUN apt install -y git golang-1.21-go curl sudo
 RUN curl -fsSL https://deb.nodesource.com/setup_19.x | sudo -E bash - && \
     sudo apt-get install -y nodejs
-RUN go install -tags extended github.com/gohugoio/hugo@latest
+RUN /usr/lib/go-1.21/bin/go install -tags extended github.com/gohugoio/hugo@v0.123.2
 RUN cp /root/go/bin/hugo /usr/bin/hugo
 EXPOSE 1313/tcp

Then, build docs went fine.

leonardocarreras commented 4 months ago

Dear @jason95054 thanks for the report!

I would like to split this in two.

Debian dev container

The timing was not the most fortunate, and there were active changes in VILLASnode.

The issue was caused by a dependency that we are using, you need to change it to 08f109b924d8fdd4ed563b189a04e8f0bfaf517e https://github.com/sogno-platform/dpsim/blob/e0ae9d97db67b9554f019fc45dafa76f59a4da9e/packaging/Docker/Dockerfile.dev-debian#L4

Would you be so kind in trying again and let us know if the issue is still present on your side? Keep in mind not to docker build using a cached version

Docs container

You are probably right in this case. There are some issues between the hugo and the go versions. Would you like to submit a pull request for this?