Building derivation fails with generic makefile error, manually building in arch seems to work fine

hello everyone, hopefully i’m not asking a silly question but figured i’d give it a try here. so i’m still very much a noob but wanted to try and practice with derivations, but i’m now running into an error that i can’t seem to pinpoint the cause of. i’m trying to package qcma, which depends on a custom library that also isn’t in nixpkgs, so i made a derivation for the library, which builds succesfully:

{ lib, stdenv, fetchFromGitHub, pkg-config, automake, autoconf, libxml2, libusb1, libtool, gettext }:
stdenv.mkDerivation {
pname = “libvitamtp”;
version = “2.5.9”;
src = fetchFromGitHub {
owner = “codestation”;
repo = “vitamtp”;
rev = “v2.5.9”;
hash = “sha256-yKlfy+beEd0uxfWvMCA0kUGhj8lkuQztdSz6i99xiSU=”;
};
nativeBuildInputs = [ pkg-config automake autoconf libxml2 libusb1 libtool gettext ];
configurePhase = ‘’
./autogen.sh
./configure --prefix=$out
‘’;
meta = with lib; {
description = “Library to interact with Vita’s USB MTP protocol”;
homepage = “GitHub - codestation/vitamtp: Library to interact with Vita's USB MTP protocol (No longer maintained)”;
license = licenses.gpl3Only;
};
}

next is the derivation for the actual qcma package:

{ stdenv, lib, fetchFromGitHub, qtbase, libnotify, qmake, wrapQtAppsHook, pkg-config, callPackage }:
let
libvitamtp = callPackage ./…/libvitamtp/derivation.nix {};
in
stdenv.mkDerivation {
pname = “qcma”;
version = “0.4.1”;
src = fetchFromGitHub {
owner = “codestation”;
repo = “qcma”;
rev = “v0.4.1”;
hash = “sha256-eZ6ww01xaFSsD21PdInV2UXSNrYgfZEFzX9Z2c+TmZc=”;
};
buildInputs = [ qtbase libnotify libvitamtp ];
nativeBuildInputs = [ qmake wrapQtAppsHook pkg-config libvitamtp ];
qmakeFlags = [ “CONFIG+=DISABLE_FFMPEG” ];
meta = with lib; {
description = “Content Manager Assistant for the PS Vita”;
homepage = “GitHub - codestation/qcma: Cross-platform content manager assistant for the PS Vita (No longer maintained)”;
license = licenses.gpl3Only;
};
}

this derivation keeps giving the following error:

make: *** [Makefile:49: sub-common-make_first] Error 2

when checking line 49 in the makefile, this is what it says:

cd common/ && ( test -e Makefile || $(QMAKE) -o Makefile /build/source/common/common.pro PREFIX=/nix/store/7bgl8pfgikkm6mrnzlq00y8f6dwx0rjf-qcma-0.4.1 NIX_OUTPUT_OUT=/nix/store/7bgl8pfgikkm6mrnzlq00y8f6dwx0rjf-qcma-0.4.1 NIX_OUTPUT_DEV=/nix/store/7bgl8pfgikkm6mrnzlq00y8f6dwx0rjf-qcma-0.4.1 NIX_OUTPUT_BIN=/nix/store/7bgl8pfgikkm6mrnzlq00y8f6dwx0rjf-qcma-0.4.1 NIX_OUTPUT_DOC=/nix/store/7bgl8pfgikkm6mrnzlq00y8f6dwx0rjf-qcma-0.4.1/share/doc/qt-5.15.14 NIX_OUTPUT_QML=/nix/store/7bgl8pfgikkm6mrnzlq00y8f6dwx0rjf-qcma-0.4.1/lib/qt-5.15.14/qml NIX_OUTPUT_PLUGIN=/nix/store/7bgl8pfgikkm6mrnzlq00y8f6dwx0rjf-qcma-0.4.1/lib/qt-5.15.14/plugins CONFIG+=release CONFIG+=nostrip CONFIG+=DISABLE_FFMPEG ) && $(MAKE) -f Makefile

i honestly have no clue why it errors out here. i tried manually building the package on arch with the same config flags that nix uses by default and it builds just fine. only thing i can think of is that there’s something wrong with those nix variables, but i’m not knowledgeable on that.

edit: sorry for weird blockquotes, new here :slight_smile:

There should be more log output than just that final make message. What does the rest of the output say? I bet there’s a compilation error in there.

(Use ``` on its own line before and after preformatted blocks of text.)

i don’t know if i should post the full log cause it’s kinda long, but these are the last lines of it:

error: builder for '/nix/store/hsy2zapj8217nrg8xj54z4j1m0mhbpph-qcma-0.4.1.drv' failed with exit code 2;
       last 10 log lines:
       >       |                                                                           ^~~~
       > cmaclient.cpp: In static member function 'static int CmaClient::stop()':
       > cmaclient.cpp:265:47: warning: 'QTextStream& QTextStreamFunctions::endl(QTextStream&)' is deprecated: Use Qt::endl [8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wdeprecated-declarations-Wdeprecated-declarations8;;]
       >   265 |     QTextStream(stdout) << "Stopping Qcma" << endl;
       >       |                                               ^~~~
       > /nix/store/5di5x18b7rlcp5mb00fw1gqfjfma9my5-qtbase-5.15.14-dev/include/QtCore/qtextstream.h:293:75: note: declared here
       >   293 | Q_CORE_EXPORT QT_DEPRECATED_VERSION_X(5, 15, "Use Qt::endl") QTextStream &endl(QTextStream &s);
       >       |                                                                           ^~~~
       > make[1]: Leaving directory '/build/source/common'
       > make: *** [Makefile:49: sub-common-make_first] Error 2

That’s not it. You may have to scroll back through hundreds of lines to find the actual problem (if it’s not some cursed error, you’ll see a message from make saying that something caused the build to stop). This is just a thing about make when running many jobs in parallel: if one job fails, any other jobs still running can continue and dump plenty of output.

ah, i didn’t even realize that, i took a quick look through the full log and perhaps this is the culprit?:

make[1]: *** No rule to make target 'resources/translations/qcma_fr.qm', needed by 'qrc_translations.cpp'.  Stop.
make[1]: *** Waiting for unfinished jobs....

That looks suggestive!

So you’re missing a .qm file; those are, I believe, generated by the lrelease tool. Try adding qttools to your nativeBuildInputs and adding this to the derivation:

preBuild = ''
  lrelease-pro qcma.pro
'';
2 Likes

yep, that seems to have done the trick! compiled succesfully, binary seems to be working as expected as well. thank you so much!

1 Like