Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Click on instrument name does not open file open dialog #505

Closed
magnetophon opened this issue Oct 16, 2020 · 21 comments
Closed

Click on instrument name does not open file open dialog #505

magnetophon opened this issue Oct 16, 2020 · 21 comments
Labels
bug Something isn't working
Milestone

Comments

@magnetophon
Copy link

I just compiled 0.5.0; great work on the GUI!

When I click the instrument name, nothing happens.
sfztools/sfizz-ui#1 leads me to believe this feature is implemented already.

@jpcima
Copy link
Collaborator

jpcima commented Oct 16, 2020

Perhaps the file dialog program is not available on your system?
These will be used if they are present.

  • /usr/bin/zenity
  • /usr/bin/kdialog

@magnetophon
Copy link
Author

Thanks, that must be it:
A NixOS package only find packages it has been explicitly told about.
I can probably fix this myself now.
I'll reopen the issue if not.

@magnetophon
Copy link
Author

With the latest git version:

I hardpatched /usr/bin/zenity in plugins/editor/src/editor/NativeHelpers.cpp to the actual path on my system, but I don't get a dialog, nor an error on the console.

When I don't patch, I do get the visual error at startup.

I also tried patching 0.5.1, from the .gz on the releases page, but I couldn't find a mention of zenity in the code.

@magnetophon magnetophon reopened this Mar 24, 2021
@jpcima
Copy link
Collaborator

jpcima commented Mar 24, 2021

It needs to patch this also in vstgui
plugins/editor/external/vstgui4/vstgui/lib/platform/linux/x11fileselector.cpp

@magnetophon
Copy link
Author

That was quick! Thanks!
💯

@magnetophon
Copy link
Author

Works like a charm!

@magnetophon
Copy link
Author

magnetophon commented Dec 8, 2021

I just compiled 1.1.1, and am again having issues with zenity.

Without any patching, I still get the visual warning dialog.

When I hardcode the path in plugins/editor/src/editor/NativeHelpers.cpp, nothing happens when I try to load a file.
I don't get any warnings, neither visually, nor in the terminal.
Did I miss any files that need to be patched?

Some peculiarities with the hardcoded version:

After trying to load a file in sfizz, it won't close unless I pkill -9 or hit CTRL-C in the terminal.
I tried jalv and ardour.
With ardour, after hitting CTRL-C I get an error that might be related, as I don't remember seeing it elsewhere: watched PID no longer exists - releasing device.

@magnetophon magnetophon reopened this Dec 8, 2021
@paulfd
Copy link
Member

paulfd commented Dec 9, 2021

Hi, I patched it to search for zenity in the path on our VSTGUI fork, see sfztools/vstgui@6143126. Is zenity reachable for you from the command line?

I guess I'll try NixOS in a VM to test things out :) Any install steps I should take care of?

@paulfd
Copy link
Member

paulfd commented Dec 9, 2021

With ardour, after hitting CTRL-C I get an error that might be related, as I don't remember seeing it elsewhere: watched PID no longer exists - releasing device.

I think Ardour always does this.

@magnetophon
Copy link
Author

Hi, I patched it to search for zenity in the path on our VSTGUI fork, see sfztools/vstgui@6143126.

In nixos, each program has it's own path.
For this to work, I'd have to put Zenity in the dependencies of each possible host.

Is zenity reachable for you from the command line?

Yes, but that doesn't help.

I guess I'll try NixOS in a VM to test things out :)

Thanks a lot!

Any install steps I should take care of?

Not that I can think of right now.

In the mean time: Any idea why my hard patching doesn't work anymore?

@paulfd
Copy link
Member

paulfd commented Dec 9, 2021

Hi, I patched it to search for zenity in the path on our VSTGUI fork, see sfztools/vstgui@6143126.

In nixos, each program has it's own path. For this to work, I'd have to put Zenity in the dependencies of each possible host.

Is it that bad a thing, since zenity is a dependency? Sorry if this is a naive question :)

Is zenity reachable for you from the command line?

Yes, but that doesn't help.

I guess I'll try NixOS in a VM to test things out :)

Thanks a lot!

Any install steps I should take care of?

Not that I can think of right now.

