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

socat: fix darwin build #60257

Merged
merged 1 commit into from Apr 27, 2019
Merged

socat: fix darwin build #60257

merged 1 commit into from Apr 27, 2019

Conversation

thefloweringash
Copy link
Member

Motivation for this change

Make it build on Darwin. I'll try to upstream it too.

xio-termios.c:359:5: error: conflicting types for 'xiotermios_speed'
int xiotermios_speed(int fd, int n, speed_t speed) {
    ^
./xio-termios.h:151:12: note: previous declaration is here
extern int xiotermios_speed(int fd, int n, unsigned int speed);
           ^
1 error generated.
make: *** [<builtin>: xio-termios.o] Error 1

https://hydra.nixos.org/build/92405399/nixlog/3/tail

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 nix-review --run "nix-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.

@7c6f434c
Copy link
Member

@GrahamcOfBorg build socat
@thefloweringash Shouldn't this be a Darwin-only patch, though?

@thefloweringash
Copy link
Member Author

It's a patch that's likely correct on all platforms, but only necessary on Darwin. I've set it to be Darwin-only, but don't know the idiom here.

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

patches = stdenv.lib.optional stdenv.isDarwin ./speed-type-fix.patch;
Copy link
Member

Choose a reason for hiding this comment

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

stdenv.cc.isClang would be a more correct, but I would personally conditionalize a patches like this one.

Copy link
Member Author

Choose a reason for hiding this comment

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

In this case isDarwin is more accurate. The difference is in termios.h, in glibc it's typedef unsigned int speed_t;, so on Linux the types happen to be identical. On Darwin it's typedef unsigned long speed_t; which causes the error.

@7c6f434c 7c6f434c merged commit d7d8743 into NixOS:master Apr 27, 2019
@thefloweringash thefloweringash deleted the socat-darwin branch May 1, 2019 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants