Packaging/Quirks and Caveats: Difference between revisions

imported>Makefu
mNo edit summary
imported>Makefu
Caveats: add /etc/protocols sandbox fix
Line 58: Line 58:
This can happen when importing python libraries:  
This can happen when importing python libraries:  
Solution: add <code>${stdenv.cc.cc.lib}/lib/libstdc++.so.6</code> to the <code>LD_LIBRARY_PATH</code>.
Solution: add <code>${stdenv.cc.cc.lib}/lib/libstdc++.so.6</code> to the <code>LD_LIBRARY_PATH</code>.
=== Test cannot access <code>/etc/protocols</code> when building in sandbox ===
Sometimes libraries try to fetch protocol specs via <code>socket.getprotobyname('tcp')</code> which fails in sandboxes because /etc/protocols is unaccessible. Override pre- and postCheck phases with this:
<syntaxHighlight lang="nix">
    preCheck = ''
      export NIX_REDIRECTS=/etc/protocols=${pkgs.iana-etc}/etc/protocols \
        LD_PRELOAD=${pkgs.libredirect}/lib/libredirect.so
    '';
    postCheck = ''
      unset NIX_REDIRECTS LD_PRELOAD
    '';
</syntaxHighlight>


[[Category:Guide]]
[[Category:Guide]]