In the mean time: Any idea why my hard patching doesn't work anymore?

What are you hard-patching it to? The supposed goal of execvpe is to search paths like the command-line would, afaiu. Longer term I'd like to drop this zenity dependency but for now it has to stay.

@magnetophon
Copy link
Author

Is it that bad a thing, since zenity is a dependency? Sorry if this is a naive question :)

Zenity is a dependency of the plugin, not the host.
So it is in the sfizz nix pkg, but it'd be odd to put it in ardour, jalv, zrythm, etc.

What are you hard-patching it to?

In plugins/editor/src/editor/NativeHelpers.cpp, I'm replacing /usr/bin/zenity with the actual full path on NixOS.

@paulfd
Copy link
Member

paulfd commented Dec 9, 2021

I downloaded the VirtualBox image, managed to (hopefully) find needed libraries in the package manager for sfizz and some build tools, but it seems installing gcc does not install needed libraries (e.g. libgcc, or the needed binutils...) to get a sane building environment.

If you can give me some steps to basically build and launch jalv with sfizz it'd be a great help.

@paulfd paulfd added the bug Something isn't working label Dec 9, 2021
@paulfd paulfd added this to the 1.2.0 milestone Dec 9, 2021
@paulfd
Copy link
Member

paulfd commented Dec 9, 2021

Zenity is a dependency of the plugin, not the host.
So it is in the sfizz nix pkg, but it'd be odd to put it in ardour, jalv, zrythm, etc.

So basically a program can only see other programs if they're in the dependency list?

@magnetophon
Copy link
Author

So basically a program can only see other programs if they're in the dependency list?

Yes indeed.

I'll now go write those steps you asked for.

@magnetophon
Copy link
Author

I downloaded the VirtualBox image, managed to (hopefully) find needed libraries in the package manager for sfizz and some build tools, but it seems installing gcc does not install needed libraries (e.g. libgcc, or the needed binutils...) to get a sane building environment.

In NixOS everything is isolated from everything.
This makes it possible to have many great features, but it's also the biggest downside of NixOS.

To install jalv:

nix-env -iA nixos.jalv

To build the latest sfizz, first clone my copy of nixpkgs:

git clone --branch 21.11pre318500.51bcdc4cdaa https://github.com/magnetophon/nixpkgs.git

Set the en var $NIXPKGS to the above path.

You can simply install the plugin by running:

nix-env -f $NIXPKGS -iA sfizz

To get in a shell with all the needed libs and compilers etc available, do:

nix-shell $NIXPKGS -A sfizz

To build the package in there, using the same instructions as used by the regular installer:

cd /tmp/
genericBuild

I hope that is all correct, cause I'm no NixOS guru, even though I've been using no other OS since 2015.

@magnetophon
Copy link
Author

I ran:

strace -f -s 9999 -o /tmp/sfizz.log  jalv.gtk http://sfztools.github.io/sfizz

These are the log lines around the only occurrences of the string zenity:

2799  mprotect(0x7f9e7c03e000, 4096, PROT_READ) = 0
2799  mprotect(0x7f9e7c061000, 4096, PROT_READ) = 0
2799  mprotect(0x7f9e7c068000, 4096, PROT_READ <unfinished ...>
2813  <... clock_nanosleep resumed>0x7f9e7e0f6b00) = 0
2799  <... mprotect resumed>)           = 0
2813  clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=0, tv_nsec=10000000},  <unfinished ...>
2799  mprotect(0x7f9e74d10000, 135168, PROT_READ) = 0
2799  access("/home/bart/bin/zenity", X_OK) = -1 ENOENT (No such file or directory)
2799  access("/home/bart/.cache/zsh4humans/v5/zsh4humans/zb/zenity", X_OK) = -1 ENOENT (No such file or directory)
2799  access("/home/bart/.local/bin/zenity", X_OK) = -1 ENOENT (No such file or directory)
2799  access("/home/bart/.cargo/bin/zenity", X_OK) = -1 ENOENT (No such file or directory)
2799  access("/run/wrappers/bin/zenity", X_OK) = -1 ENOENT (No such file or directory)
2799  access("/home/bart/.nix-profile/bin/zenity", X_OK) = -1 ENOENT (No such file or directory)
2799  access("/etc/profiles/per-user/bart/bin/zenity", X_OK) = -1 ENOENT (No such file or directory)
2799  access("/nix/var/nix/profiles/default/bin/zenity", X_OK) = -1 ENOENT (No such file or directory)
2799  access("/run/current-system/sw/bin/zenity", X_OK) = -1 ENOENT (No such file or directory)
2799  access("/home/bart/.cache/zsh4humans/v5/fzf/bin/zenity", X_OK) = -1 ENOENT (No such file or directory)
2799  openat(AT_FDCWD, "/nix/store/ra9zhv3v5qddc7lpavqq3jxa5qpjhj5s-suil-qt4-0.10.6/lib/suil-0/libsuil_x11_in_gtk2.so", O_RDONLY|O_CLOEXEC) = 17
2799  read(17, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0 #\0\0\0\0\0\0@\0\0\0\0\0\0\0@b\0\0\0\0\0\0\0\0\0\0@\08\0\10\0@\0\33\0\32\0\1\0\0\0\4\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\220\26\0\0\0\0\0\0\220\26\0\0\0\0\0\0\0\20\0\0\0\0\0\0\1\0\0\0\5\0\0\0\0 \0\0\0\0\0\0\0 \0\0\0\0\0\0\0 \0\0\0\0\0\0]\25\0\0\0\0\0\0]\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\0\0\0\0\10\0\0\0\0\0\0\0\0\0\0\0\n\0\0\0\0\0\0\0\4\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\16\0\0\0\3\0\0\0\r\0\0\0\17\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\23\0\0\0\0\0\0\0\26\0\0\0\24\0\0\0\0\0\0\0\1\0\0\0\22\0\0\0\5\0\0\0\33\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0$\0\0\0\25\0\0\0", 832) = 832
2799  newfstatat(17, "", {st_mode=S_IFREG|0555, st_size=26880, ...}, AT_EMPTY_PATH) = 0

So it seems that it correctly checks my user path.
If I install zenity for my user, the load button works.

The path I thought was a fallback in case zenity was not found, seems to be a fallback for something else.

When I replace return s; with return std::string("${gnome.zenity}/bin/zenity");, I still get the graphical error popup.
When I replace both the above and usr/bin/zenity I get no error but also no zenity, unless it's in my user's path.

I'm stumped.

@magnetophon
Copy link
Author

magnetophon commented Dec 9, 2021

oh, and fwiw, I checked if my replacements were correctly done:

cat plugins/editor/src/editor/NativeHelpers.cpp | grep zenity

returns:

static const std::string zenityPath = [] {
    auto glibPath = g_find_program_in_path("zenity");
        return std::string("/nix/store/8n7g1cmrc6xp8f8blfywvf8ym8vxi8bn-zenity-3.32.0/bin/zenity");
        return std::string("/nix/store/8n7g1cmrc6xp8f8blfywvf8ym8vxi8bn-zenity-3.32.0/bin/zenity");
        const_cast<char *>(zenityPath.c_str()),
    return access(zenityPath.c_str(), X_OK) == 0;

So as far as I can tell, both sides of the if statement return the correct path to zenity.

Mind you, my c/c++ skills are almost nonexistent, so I could very well be wrong.

@paulfd
Copy link
Member

paulfd commented Dec 29, 2021

Hi,

Thanks for the tips. It compiled, and installed. I also have this:
image

Tends to show that zenity is a dependency? I'm not sure how I should set it up in a "NixOS" way for the jalv command to run. Maybe we should discuss on IRC/Discord so you can guide me through. However, given your comment:

If I install zenity for my user, the load button works.

I think we need a way to express in the package management that we need zenity in the user path for this to run. This is the same for other systems, except they don't enforce such a strict separation.

@magnetophon
Copy link
Author

Oh sh*t, sorry to hear you went trough all that.
Over at NixOS/nixpkgs#152092, @hirenashah managed to solve the problem.

I feel bad for not letting you know right away, sorry!

@paulfd
Copy link
Member

paulfd commented Dec 29, 2021

Ho it's fine, good to hear you found a solution!

@paulfd paulfd modified the milestones: 1.2.0, 1.1.2 Dec 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants