lv2-porting-project / JUCE

The JUCE cross-platform C++ framework
https://juce.com
Other
15 stars 4 forks source link

X error with Surge XT #18

Open magnetophon opened 2 years ago

magnetophon commented 2 years ago

I ran into a bug with the LV2 version of Surge XT: The following 3 commits all give an X error when I build Surge XT with them and run the plugin in Jalv.GTK:

"000e15a1e108101a68aa068b5c621a0d5b58f4d6" "936a26d4beb49529d68f3c67765d783dc2de4e62" "99312f2496c9e6524f742489acbf7594053d2e78"

The full error is:

The program 'jalv.gtk' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadWindow (invalid Window parameter)'.
(Details: serial 54 error_code 3 request_code 20 minor_code 0)
(Note to programmers: normally, X errors are reported asynchronously;
that is, you will receive the error a while after causing it.
To debug your program, run it with the --sync command line
option to change this behavior. You can then get a meaningful
backtrace from your debugger if you break on the gdk_x_error() function.)

The following commit doesn't show up in jalv:

"36b47a4538514b38d68127c2d0dd4979ba1fd171"

This one bulds and runs fine: "c5174d84fdb12e2233ec3c502fb6a9c54ed87a9f"

These commits don't build on NixOS; looks like they are trying to use git during the build, which NixOS doesn't allow: Could NOT find Git (missing: GIT_EXECUTABLE) Probably not worth inverstigating further, since it's NixOS specific, and also doesn't ocur on other commits, both before and after these. For completeness sake I've included the full build output of one of these builds at the bottom of this issue.

"250b85b6a465c912c1abbe9f2f44b7c308b9e9c4" "ddaa09110392a4419fecbb6d3022bede89b7e841" "f052e1becbd0e62002c2a98ae258432546e4990e" "156722d299935d01759e5deae87b849499cf375f" "1744008413974a2b2d9caf9ffa0a206d3dc863c3" "b421159be31ecf18f4b1600d3a90e2a34d62aab8"

This one works again: "5106d9d77b892c22afcb9379c13982f270429e2e"

I am on Nixos Linux, 64 bit.

-- Validate me! Please! -- Creating pluginval target for plugin: Surge XT.vst3 -- Creating pluginval target for plugin: .vst3 -- Could NOT find Git (missing: GIT_EXECUTABLE) -- Absent git, making extra content commands no-ops -- Configuring incomplete, errors occurred! See also "/build/source/build/CMakeFiles/CMakeOutput.log". See also "/build/source/build/CMakeFiles/CMakeError.log". error: builder for '/nix/store/wv8xp05lqpy6avsi349n2cczxzvhxm0s-surge-XT-unstable-2021-12-24.drv' failed with exit code 1; last 10 log lines:

-- Validate me! Please! -- Creating pluginval target for plugin: Surge XT.vst3 -- Creating pluginval target for plugin: .vst3 -- Could NOT find Git (missing: GIT_EXECUTABLE) -- Absent git, making extra content commands no-ops -- Configuring incomplete, errors occurred! See also "/build/source/build/CMakeFiles/CMakeOutput.log". See also "/build/source/build/CMakeFiles/CMakeError.log". For full logs, run 'nix log /nix/store/wv8xp05lqpy6avsi349n2cczxzvhxm0s-surge-XT-unstable-2021-12-24.drv'.

JugadK commented 2 years ago

For the first issue,I ran into the same problem on arch linux and ardour, and reverting to that commit fixed it (Thank you for that)

  (Details: serial 54 error_code 3 request_code 20 minor_code 0)
  (Note to programmers: normally, X errors are reported asynchronously;
   that is, you will receive the error a while after causing it.
   To debug your program, run it with the --sync command line
   option to change this behavior. You can then get a meaningful
   backtrace from your debugger if you break on the gdk_x_error() function.)

running ardour through gdb I get this segfault after the above message when it attempts to load the lv2

0x00007ffff54e8a95 in clock_nanosleep@GLIBC_2.2.5 () from /usr/lib/libc.so.6

for me it only happen on kde, on gnome is seems to work just fine

KottV commented 2 years ago

surge_xt is tested with 6.1.2 branch https://github.com/lv2-porting-project/JUCE/tree/6.1.2-lv2 does it work for you?

These commits don't build on NixOS; looks like they are trying to use git during the build, which NixOS doesn't allow: Could NOT find Git (missing: GIT_EXECUTABLE)

is it JUCE-lv2 issue? looks like Surge's option

magnetophon commented 2 years ago

surge_xt is tested with 6.1.2 branch https://github.com/lv2-porting-project/JUCE/tree/6.1.2-lv2 does it work for you?

Yes it does.

is it JUCE-lv2 issue? looks like Surge's option

It's probably an NixOS issue. Feel free to ignore.

KottV commented 2 years ago

well, i build Surge XT with 6.1.4 branch and see no crashes in jalv.gtk

изображение

magnetophon commented 2 years ago

@orivej Does the LV2 of the following pkg work for you?

{ stdenv
, lib
, fetchFromGitHub
, cmake
, pkg-config
, alsa-lib
, freetype
, libjack2
, lv2
, libX11
, libXcursor
, libXext
, libXinerama
, libXrandr
}:

let
  juce-lv2 = stdenv.mkDerivation {
    pname = "juce-lv2";
    version = "unstable-2021-12-11";

    # lv2 branch
    src = fetchFromGitHub {
      owner = "lv2-porting-project";
      repo = "JUCE";
      # see https://github.com/lv2-porting-project/JUCE/issues/18
      # rev = "c5174d84fdb12e2233ec3c502fb6a9c54ed87a9f";
      # sha256 = "sha256-jwWDB0XXaKkHJDNOSnhV4tDd+2lt61Qp8gFwXDuY63c=";
      # see https://github.com/lv2-porting-project/JUCE/issues/18#issuecomment-1001005528
      # rev = "13e817f41f381a72a788618852f9c6799c9a9711";
      # sha256 = "sha256-RNS/CahCWT56n8dReAnMUFAtjZ5jJRvJtecrIgiW8fI=";
      # see https://github.com/lv2-porting-project/JUCE/issues/18?notification_referrer_id=NT_kwDOAHSqD7IyODY2NjgyNDQ2Ojc2NDU3MTE&notifications_query=is%3Aunread#issuecomment-1001152634
      rev = "936a26d4beb49529d68f3c67765d783dc2de4e62";
      sha256 = "sha256-XtLN77GZadKNE5ZfifrvcWIfql15z5KfXzyGYH9/M+c=";
    };

    dontConfigure = true;
    dontBuild = true;

    installPhase = ''
      cp -r . $out
    '';
  };
in
stdenv.mkDerivation rec {
  pname = "surge-XT";
  version = "unstable-2021-12-24";

  src = fetchFromGitHub {
    owner = "surge-synthesizer";
    repo = "surge";
    rev = "74164850e53d4891083a1055da5de538bad6f0a1";
    fetchSubmodules = true;
    sha256 = "sha256-SN1m7BWvLQ7EtaNpfZZ8JB9fHDkd9fa6txAoJvjZpBI=";
  };

  nativeBuildInputs = [
    cmake
    pkg-config
  ];

  buildInputs = [
    alsa-lib
    freetype
    libjack2
    lv2
    libX11
    libXcursor
    libXext
    libXinerama
    libXrandr
  ];

  cmakeFlags = [
    "-DJUCE_SUPPORTS_LV2=ON"
    "-DSURGE_JUCE_PATH=${juce-lv2}"
  ];

  # JUCE dlopen's these at runtime, crashes without them
  NIX_LDFLAGS = (toString [
    "-lX11"
    "-lXext"
    "-lXcursor"
    "-lXinerama"
    "-lXrandr"
    "-ljack -L${libjack2}"
  ]);

  # see https://github.com/NixOS/nixpkgs/pull/149487#issuecomment-991747333
  postPatch = ''
    export XDG_DOCUMENTS_DIR=$(mktemp -d)
  '';

  meta = with lib; {
    description = "LV2 & VST3 synthesizer plug-in (previously released as Vember Audio Surge)";
    homepage = "https://surge-synthesizer.github.io";
    license = licenses.gpl3;
    platforms = [ "x86_64-linux" ];
    maintainers = with maintainers; [ magnetophon orivej ];
  };
}