From 613daca044ce0bf2685bbf8350376e24a9f6ca18 Mon Sep 17 00:00:00 2001 From: Adam Daniels Date: Sat, 5 Jan 2019 21:35:19 +0000 Subject: [PATCH] Define SKIP_GNU token when building extension Openwall's crypt_blowfish library supports patching libc implementations. Part of this includes function definitions for `crypt` and `crypt_r`. Unfortunately, the function definition for `crypt_r` differs on FreeBSD >= 12 (and possibly others), which causes the extension to fail in building. This is due to the nature of how the extension works, where a C->Ruby extension is used, instead of just using a FFI such as Fiddle directly against `crypt_blowfish` and `crypt_gensalt`. The C->Ruby extension includes `ruby.h`, which in turn has a requirement on `unistd.h`, where the `crypt_r` function has already been defined, albeit with the different function signature. Defining the __SKIP_GNU token causes the `ow-crypt.h` header not to attempt defining(redefining) these two function definitions that may conflict with libc. We're not using either of them (only the re-entrant versions) so no harm done by skipping their definitions. --- ext/mri/extconf.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/ext/mri/extconf.rb b/ext/mri/extconf.rb index f2438b3..c2222de 100644 --- a/ext/mri/extconf.rb +++ b/ext/mri/extconf.rb @@ -16,6 +16,7 @@ # This is `bcrypt_ext` (our extension) + CRYPT_OBJS from that Makefile. $objs = %w(bcrypt_ext.o crypt_blowfish.o x86.o crypt_gensalt.o wrapper.o) + $defs << "-D__SKIP_GNU" dir_config("bcrypt_ext") create_makefile("bcrypt_ext") end