Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ubuntu Docker fails during install step for 'cppwinrt' #712

Open
twilson90 opened this issue Oct 17, 2024 · 8 comments
Open

Ubuntu Docker fails during install step for 'cppwinrt' #712

twilson90 opened this issue Oct 17, 2024 · 8 comments

Comments

@twilson90
Copy link

[build 10/11] RUN ninja gcc:
0.480 [1/94] Creating directories for 'mingw-w64-headers'
0.489 [2/94] Creating directories for 'gcc-binutils'
0.489 [3/94] Creating directories for 'gcc-wrapper'
0.490 [4/94] Creating directories for 'mingw-w64'
0.490 [5/94] Creating directories for 'cppwinrt'
0.490 [6/94] Creating directories for 'gcc'
0.491 [7/94] Creating directories for 'mingw-w64-crt'
0.491 [8/94] Creating directories for 'gendef'
0.492 [9/94] Creating directories for 'rustup'
0.492 [10/94] Creating directories for 'winpthreads'
0.504 [11/94] No download step for 'rustup'
0.505 [12/94] No download step for 'mingw-w64-headers'
0.505 [13/94] No download step for 'gcc-wrapper'
0.505 [14/94] No download step for 'gendef'
0.506 [15/94] No download step for 'winpthreads'
0.506 [16/94] No download step for 'mingw-w64-crt'
0.519 [17/94] No update step for 'gcc-wrapper'
0.519 [18/94] No update step for 'rustup'
0.532 [19/94] No patch step for 'gcc-wrapper'
0.533 [20/94] No patch step for 'rustup'
0.545 [21/94] No configure step for 'gcc-wrapper'
0.648 [22/94] Performing build step for 'gcc-wrapper'
0.661 [23/94] Setting up target directories and symlinks
0.676 [24/94] Deleting build directory of gcc-wrapper package after install
0.695 [25/94] Completed 'gcc-wrapper'
3.287 [26/94] Performing download step (git clone) for 'cppwinrt'
3.302 [27/94] No update step for 'cppwinrt'
3.307 [28/94] Performing write-head step for 'cppwinrt'
3.321 [29/94] No patch step for 'cppwinrt'
3.533 [30/94] Performing configure step for 'cppwinrt'
22.88 [31/94] Performing download step (git clone) for 'mingw-w64'
22.89 [32/94] No update step for 'mingw-w64'
22.90 [33/94] Performing write-head step for 'mingw-w64'
22.91 [34/94] No patch step for 'mingw-w64'
22.93 [35/94] No configure step for 'mingw-w64'
22.94 [36/94] No build step for 'mingw-w64'
22.96 [37/94] No install step for 'mingw-w64'
22.98 [38/94] Completed 'mingw-w64'
22.99 [39/94] No update step for 'gendef'
23.01 [40/94] No patch step for 'gendef'
24.38 [41/94] Performing configure step for 'gendef'
24.79 [42/94] Performing build step for 'gendef'
24.83 [43/94] Performing install step for 'gendef'
24.85 [44/94] Deleting build directory of gendef package after install
24.87 [45/94] Completed 'gendef'
27.68 [46/94] Performing build step for 'cppwinrt'
27.72 [47/94] Performing install step for 'cppwinrt'
27.72 FAILED: toolchain/cppwinrt-prefix/src/cppwinrt-stamp/cppwinrt-install /opt/build64/toolchain/cppwinrt-prefix/src/cppwinrt-stamp/cppwinrt-install
27.72 cd /opt/build64/toolchain/cppwinrt-prefix/src/cppwinrt-build && /usr/bin/cmake -P /opt/build64/toolchain/cppwinrt-prefix/src/cppwinrt-stamp/cppwinrt-install-.cmake && /usr/bin/cmake -E touch /opt/build64/toolchain/cppwinrt-prefix/src/cppwinrt-stamp/cppwinrt-install
27.72 CMake Error at /opt/build64/toolchain/cppwinrt-prefix/src/cppwinrt-stamp/cppwinrt-install-.cmake:49 (message):
27.72   Command failed: 1
27.72
27.72    '/usr/bin/cmake' '-Dmake=' '-Dconfig=' '-P' '/opt/build64/toolchain/cppwinrt-prefix/src/cppwinrt-stamp/cppwinrt-install--impl.cmake'
27.72
27.72   See also
27.72
27.72     /opt/build64/toolchain/cppwinrt-prefix/src/cppwinrt-stamp/cppwinrt-install-*.log
27.72
27.72
49.22 [48/94] Performing download step (download, verify and extract) for 'gcc-binutils'
57.92 [49/94] Performing download step (download, verify and extract) for 'gcc'
67.51 [50/94] Performing configure step for 'rustup'
67.51 ninja: build stopped: subcommand failed.
------
Dockerfile.windows:59
--------------------
  57 |     WORKDIR /opt/build64
  58 |     RUN ninja download
  59 | >>> RUN ninja gcc
  60 |     RUN ninja mpv
  61 |
--------------------
ERROR: failed to solve: process "/bin/sh -c ninja gcc" did not complete successfully: exit code: 1

Dockerfile:

FROM ubuntu:24.04 AS build

RUN apt update -y
RUN apt install -y build-essential checkinstall bison flex gettext git mercurial subversion ninja-build gyp cmake yasm nasm automake pkgconf libtool libtool-bin gcc-multilib g++-multilib clang lld libc++1 libc++abi1 libgmp-dev libmpfr-dev libmpc-dev libgcrypt-dev gperf ragel texinfo autopoint re2c asciidoc python3-pip docbook2x unzip p7zip-full curl libmimalloc-dev ccache
ENV PIP_BREAK_SYSTEM_PACKAGES=1
RUN pip3 install rst2pdf meson mako jsonschema

WORKDIR /opt
RUN git clone https:/shinchiro/mpv-winbuild-cmake.git

RUN cmake -DTARGET_ARCH=x86_64-w64-mingw32 \
    -DGCC_ARCH=x86-64-v3 \
    -DSINGLE_SOURCE_LOCATION="/home/user/packages" \
    -DRUSTUP_LOCATION="/home/user/install_rustup" \
    -G Ninja -B build64 -S mpv-winbuild-cmake

WORKDIR /opt/build64
RUN ninja download
RUN ninja gcc
RUN ninja mpv

FROM scratch AS artifact
COPY --from=build /opt/mpv/out /

FROM build AS release

Not having much luck here!

@Andarwinux
Copy link
Contributor

/opt/build64/toolchain/cppwinrt-prefix/src/cppwinrt-stamp/cppwinrt-install-*.log plz

I guess it's just a network problem.

@twilson90
Copy link
Author

twilson90 commented Oct 17, 2024

It's not producing any logs:

Docker_Desktop_vSQ0eNikfX

I don't think it's a network problem, I tried to build in docker container a month ago and had the same issue.

@Andarwinux
Copy link
Contributor

So maybe it's because wget doesn't exist? I'm not sure if these dependencies automatically pull wget in.

@twilson90
Copy link
Author

twilson90 commented Oct 18, 2024

That solved it! Thank you.

I'm almost there but I'm running into an error at the last hurdle.
It's failing to build harfbuzz and/or libjxl, but the logs don't appear very helpful.

docker-build-log.txt
harfbuzz-build-out.log
libjxl-build-out.log

@Andarwinux
Copy link
Contributor

Andarwinux commented Oct 18, 2024

This issue is caused by OOM.

For historical reasons, the parallel build mechanism of this script is suboptimal: there is no “global thread pool.”

For example, on a 16-core system, Ninja performs 16 external projects simultaneously by default, and each external project tells Ninja/Make to emit 16 instances of the compiler, which in the worst case can result in 256 instances. This is fine for Clang, because Clang emits "cc1" in-process. However, GCC's driver and cc1 are separate executables, which can lead to hundreds of processes being created simultaneously and immediately exhaust all RAM.

As far as I know, Ninja does not yet support the GNU Make jobserver protocol, so we cannot fundamentally fix this issue. However, you can switch to Clang, or limit the top-level Ninja parallelism with -j, for example, ninja -j2 mpv, or add -DCPU_COUNT=2 in your CMake setup to restrict the number of concurrent compilers.

@twilson90
Copy link
Author

twilson90 commented Oct 18, 2024

Thank you! With your help I've finally managed to 'successfully' build a windows executable.
Some problems though:

  • When I try running it in Windows it runs for a moment before exiting. Maybe the mpv master branch is currently having issues? Nothing helpful in the run-time log:
    log.txt
  • I want to build my own fork of mpv. I tried replacing /home/user/packages/mpv with my own but the build fails:
    mpv-build-out.log
  • Also where do I specify mpv build options? (stuff like -Dmanpage-build=disabled)

@Andarwinux
Copy link
Contributor

  • When I try running it in Windows it runs for a moment before exiting. Maybe the mpv master branch is currently having issues? Nothing helpful in the run-time log:
    log.txt

You need to add keep-open=yes to keep mpv running without any input.

  • I want to build my own fork of mpv. I tried replacing /home/user/packages/mpv with my own but the build fails:
    mpv-build-out.log

This is a GCC 14 false positive, you can add -Wno-error=incompatible-pointer-types at

-Dc_args='-Wno-error=int-conversion'

To replace it with a different source, just replace GIT_REPOSITORY, and if your branch name is not master, specify GIT_TAG and GIT_REMOTE_NAME.

GIT_REPOSITORY https:/mpv-player/mpv.git

  • Also where do I specify mpv build options? (stuff like -Dmanpage-build=disabled)

Just add it after CONFIGURE_COMMAND.

@twilson90
Copy link
Author

twilson90 commented Oct 19, 2024

I've tried:
-Dc_args='-Wno-error=int-conversion -Wno-error=incompatible-pointer-types'
and
"-Dc_args='-Wno-error=int-conversion -Wno-error=incompatible-pointer-types'"

but it's failing to run the configure command.

There's an error log generated that I haven't been able to look at due to issues with Docker. Presumably though I'm just not setting the argument correctly.

(EDIT : my mistake, I had included an extra feature in the configure command without installing the prerequsites and this was causing it to fail)

Also the previous successful build was closing immediately on opening any media file, here's another log (no errors):
log.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants