summary refs log tree commit diff
path: root/pkgs/development/libraries/libmodbus
diff options
context:
space:
mode:
authorMichael Eden <themichaeleden@gmail.com>2019-03-16 11:53:14 -0400
committerMichael Eden <themichaeleden@gmail.com>2019-03-25 15:16:43 -0400
commitbce7e3b5853595b1306f76a54f7e201c51c7dbeb (patch)
treeb595b95f3c571df9b348fcd35daba49919168e19 /pkgs/development/libraries/libmodbus
parent33e9fa2367c973d91bd729adce12634cc010dc8c (diff)
downloadnixpkgs-bce7e3b5853595b1306f76a54f7e201c51c7dbeb.tar
nixpkgs-bce7e3b5853595b1306f76a54f7e201c51c7dbeb.tar.gz
nixpkgs-bce7e3b5853595b1306f76a54f7e201c51c7dbeb.tar.bz2
nixpkgs-bce7e3b5853595b1306f76a54f7e201c51c7dbeb.tar.lz
nixpkgs-bce7e3b5853595b1306f76a54f7e201c51c7dbeb.tar.xz
nixpkgs-bce7e3b5853595b1306f76a54f7e201c51c7dbeb.tar.zst
nixpkgs-bce7e3b5853595b1306f76a54f7e201c51c7dbeb.zip
libmodbus: fix for cross compilation
Diffstat (limited to 'pkgs/development/libraries/libmodbus')
-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 10bd7af7fad..d1ee30698a0 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/;