about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJörg Thalheim <Mic92@users.noreply.github.com>2019-03-29 13:54:37 +0000
committerGitHub <noreply@github.com>2019-03-29 13:54:37 +0000
commit382333b25e0d6fbac746d91224ed6b805b6407a0 (patch)
tree8710d2adbe29738dc5a90de63df711a1d10678f6
parentb9038204d6f54d6608a8a7d4242c104069d748d4 (diff)
parentbce7e3b5853595b1306f76a54f7e201c51c7dbeb (diff)
downloadnixlib-382333b25e0d6fbac746d91224ed6b805b6407a0.tar
nixlib-382333b25e0d6fbac746d91224ed6b805b6407a0.tar.gz
nixlib-382333b25e0d6fbac746d91224ed6b805b6407a0.tar.bz2
nixlib-382333b25e0d6fbac746d91224ed6b805b6407a0.tar.lz
nixlib-382333b25e0d6fbac746d91224ed6b805b6407a0.tar.xz
nixlib-382333b25e0d6fbac746d91224ed6b805b6407a0.tar.zst
nixlib-382333b25e0d6fbac746d91224ed6b805b6407a0.zip
Merge pull request #57824 from illegalprime/fix/libmodbus-cross
libmodbus: fix for cross compilation
-rw-r--r--pkgs/development/libraries/libmodbus/default.nix10
1 files changed, 10 insertions, 0 deletions
diff --git a/pkgs/development/libraries/libmodbus/default.nix b/pkgs/development/libraries/libmodbus/default.nix
index 10bd7af7fadd..d1ee30698a09 100644
--- a/pkgs/development/libraries/libmodbus/default.nix
+++ b/pkgs/development/libraries/libmodbus/default.nix
@@ -8,6 +8,16 @@ stdenv.mkDerivation rec {
     sha256 = "0drnil8bzd4n4qb0wv3ilm9zvypxvwmzd65w96d6kfm7x6q65j68";
   };
 
+  configureFlags = [
+    # when cross-compiling we assume that the host system will return a valid
+    # pointer for calls to malloc(0) or realloc(0)
+    # https://www.uclibc.org/FAQ.html#gnu_malloc
+    # https://www.gnu.org/software/autoconf/manual/autoconf.html#index-AC_005fFUNC_005fMALLOC-454
+    # the upstream source should be patched to avoid needing this
+    "ac_cv_func_malloc_0_nonnull=yes"
+    "ac_cv_func_realloc_0_nonnull=yes"
+  ];
+
   meta = with stdenv.lib; {
     description = "Library to send/receive data according to the Modbus protocol";
     homepage = http://libmodbus.org/;