From aa3fd4aed55fedeb9264ce5364efd2269c8c5254 Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Fri, 8 Apr 2022 11:55:32 +0200 Subject: [PATCH] openocd: fix segfault caused by libusb incompatibility This issue is fixed in upstream OpenOCD, but there hasn't been a new release since the fix. See https://github.com/libusb/libusb/issues/928 for context. Signed-off-by: Elias Naur --- pkgs/development/embedded/openocd/default.nix | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkgs/development/embedded/openocd/default.nix b/pkgs/development/embedded/openocd/default.nix index c2f7d231b1a5..6b4fa9238946 100644 --- a/pkgs/development/embedded/openocd/default.nix +++ b/pkgs/development/embedded/openocd/default.nix @@ -1,5 +1,6 @@ { stdenv , lib +, fetchpatch , fetchurl , pkg-config , hidapi @@ -21,6 +22,15 @@ stdenv.mkDerivation rec { buildInputs = [ hidapi libftdi1 libusb1 ] ++ lib.optional stdenv.isLinux libgpiod; + patches = [ + # Patch is upstream, so can be removed when OpenOCD 0.12.0 or later is released. + (fetchpatch + { + url = "https://github.com/openocd-org/openocd/commit/cff0e417da58adef1ceef9a63a99412c2cc87ff3.patch"; + sha256 = "Xxzf5miWy4S34sbQq8VQdAbY/oqGyhL/AJxiEPRuj3Q="; + }) + ]; + configureFlags = [ "--enable-jtag_vpi" "--enable-usb_blaster_libftdi"