[Nix-dev] /usr/bin/gs and /usr/bin/cifmp250

Nawal Husnoo nawal at husnoo.com
Tue Jun 20 21:32:47 CEST 2017


Ah the lesson is I need to wake up fully before coding! Thank you!

Still stuck - so close and yet so far!

Error:
======

Jun 20 20:17:17 heisenbug cupsd[21991]: pstocanonij: /usr/bin/gs -r600
-g4958x7016 -q -dNOPROMPT -dSAFER -sDEVICE=ppmraw -sOutputFile=- -|
/usr/bin/cifmp250 --imageres 600 --papersize a4 --media plain --paperload
asf --bbox 9,14,586,834 --fit
Jun 20 20:17:17 heisenbug cupsd[21991]: /bin/sh: /usr/bin/gs: No such file
or directory
Jun 20 20:17:17 heisenbug cupsd[21991]: /bin/sh: /usr/bin/cifmp250: No such
file or directory
Jun 20 20:17:17 heisenbug cupsd[21991]: Sent 0 bytes...

Of course, the files /usr/bin/gs and /usr/bin/cifmp250 don't exist, this
being nix and all...


[nawal at heisenbug:~/data/nixos/user/pkgs/canon]$ which gs
/home/nawal/.nix-profile/bin/gs

[nawal at heisenbug:~/data/nixos/user/pkgs/canon]$ which cifmp250
/home/nawal/.nix-profile/bin/cifmp250

Closest thing I found was:
https://github.com/NixOS/nixpkgs/blob/master/pkgs/misc/cups/drivers/canon/default.nix
https://github.com/NixOS/nixpkgs/blob/master/pkgs/misc/cups/drivers/canon/preload.c

but it's not clear to me how to port that to my problem... It's not even
clear to me who's calling these two binaries, as grepping the deb file
contents isn't turning up anything...

thanks for any ideas!

Nawal




default.nix
======================================================
{ stdenv
, pkgs
, udev
, alsaLib
, gtk2-x11
, patchelf
, binutils
, popt
, cups
, cairo
, pango
, fontconfig
, glib
, dpkg
, atk
, procps
, gdk_pixbuf
, zlib
, libxml2
, perl
, libtiff
, firefox
, libX11
, libXcursor
, libXrandr
, libXext
, libXinerama
, libXrender
, libXi
, libXfixes
, libpng12
, pkgconfig
}:

stdenv.mkDerivation {
    name = "canon-mp250";
    src = ./usr;
    builder = ./builder.sh;
    buildInputs = [libtiff perl pkgconfig];

    configurePhase = ''
        echo "CONFIGURE TIFF ${libtiff.out}/lib/libtiff.so"
    '';

    libPath = stdenv.lib.makeLibraryPath [
        stdenv.cc.cc
udev
alsaLib
gtk2-x11
binutils
popt
        cups
cairo
pango
fontconfig
glib
dpkg
atk
procps
patchelf
gdk_pixbuf
libxml2
libtiff
libpng12
libX11
libXcursor
libXrandr
libXext
libXinerama
libXrender
libXi
libXfixes
    ];

}





builder.sh
======================================================
source $stdenv/setup

mkdir -p $out/
cp -r $src/* $out/


chmod 777 -R $out/*

patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
    --set-rpath $libPath:$out/lib \
    $out/bin/cngpijmonmp250

patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
    --set-rpath $libPath:$out/lib \
    $out/bin/cngpij

patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
    --set-rpath $libPath:$out/lib \
    $out/bin/cnijnetprn

patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
    --set-rpath $libPath:$out/lib \
    $out/bin/lgmonmp250

patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
    --set-rpath $libPath:$out/lib \
    $out/bin/cifmp250

patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
    --set-rpath $libPath:$out/lib \
    $out/bin/printuimp250

patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
    --set-rpath $libPath:$out/lib \
    $out/bin/cnijnpr

patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
    --set-rpath $libPath:$out/lib \
    $out/lib/cups/filter/pstocanonij

patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
    --set-rpath $libPath:$out/lib \
    $out/lib/cups/backend/cnijusb

patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
    --set-rpath $libPath:$out/lib \
    $out/lib/cups/backend/cnijnet

ls -lh $out/lib/
ls -lh $out/

ln -sv $out/lib/libcnbpcmcm356.so.8.0.1 $out/lib/libcnbpcmcm356.so
ln -sv $out/lib/libcnbpcnclbjcmd356.so.3.3.0 $out/lib/libcnbpcnclbjcmd356.so
ln -sv $out/lib/libcnbpess356.so.3.3.3 $out/lib/libcnbpess356.so
ln -sv $out/lib/libcnnet.so.1.2.0 $out/lib/libcnnet.so
ln -sv $out/lib/libcnbpcnclapi356.so.3.5.0 $out/lib/libcnbpcnclapi356.so
ln -sv $out/lib/libcnbpcnclui356.so.3.6.0 $out/lib/libcnbpcnclui356.so
ln -sv $out/lib/libcnbpo356.so.1.0.2 $out/lib/libcnbpo356.so

LIBTIFF=$(pkg-config --libs-only-L libtiff-4 | sed -e
's/-L//g')/libtiff.so.5
ln -s $LIBTIFF $out/lib/libtiff.so.4






On 20 June 2017 at 10:11, Kirill Elagin <kirelagin at gmail.com> wrote:

> You do `chmod 777` on a bunch of files, but not on `$out/lib`, but it’s
> the creation of a link in `$out/lib` that fails, and according to your
> output of `ls` the `lib` directory does not have the `w` permission indeed,
> which is required to create a link in it.
>
> I am not sure how this works exactly, but it seems that `cp` removes the
> `w` permission when copying, so you either have to reset this permissions
> yourself or, probably simpler, `mkdir -p "$out/lib"` beforehand, in which
> case `cp` will not overwrite its permissions.
>
> On Tue, Jun 20, 2017 at 11:28 AM Nawal Husnoo <nawal at husnoo.com> wrote:
>
>> Hi
>>
>> I have the following default.nix and builder.sh, copied from the acroread
>> example and adapted. They are called from config.nix. I'm getting
>> permission denied when I try to create a symbolic link. Any ideas?
>>
>> thanks
>>
>> Nawal
>>
>>
>> Error:
>>
>> [nawal at heisenbug:~/data/nixos/user/pkgs/canon]$  nix-env -i all
>> warning: there are multiple derivations named ‘all’; using the first one
>> replacing old ‘all’
>> installing ‘all’
>> these derivations will be built:
>>   /nix/store/w1w639kybx0lgvdmnb9ipg0j1xvb9wlq-canon-mp250.drv
>>   /nix/store/bmp2ibgc82rmx14bgavd3pknwxwdp4ld-all.drv
>> building path(s) ‘/nix/store/q5qyxyqrfscdv7yj6aywx9v518215w
>> dr-canon-mp250’
>> total 764K
>> dr-xr-xr-x 2 nixbld1 nixbld 4.0K Jun 20 08:23 bjlib
>> dr-xr-xr-x 4 nixbld1 nixbld 4.0K Jun 20 08:23 cups
>> -r-xr-xr-x 1 nixbld1 nixbld  47K Jun 20 08:23 libcnbpcmcm356.so.8.0.1
>> -r-xr-xr-x 1 nixbld1 nixbld  41K Jun 20 08:23 libcnbpcnclapi356.so.3.5.0
>> -r-xr-xr-x 1 nixbld1 nixbld  21K Jun 20 08:23 libcnbpcnclbjcmd356.so.3.3.0
>> -r-xr-xr-x 1 nixbld1 nixbld  29K Jun 20 08:23 libcnbpcnclui356.so.3.6.0
>> -r-xr-xr-x 1 nixbld1 nixbld 522K Jun 20 08:23 libcnbpess356.so.3.3.3
>> -r-xr-xr-x 1 nixbld1 nixbld  42K Jun 20 08:23 libcnbpo356.so.1.0.2
>> -r-xr-xr-x 1 nixbld1 nixbld  38K Jun 20 08:23 libcnnet.so.1.2.0
>> total 12K
>> dr-xr-xr-x 2 nixbld1 nixbld 4.0K Jun 20 08:23 bin
>> dr-xr-xr-x 4 nixbld1 nixbld 4.0K Jun 20 08:23 lib
>> dr-xr-xr-x 7 nixbld1 nixbld 4.0K Jun 20 08:23 share
>> ln: failed to create symbolic link '/nix/store/
>> q5qyxyqrfscdv7yj6aywx9v518215wdr-canon-mp250/lib/libcnbpcmcm356.so':
>> Permission denied
>> builder for ‘/nix/store/w1w639kybx0lgvdmnb9ipg0j1xvb9wlq-canon-mp250.drv’
>> failed with exit code 1
>> cannot build derivation ‘/nix/store/bmp2ibgc82rmx14bgavd3pknwxwdp4ld-all.drv’:
>> 1 dependencies couldn't be built
>> error: build of ‘/nix/store/bmp2ibgc82rmx14bgavd3pknwxwdp4ld-all.drv’
>> failed
>>
>>
>>
>> config.nix
>> with import <nixpkgs> {};
>>
>> {
>>     allowUnfree = true;
>>
>>     packageOverrides = pkgs_: with pkgs_; {
>>         canon = callPackage ./pkgs/canon {
>>             inherit (pkgs) pkgs;
>>         };
>>
>>
>>         all = with pkgs; buildEnv {
>>             name = "all";
>>             paths = [
>>                 canon
>>             ];
>>         };
>>     };
>> }
>>
>>
>> default.nix:
>> { stdenv
>> , pkgs
>> , udev
>> , alsaLib
>> , gtk2-x11
>> , patchelf
>> , binutils
>> , popt
>> , cups
>> , cairo
>> , pango
>> , fontconfig
>> , glib
>> , dpkg
>> , atk
>> , procps
>> , gdk_pixbuf
>> , zlib
>> , libxml2
>> , libtiff
>> , firefox
>> , libX11
>> , libXcursor
>> , libXrandr
>> , libXext
>> , libXinerama
>> , libXrender
>> , libXi
>> , libXfixes
>> }:
>>
>> stdenv.mkDerivation {
>>     name = "canon-mp250";
>>     src = ./usr;
>>     builder = ./builder.sh;
>>     libPath = stdenv.lib.makeLibraryPath [
>>         stdenv.cc.cc
>> udev
>> alsaLib
>> gtk2-x11
>> binutils
>> popt
>>         cups
>> cairo
>> pango
>> fontconfig
>> glib
>> dpkg
>> atk
>> procps
>> patchelf
>> gdk_pixbuf
>> libxml2
>> libtiff
>> libX11
>> libXcursor
>> libXrandr
>> libXext
>> libXinerama
>> libXrender
>> libXi
>> libXfixes
>>     ];
>>
>> }
>>
>>
>> builder.sh:
>> source $stdenv/setup
>>
>> mkdir -p $out/
>> cp -r $src/* $out/
>>
>>
>> chmod 777 -R $out/bin/*
>> chmod 777 -R $out/lib/cups/filter/*
>> chmod 777 -R $out/lib/cups/backend/*
>>
>> patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
>>     --set-rpath $libPath:$out/lib \
>>     $out/bin/cngpijmonmp250
>>
>> patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
>>     --set-rpath $libPath:$out/lib \
>>     $out/bin/cngpij
>>
>> patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
>>     --set-rpath $libPath:$out/lib \
>>     $out/bin/cnijnetprn
>>
>> patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
>>     --set-rpath $libPath:$out/lib \
>>     $out/bin/lgmonmp250
>>
>> patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
>>     --set-rpath $libPath:$out/lib \
>>     $out/bin/cifmp250
>>
>> patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
>>     --set-rpath $libPath:$out/lib \
>>     $out/bin/printuimp250
>>
>> patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
>>     --set-rpath $libPath:$out/lib \
>>     $out/bin/cnijnpr
>>
>> patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
>>     --set-rpath $libPath:$out/lib \
>>     $out/lib/cups/filter/pstocanonij
>>
>> patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
>>     --set-rpath $libPath:$out/lib \
>>     $out/lib/cups/backend/cnijusb
>>
>> patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
>>     --set-rpath $libPath:$out/lib \
>>     $out/lib/cups/backend/cnijnet
>>
>> ls -lh $out/lib/
>> ls -lh $out/
>>
>> ln -sv $out/lib/libcnbpcmcm356.so.8.0.1 $out/lib/libcnbpcmcm356.so
>> ln -sv $out/lib/libcnbpcnclbjcmd356.so.3.3.0
>> $out/lib/libcnbpcnclbjcmd356.so
>> ln -sv $out/lib/libcnbpess356.so.3.3.3 $out/lib/libcnbpess356.so
>> ln -sv $out/lib/libcnnet.so.1.2.0 $out/lib/libcnnet.so
>> ln -sv $out/lib/libcnbpcnclapi356.so.3.5.0 $out/lib/libcnbpcnclapi356.so
>> ln -sv $out/lib/libcnbpcnclui356.so.3.6.0 $out/lib/libcnbpcnclui356.so
>> ln -sv $out/lib/libcnbpo356.so.1.0.2 $out/lib/libcnbpo356.so
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>> nix-dev mailing list
>> nix-dev at lists.science.uu.nl
>> https://mailman.science.uu.nl/mailman/listinfo/nix-dev
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.science.uu.nl/pipermail/nix-dev/attachments/20170620/09148878/attachment-0001.html>


More information about the nix-dev mailing list