[Nix-dev] Hard-coded dlload paths in .so [was: Nix expression for closed-source scanner driver]

Bjørn Forsman bjorn.forsman at gmail.com
Tue Dec 16 20:26:42 CET 2014


On 16 December 2014 at 19:25, Peter Jones <mlists at pmade.com> wrote:
> Bjørn Forsman <bjorn.forsman at gmail.com> writes:
>> On 16 December 2014 at 02:09, Peter Jones <mlists at pmade.com> wrote:
>>> I'm working on a Nix expression to install a proprietary scanner driver
>>> that is available as a Debian package.  After using `nix-env' to install
>>> the package I'm still not able to see my scanner in the list produced by
>>> `scanimage -L' or `sane-find-scanner'.
>>>
>>> Here's the expression (WIP):
>>>
>>>   https://github.com/pjones/nixpkgs/blob/pkg/brother/pkgs/misc/drivers/brother/dsseries.nix
[...]
>> Maybe you must patchelf some binaries? See if this finds something
>> that points to (nonexisting) /usr/... or similar:
>>
>> find $out | while read f; do patchelf --print-rpath "$f"; done
>
> None of the .so files in the binary package have an RPATH set.  I was
> able to use strace and strings to discover that the main .so for the
> scanner driver tries to dlload two other .so files using hard-coded
> paths.
>
> Can I alter the strings in the .so or do I need to make some sort of
> wrapper that intercepts the dlload calls and loads the correct
> libraries?  If the latter, is there an example somewhere I can use as a
> guide?

1) Don't know. Try :-)

2) You can have a look at saleae-logic, eagle and spotify expressions
in nixpkgs. They all use LD_PRELOAD to rewrite some file paths at
runtime.

Best regards,
Bjørn Forsman


More information about the nix-dev mailing list