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
exiv2: Patch cmake files to correctly locate libs #95112
Conversation
Exiv2's .so and .a files are placed in the default output, but the cmake file looks for them in the dev output. This causes build failures in at least once case (NixOS#77581). This patch takes the same approach as NixOS#33953, which solved a similar issue in the clang derivation. The two outputs in question (.out and .dev) looks like this: /nix/store/...-exiv2-0.27.2 |-- bin | `-- exiv2 `-- lib |-- libexiv2-xmp.a |-- libexiv2.so -> libexiv2.so.27 |-- libexiv2.so.0.27.2 `-- libexiv2.so.27 -> libexiv2.so.0.27.2 /nix/store/...exiv2-0.27.2-dev |-- include | `-- exiv2 | |-- *.h | `-- *.hpp |-- lib | |-- cmake | | `-- exiv2 | | |-- exiv2Config-release.cmake | | |-- exiv2Config.cmake | | `-- exiv2ConfigVersion.cmake | `-- pkgconfig | `-- exiv2.pc `-- nix-support `-- propagated-build-inputs
I'm running As mentioned in #77581, I have been using this patch locally for a few days to successfully build and run digikam 7. Things seem to work as expected. |
Also note that I have zero experience with cmake; if there's a better way to resolve this, I'm all ears. 🙂 |
@@ -106,6 +106,10 @@ stdenv.mkDerivation rec { | |||
rm * | |||
mv .exiv2 exiv2 | |||
) | |||
|
|||
# Tell cmake to look in the default output to find exiv2's .so and .a files | |||
substituteInPlace $out/lib/cmake/exiv2/exiv2Config-release.cmake \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh? Should not this file be in dev
output?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should it? Just the libexiv2-xmp.a
, right? I could change the derivation to move that to the dev
output instead, if you think that'd be a better solution. Was trying to be minimally invasive here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean the lib/cmake
directory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, right! Attempting to do that (substituteInPlace $dev/lib/cmake/...
) gives me an error that file '/nix/store/...-exiv2-0.27.2-dev/lib/cmake/exiv2/exiv2Config-release.cmake' does not exist
. Seems like that tree is still inside $out
during postInstall
? (I'm not entirely sure how multiple output packages work, and skimming the nixpkgs manual isn't clarifying it for me.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, right it is moved during preFixup
by the setup hook:
preFixupHooks+=(_multioutDevs) |
nixpkgs/pkgs/build-support/setup-hooks/multiple-outputs.sh
Lines 151 to 157 in bf47b82
_multioutDevs() { | |
if [ "$outputs" = "out" ] || [ -z "${moveToDev-1}" ]; then return; fi; | |
moveToOutput include "${!outputInclude}" | |
# these files are sometimes provided even without using the corresponding tool | |
moveToOutput lib/pkgconfig "${!outputDev}" | |
moveToOutput share/pkgconfig "${!outputDev}" | |
moveToOutput lib/cmake "${!outputDev}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like lib/cmake
gets moved to the dev
output during preFixup
phase, which comes after this postInstall
script.
So is this OK, or does a change need to be made?
(Cite: https://github.com/NixOS/nixpkgs/blob/20.03/pkgs/build-support/setup-hooks/multiple-outputs.sh#L4)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be fine. Could you include a link to #95232 in the comment, though?
Ideally someone would make a pull request against the upstream repository to support absolute |
I believe Result of 8 packages failed to build:- calligra - gimpPlugins.focusblur - gimpPlugins.texturize - photivo - photoflow - python27Packages.pyexiv2 - python37Packages.py3exiv2 - python38Packages.py3exiv2 110 packages built:- cataract - cataract-unstable - darktable - deja-dup - digikam (digikam5) - dolphin - doodle - dragon - dropbox-cli - elisa - empathy - exiv2 - geeqie - gegl_0_4 - gexiv2 - gimp - gimp-with-plugins - gimpPlugins.exposureBlend - gimpPlugins.fourier - gimpPlugins.gap - gimpPlugins.gimplensfun - gimpPlugins.gmic - gimpPlugins.lightning - gimpPlugins.lqrPlugin - gimpPlugins.resynthesizer - gimpPlugins.ufraw - gimpPlugins.waveletSharpen - gmic-qt-krita (gmic_krita_qt) - gnome-photos - gnome3.cheese - gnome3.file-roller - gnome3.gnome-books - gnome3.gnome-boxes - gnome3.gnome-color-manager - gnome3.gnome-contacts - gnome3.gnome-control-center - gnome3.gnome-documents - gnome3.gnome-terminal - gnome3.gnome-tweak-tool - gnome3.gnome-user-share - gnome3.nautilus - gnome3.nautilus-python - gnome3.shotwell - gnome3.totem - gnome3.tracker-miners - gnomeExtensions.gsconnect - gnunet - gnunet-gtk - gnunet_git - gpscorrelate - gramps - gthumb - gwenview - hugin - k3b - kde-cli-tools - kdeApplications.baloo-widgets - kdeApplications.dolphin-plugins - kdeApplications.kdegraphics-thumbnailers - kdeApplications.kdenlive - kdeApplications.kfind - kdeApplications.kio-extras - kdeApplications.kolourpaint - libsForQt5.libkexiv2 (kdeApplications.libkexiv2) - kdeApplications.okular - libsForQt5.baloo (kdeFrameworks.baloo) - libsForQt5.kfilemetadata (kdeFrameworks.kfilemetadata) - kdeplasma-addons - kdev-php - kdev-python - kdevelop - kdevelop-unwrapped - kile - kmenuedit - krename (krename-qt5) - krita - krohnkite - kwin-tiling - libextractor - plasma5.khotkeys (libsForQt5.khotkeys) - luminanceHDR - mythtv - nomacs - pantheon.elementary-greeter - pantheon.elementary-photos - pantheon.extra-elementary-contracts - pantheon.switchboard-plug-pantheon-shell - pantheon.switchboard-with-plugs - pantheon.wingpanel-with-indicators - pdf2djvu - peruse - photoqt - phototonic - plasma-browser-integration - plasma-desktop - plasma-workspace - plasma5.powerdevil - plasma5.systemsettings - qgis - qgis-unwrapped - qimgv - rapid-photo-downloader - strigi - tellico - ufraw - variety - vdrPlugins.xineliboutput - viewnior - viking - wacomtablet The packages that failed to build also failed to build locally without this pull request, so I don't think the failures are related. |
Hmm, this does not seem necessary on master: #95232 (comment) But I do not see why. |
Oh, it was walked around by f1a58ab. |
Oh, great! Thank you for investigating. |
Motivation for this change
Exiv2's
.so
and.a
files are placed in the default output, but the cmake file looks for them in thedev
output. This causes build failures in at least once case (#77581).This patch takes the same approach as #33953, which solved a similar issue in the clang derivation.
The two outputs in question (
.out
and.dev
) looks like this:Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)