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

mkvtoolnix is not building on Darwin #132675

Closed
duckpuppy opened this issue Aug 4, 2021 · 4 comments · Fixed by #133688
Closed

mkvtoolnix is not building on Darwin #132675

duckpuppy opened this issue Aug 4, 2021 · 4 comments · Fixed by #133688
Labels
0.kind: bug 6.topic: darwin Running or building packages on Darwin

Comments

@duckpuppy
Copy link

Describe the bug

mkvtoolnix fails to build on Darwin

Steps To Reproduce

Steps to reproduce the behavior:

  1. nix-env -i mkvtoolnix on a Darwin system

Expected behavior

mkvtoolnix builds and installs

Additional context

Build error output:

checking whether the C compiler works... no
configure: error: in `/private/tmp/nix-build-mkvtoolnix-59.0.0.drv-0/source':
configure: error: C compiler cannot create executables
See `config.log' for more details
builder for '/nix/store/njbd7480qwzhsy1sigjlfmwz37n28ns7-mkvtoolnix-59.0.0.drv' failed with exit code 77

Notify maintainers

@codyopel @rnhmjoj

Metadata

The problem seems to have popped up with 98dcfcf

$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-darwin"`
 - host os: `Darwin 20.5.0, macOS 10.16`
 - multi-user?: `yes`
 - sandbox: `no`
 - version: `nix-env (Nix) 2.3.15`
 - channels(paikens): `"home-manager, nixos-21.05.2001.d4590d21006, nixpkgs-21.11pre306170.4d3e13e51b6, nixpkgs-master, nur-duckpuppy, nur-gerschtli, unstable-21.11pre306003.c464dc811ba, nixpkgs-unstable-21.11pre299378.db6e089456c, darwin"`
 - nixpkgs: `/nix/store/r2x4g0hd7cmbpqhy0ayclr89bz0ccg9x-nixpkgs-unstable.tar.gz`

Maintainer information:

# a list of nixpkgs attributes affected by the problem
attribute:
# a list of nixos modules affected by the problem
module:
@veprbl veprbl added the 6.topic: darwin Running or building packages on Darwin label Aug 4, 2021
@smancill
Copy link
Contributor

Relevant lines after running configurePhase manually with nix-shell -A mkvtoolnix-cli:

configure:4094: checking whether the C compiler works
configure:4116: clang   -lc++fs conftest.c  >&5
ld: library not found for -lc++fs
clang-5.0: error: linker command failed with exit code 1 (use -v to see invocation)

Digging around, commit 98dcfcf (mkvtoolnix: 56.0.0 -> 59.0.0, 2021-07-15) replaced stdenv.mkDerivation with mkDerivation provided by libsForQt.callPackage, which is the right thing to do as I understand when building Qt applications, but mkDerivation was pinned to use llvmPackages_5 long ago by commit c1f1a0e (qt5: use llvm5 for all modules, 2019-04-25).

This causes the problem because commit 9235d12 (mkvtoolnix: 53.0.0 -> 55.0.0, 2021-03-14) introduced:

LDFLAGS = optional stdenv.cc.isClang "-lc++fs";

Which is not supported by LLVM 5 it seems.


I switched Qt to use the default stdenv (which uses llvmPackages_7) and then mkvtoolnix-cli builds successfully (note that I also switched to Qt 5.15 instead of 5.12 because the commented issue was closed as solved a while ago):

diff --git i/pkgs/development/libraries/qt-5/5.15/default.nix w/pkgs/development/libraries/qt-5/5.15/default.nix
index d7a3ff1f55e..a6aae2a351b 100644
--- i/pkgs/development/libraries/qt-5/5.15/default.nix
+++ w/pkgs/development/libraries/qt-5/5.15/default.nix
@@ -19,7 +19,6 @@ top-level attribute to `top-level/all-packages.nix`.
   lib, stdenv, fetchurl, fetchpatch, fetchgit, fetchFromGitHub, makeSetupHook, makeWrapper,
   bison, cups ? null, harfbuzz, libGL, perl,
   gstreamer, gst-plugins-base, gtk3, dconf,
-  llvmPackages_5,
 
   # options
   developerBuild ? false,
@@ -33,8 +32,6 @@ let
 
   qtCompatVersion = srcs.qtbase.version;
 
-  stdenvActual = if stdenv.cc.isClang then llvmPackages_5.stdenv else stdenv;
-
   mirror = "https://download.qt.io";
   srcs = import ./srcs.nix { inherit fetchurl; inherit mirror; } // {
     # qtwebkit does not have an official release tarball on the qt mirror and is
@@ -161,7 +158,7 @@ let
       mkDerivation =
         import ../mkDerivation.nix
         { inherit lib; inherit debug; wrapQtAppsHook = null; }
-        stdenvActual.mkDerivation;
+        stdenv.mkDerivation;
     }
     { inherit self srcs patches; };
 
@@ -174,7 +171,7 @@ let
         import ../mkDerivation.nix
         { inherit lib; inherit debug; inherit (self) wrapQtAppsHook; };
 
-      mkDerivation = mkDerivationWith stdenvActual.mkDerivation;
+      mkDerivation = mkDerivationWith stdenv.mkDerivation;
 
       qtbase = callPackage ../modules/qtbase.nix {
         inherit (srcs.qtbase) src version;
diff --git i/pkgs/top-level/all-packages.nix w/pkgs/top-level/all-packages.nix
index ff39018a8d6..cb89e46cb8f 100644
--- i/pkgs/top-level/all-packages.nix
+++ w/pkgs/top-level/all-packages.nix
@@ -18312,7 +18312,6 @@ with pkgs;
       inherit perl;
       inherit gtk3;
       inherit (gst_all_1) gstreamer gst-plugins-base;
-      inherit llvmPackages_5;
     });
 
   libsForQt512 = recurseIntoAttrs (import ./qt5-packages.nix {
@@ -18330,9 +18329,8 @@ with pkgs;
     qt5 = qt515;
   });
 
-  # TODO bump to 5.14 on darwin once it's not broken; see #95199
-  qt5 =        if stdenv.hostPlatform.isDarwin then qt512 else qt515;
-  libsForQt5 = if stdenv.hostPlatform.isDarwin then libsForQt512 else libsForQt515;
+  qt5 = qt515;
+  libsForQt5 = libsForQt515;
 
   # plasma5Packages maps to the Qt5 packages set that is used to build the plasma5 desktop
   plasma5Packages = libsForQt515;
$ nix-build -A mkvtoolnix-cli
these derivations will be built:
  /nix/store/mr6bp3vwsfjal2ckmap0inavqw9axznm-builder.pl.drv
  /nix/store/jba1yg6ihc3w2gg749r6qd12rnj9dlq6-rake-12.3.2.drv
  /nix/store/cxk6sg2906lz5gj9pkz8fszy9fycnh16-rake-12.3.2.drv
  /nix/store/sx11vz4pk4vxq6kpzs8gardj2ksba7wc-qtsvg-5.15.2.drv
  /nix/store/xv30m9m3ksw7k8m5szxig6sc1l3s20ky-qtdeclarative-5.15.2.drv
  /nix/store/p8dbhq1sq2403krgbd359wrcpdf299bb-qtmultimedia-5.15.2.drv
  /nix/store/nf9s8gmq1yca51d48afqgly1hl14shwd-mkvtoolnix-59.0.0.drv
...
building '/nix/store/nf9s8gmq1yca51d48afqgly1hl14shwd-mkvtoolnix-59.0.0.drv'...
qtPreHook
unpacking sources
unpacking source archive /nix/store/mz536dgm2lpyjs0bv5m8shyq35qm5vk1-source
source root is source
patching sources
...
autoreconfPhase
...
configure flags: --disable-static --prefix=/nix/store/1scgyj0kdwscdv6sv7wg8hn1m4bcr3w8-mkvtoolnix-59.0.0 --disable-debug --disable-precompiled-headers --disable-profiling --disable-static-qt --enable-optimization --with-boost-libdir=/nix/store/69m1630x5zhf9ss7p41dhz1av1bjsskj-boost-1.69.0/lib --with-docbook-xsl-root=/nix/store/fg626pn832krsx7hgc3anj79mp9ja2bc-docbook-xsl-nons-1.79.2/share/xml/docbook-xsl --with-gettext --disable-gui
checking build system type... x86_64-apple-darwin20.4.0
checking host system type... x86_64-apple-darwin20.4.0
checking target system type... x86_64-apple-darwin20.4.0
checking for gcc... clang
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether clang accepts -g... yes
checking for clang option to enable C11 features... none needed
checking whether clang and cc understand -c and -o together... yes
checking how to run the C preprocessor... clang -E
checking whether the compiler supports GNU C++... yes
checking whether clang++ accepts -g... yes
checking for clang++ option to enable C++11 features... none needed
checking how to run the C++ preprocessor... clang++ -E
...
checking compiler type and version... clang 7.1.0
checking for lld... no
checking for support for the "-std=c++17" flag... -std=c++17
checking for support for C++17 feature "attribute 'maybe_unused'"... yes
checking for support for C++17 feature "nested namespace definition"... yes
checking for support for C++17 feature "structured bindings"... yes
checking for support for C++17 feature "std::optional"... yes
checking for support for C++17 feature "std::gcd"... yes
checking for support for C++17 feature "constexpr if"... yes
checking for support for C++17 feature "file system library"... yes
checking for libraries to link against for the file system library...
checking whether the byte order is big-endian... no
checking if being compiled with mingw32... no
checking for int64_t... yes
checking for uint64_t... yes
checking size of int... 4
checking size of long... 8
checking size of long long... 8
checking for iconv.h... yes
checking for iconv... yes
checking for iconv declaration...
         extern size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
checking for nl_langinfo... yes
checking for ogg_sync_init in -logg... yes
checking for ogg/ogg.h... yes
checking for vorbis_synthesis_init in -lvorbis... yes
checking for vorbis/codec.h... yes
checking for FLAC__stream_decoder_new in -lFLAC... yes
checking for FLAC__StreamMetadata_StreamInfo.sample_rate... yes
checking for FLAC__stream_decoder_skip_single_frame in -lFLAC... yes
checking for EBML... yes
checking for MATROSKA... yes
checking for PUGIXML... yes
configure: Using the system version of the pugixml library
checking nlohmann's json-cpp... yes
configure: Using the system version of nlohmann json-cpp
checking for utf8.h... no
configure: Using the internal version of UTF8-CPP
checking fmt... yes
checking for ZLIB... yes
checking for qmake6... no
checking for Qt 6... no: qmake6 not found
checking for qmake... using supplied /nix/store/a3pjrfvkgsc68zd2wjpn8faglzkijjcl-qtbase-5.15.2-dev/bin/qmake
checking for qmake's version... 5.15.2
checking for lconvert... no
checking for moc... /nix/store/a3pjrfvkgsc68zd2wjpn8faglzkijjcl-qtbase-5.15.2-dev/bin/moc
checking for rcc... /nix/store/a3pjrfvkgsc68zd2wjpn8faglzkijjcl-qtbase-5.15.2-dev/bin/rcc
checking for uic... /nix/store/a3pjrfvkgsc68zd2wjpn8faglzkijjcl-qtbase-5.15.2-dev/bin/uic
checking for Qt 5... yes
checking for boostlib >= 1.66.0... yes
checking for Boost's multi-precision library with GMP backend... yes
checking for boost/operators.hpp... yes
checking for main in -lgtest_main... yes
checking for gtest/gtest.h... yes
checking for valgrind... no
checking for main in -lbenchmark... no
checking for benchmark/benchmark.h... no
checking for pandoc... no
checking for DocBook XSL root directory... using supplied /nix/store/fg626pn832krsx7hgc3anj79mp9ja2bc-docbook-xsl-nons-1.79.2/share/xml/docbook-xsl
checking for xsltproc... /nix/store/jkg88hjdz5cp2yqnbxcbi54k66jgnai7-libxslt-1.1.34-bin/bin/xsltproc
checking whether xsltproc works... yes
checking POSIX termios... yes
checking whether termios.h defines TIOCGWINSZ... yes
checking for sys/ioctl.h... yes
checking for dvdread... yes
checking for po4a... no
checking for po4a-translate... no
checking for gettext... no
checking for gettext in -lintl... yes
checking for msgfmt... /nix/store/hdrwrac2r06nmcifk2asg2j7hinb5qpb-gettext-0.21/bin/msgfmt
checking for libintl.h... yes
checking the translations to install... bg ca cs de es eu fr it ja ko lt nl pl pt pt_BR ro ru sr_RS sr_RS@latin sv tr uk zh_CN zh_TW
checking the manpage translation languages to install... bg ca de es fr it ja ko nl pl ru uk zh_CN zh_TW
configure: creating ./config.status
config.status: creating build-config
config.status: creating config.h

The mkvtoolnix configuration is complete.
Optional features that are built:
   * online update check in the GUI
   * compiler optimizations
   * FLAC audio
   * DVD chapter support via libdvdread
   * translations (gettext)
Optional features that are NOT built:
   * debugging information
   * profiling support
   * development technique 'address sanitizer'
   * development technique 'undefined behavior sanitizer'
   * pre-compiled headers
   * make a static build of the applications
   * MKVToolNix GUI
   * man page translations (po4a)
building
...
running tests
...
installing
...
/nix/store/1scgyj0kdwscdv6sv7wg8hn1m4bcr3w8-mkvtoolnix-59.0.0


$ ./result/bin/mkvinfo --help
mkvinfo [options] <inname>

 Options:
...

Maybe @matthewbauer can comment about the LLVM version used for Qt and if it is possible to switch to default stdenv.

@smancill
Copy link
Contributor

smancill commented Aug 12, 2021

Don't mind my comment about switching to Qt 5.15, it's not ready yet: #125548.

But using default stdenv should fix the configure phase, unless LLVM 7 doesn't work with Qt 5.12 (which I didn't test and it takes too long to recompile mkvtoolnix again).

@veprbl
Copy link
Member

veprbl commented Aug 12, 2021

Digging around, commit 98dcfcf (mkvtoolnix: 56.0.0 -> 59.0.0, 2021-07-15) replaced stdenv.mkDerivation with mkDerivation provided by libsForQt.callPackage, which is the right thing to do as I understand when building Qt applications

Actually that's been obsoleted since then. Using stdenv.mkDerivation is fine, but you will also need to add wrapQtAppsHook.

@rnhmjoj
Copy link
Contributor

rnhmjoj commented Aug 12, 2021

Actually that's been obsoleted since then. Using stdenv.mkDerivation is fine, but you will also need to add wrapQtAppsHook.

This issue proves why a custom mkDerivation for Qt application was a bad idea. I wonder why we don't just replace it everywhere with just wrapQtAppsHook now.

smancill added a commit to smancill/nixpkgs that referenced this issue Aug 13, 2021
Use stdenv.mkDerivation instead of mkDerivation from libsForQt5, because
the latter forces the compiler to LLVM 5 on Darwin, which doesn't
support the new C++ filesystem library.

Fixes NixOS#132675.
veprbl pushed a commit that referenced this issue Aug 13, 2021
Use stdenv.mkDerivation instead of mkDerivation from libsForQt5, because
the latter forces the compiler to LLVM 5 on Darwin, which doesn't
support the new C++ filesystem library.

Fixes #132675.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug 6.topic: darwin Running or building packages on Darwin
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants