NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.54k stars 13.71k forks source link

Some faust scripts only work in nix-shell #78610

Closed magnetophon closed 3 years ago

magnetophon commented 4 years ago

Describe the bug Faust is a language that can be compiled to many targets.

It has scripts that will do this for you, like faust2alsa, which will generate a alsa program with a GTK ui, or faust2alqt, which will generate an alsa + QT one.

Some of those will work as expected, others only inside a nix-shell.

To Reproduce Steps to reproduce the behavior:

  1. cd /tmp && touch tst.dsp && echo 'process=+;' > tst.dsp
  2. nix-env -iA nixos.faust2alqt
  3. faust2alqt tst.dsp

Working version:

  1. cd /tmp && touch tst.dsp && echo 'process=+;' > tst.dsp
  2. nix-env -iA nixos.faust2alqt
  3. nix-shell $NIXPKGS -A magnetophonDSP.faustCompressors
  4. faust2alqt tst.dsp
  5. ./tst

Additional context All faust scripts used to work up until Jan 2018. I've created this new issue cause the old one only mentioned faust2lv2 and could be worded clearer.

To test in a normal shell:

nix-env -e faust2alqt faust2alsa faust2csound faust2firefox faust2jackrust faust2jack faust2jaqt faust2ladspa faust2lv2

To test in nix-shell, use this shell.nix:

with import <nixpkgs> {};
stdenv.mkDerivation {
  name = "faustEnv";
  buildInputs = [
    faust2alqt
    faust2alsa
    faust2csound
    faust2firefox
    # faust2jackrust #only in the new faust version
    faust2jack
    faust2jaqt
    faust2ladspa
    faust2lv2
  ];
}

working in normal shell faust2csound faust2firefox faust2jack faust2ladspa

only working in nix-shell faust2alqt faust2jaqt faust2lv2

working in neither faust2alsa

The ones that only work in nix-shell claim they are missing dependencies when used in the normal shell, for example this one from faust2alqt:

tst.cpp:5432:10: fatal error: alsa/asoundlib.h: No such file or directory
 5432 | #include <alsa/asoundlib.h>
      |          ^~~~~~~

I'll spare you the errors for the other examples, as I assume they all have the same root cause. Let me know if I should provide them anyway.

faust2alqt is a wrapped shell-script. I tried to debug by adding some relevant echo statements to it, echoing the exact gcc command being called, and echoing env | grep boost. It outputs the exact same thing if I run it from normal shell or nix-shell.

I also tried reverting the last few faust commits and rebuilding from there. No dice.

It would be great to figure out why some only work in nix-shell and even better to fix it! Hints how to troubleshoot further are greatly appreciated.

In my upcoming PR for a faust update, at least none of the scripts are broken in both shells.

Metadata

Maintainer information:

# a list of nixpkgs attributes affected by the problem
attribute:
# a list of nixos modules affected by the problem
module:
magnetophon commented 4 years ago

@pmahoney Would you mind taking a look?

stale[bot] commented 3 years ago

Hello, I'm a bot and I thank you in the name of the community for opening this issue.

To help our human contributors focus on the most-relevant reports, I check up on old issues to see if they're still relevant. This issue has had no activity for 180 days, and so I marked it as stale, but you can rest assured it will never be closed by a non-human.

The community would appreciate your effort in checking if the issue is still valid. If it isn't, please close it.

If the issue persists, and you'd like to remove the stale label, you simply need to leave a comment. Your comment can be as simple as "still important to me". If you'd like it to get more attention, you can ask for help by searching for maintainers and people that previously touched related code and @ mention them in a comment. You can use Git blame or GitHub's web interface on the relevant files to find them.

Lastly, you can always ask for help at our Discourse Forum or at #nixos' IRC channel.

magnetophon commented 3 years ago

still important to me

stale[bot] commented 3 years ago

I marked this as stale due to inactivity. → More info

pmahoney commented 3 years ago

@magnetophon I believe this is a fix; are you able to test this? I successfully compiled your example with faust2alqt.

https://github.com/NixOS/nixpkgs/commit/ceed1e28400a73e1bb2e18cc20ff1683056e6ab5

(or my branch here https://github.com/pmahoney/nixpkgs/tree/faust-outside-nix-shell)

magnetophon commented 3 years ago

Thank you :100: times! Everything works as expected!

Do you want to do a PR, or shall I?

pmahoney commented 3 years ago

https://github.com/NixOS/nixpkgs/pull/126808