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

libmodbus: fix for cross compilation #57824

Merged
merged 1 commit into from Mar 29, 2019

Conversation

illegalprime
Copy link
Member

Motivation for this change

Currently:

$ nix build -f channel:nixpkgs-unstable pkgsCross.armv7l-hf-multiplatform.libmodbus

builder for '/nix/store/ps48zagkkjv1l58yy2hrvnxf5bxvf0rw-libmodbus-3.1.4-armv7l-unknown-linux-gnueabihf.drv' failed with exit code 2; last 10 log lines:
  Making all in tests
  make  all-am
    CC       bandwidth-server-one.o
    CCLD     bandwidth-server-one
  /nix/store/4dn67dzxlwmglqx9xx75sckrwqzw32cp-armv7l-unknown-linux-gnueabihf-binutils-2.31.1/bin/armv7l-unknown-linux-gnueabihf-ld: ../src/.libs/libmodbus.so: undefined reference to `rpl_malloc'
  collect2: error: ld returned 1 exit status
  make[3]: *** [Makefile:644: bandwidth-server-one] Error 1
  make[2]: *** [Makefile:580: all] Error 2
  make[1]: *** [Makefile:499: all-recursive] Error 1
  make: *** [Makefile:385: all] Error 2

this seems related: stephane/libmodbus#297

setting these variables fixing this error, even though it looks ugly.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@@ -8,6 +8,11 @@ stdenv.mkDerivation rec {
sha256 = "0drnil8bzd4n4qb0wv3ilm9zvypxvwmzd65w96d6kfm7x6q65j68";
};

preConfigure = ''
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should add a comment here

@@ -8,6 +8,11 @@ stdenv.mkDerivation rec {
sha256 = "0drnil8bzd4n4qb0wv3ilm9zvypxvwmzd65w96d6kfm7x6q65j68";
};

preConfigure = ''
export ac_cv_func_malloc_0_nonnull=yes
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same concern as #57825 (comment)

@veprbl veprbl added the 6.topic: cross-compilation Building packages on a different sort platform than than they will be run on label Mar 24, 2019
preConfigure = ''
export ac_cv_func_malloc_0_nonnull=yes
export ac_cv_func_realloc_0_nonnull=yes
'';
Copy link
Member

@Mic92 Mic92 Mar 24, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Usually it is enough to pass this to configureFlags like this:

configureFlags = [
  "ac_cv_func_realloc_0_nonnull=yes"
  "ac_cv_func_malloc_0_nonnull=yes"
];

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup, you were right!

@Mic92 Mic92 merged commit 382333b into NixOS:master Mar 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: cross-compilation Building packages on a different sort platform than than they will be run on 10.rebuild-darwin: 0 10.rebuild-linux: 1-10
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants