Commit Graph

4 Commits

Author SHA1 Message Date
Melvyn
d0a99254bf
build-fhs-user-env: add compatibility for pipewire alsa emulation 2024-02-02 22:38:49 -08:00
Sergei Trofimovich
2da0307220 buildFHSEnv: fix NIX_LDFLAGS propagation to ld wrapper
Before the change the following command did not work:

    $ nix develop -i --impure --expr 'with import <nixpkgs> { system = "i686-linux"; }; (buildFHSUserEnv { name = "t"; targetPkgs = ps: with ps; [ libmpc stdenv.cc ]; }).env'
    $ ld -lmpc -o a
    ld: cannot find -lmpc: No such file or directory

It is expected to work as `NIX_LDFLAGS` does contain valid values:

    $ echo $NIX_LDFLAGS
    -L/usr/lib -L/usr/lib32

Note that for `gcc` it does work:

    $ printf "int main(){}" |  gcc -x c - -lmpc -o a

It happens because `HOST` role is enabled for `cc`:

    $ echo $NIX_CC_WRAPPER_TARGET_HOST_i686_unknown_linux_gnu
    1

But not for `BINTOOLS`:

    $ echo $NIX_BINTOOLS_WRAPPER_TARGET_HOST_i686_unknown_linux_gnu
    <empty>

The change adds BINTOOLS role and fixes linking:

    $ nix develop -i --impure --expr 'with import ~/nm { system = "i686-linux"; }; (buildFHSUserEnv { name = "t"; targetPkgs = ps: with ps; [ libmpc stdenv.cc ]; }).env'
    $ printf "int main(){}" |  gcc -x c - -lmpc -o a
    $ ld -lmpc -o a
    ld: warning: cannot find entry symbol _start; not setting start address
2023-08-21 07:50:37 +01:00
lelgenio
8aafc553ae buildFHSEnv: use default values as fallback for XDG_DATA_DIRS 2023-05-08 18:56:51 -03:00
Atemu
f63a12f296 tree-wide: buildFHSUserEnv -> buildFHSEnv 2023-04-16 10:15:13 +02:00