rtomayko / posix-spawn

Ruby process spawning library
Other
520 stars 52 forks source link

posix-spawn-0.3.8 fails to build with Alpine Linux and musl libc #54

Closed ncopa closed 10 years ago

ncopa commented 10 years ago
Building native extensions.  This could take a while...
/usr/bin/ruby extconf.rb
creating Makefile
make "DESTDIR="
compiling posix-spawn.c
In file included from /usr/include/ruby-2.0.0/ruby/ruby.h:24:0,
                 from /usr/include/ruby-2.0.0/ruby.h:33,
                 from posix-spawn.c:14:
/usr/include/ruby-2.0.0/x86_64-linux-musl/ruby/config.h:17:0: warning: "_GNU_SOURCE" redefined [enabled by default]
 #define _GNU_SOURCE 1
 ^
posix-spawn.c:3:0: note: this is the location of the previous definition
 #define _GNU_SOURCE
 ^
posix-spawn.c: In function 'rb_posixspawn_pspawn':
posix-spawn.c:403:11: error: 'POSIX_SPAWN_USEVFORK' undeclared (first use in this function)
  flags |= POSIX_SPAWN_USEVFORK;
           ^
posix-spawn.c:403:11: note: each undeclared identifier is reported only once for each function it appears in
Makefile:223: recipe for target 'posix-spawn.o' failed
make: *** [posix-spawn.o] Error 1
ERROR:  Error installing /home/ncopa/aports/wip/ruby-posix-spawn/src/posix-spawn-0.3.8.gem:
    ERROR: Failed to build gem native extension.

    Building has failed. See above output for more information on the failure.

btw, why are the no git tag for 0.3.8 in https://github.com/rtomayko/posix-spawn/releases ?

hamletmun commented 10 years ago

It seems that musl doesn't like vfork: http://git.musl-libc.org/cgit/musl/commit/?id=fb6b159d9ec7cf1e037daa974eeeacf3c8b3b3f1

ncopa commented 10 years ago

Commit 9b7c7c0 broke it. POSIX_SPAWN_USEVFORK shouldn't really be used if its not defined. You could check for __GLIBC__ instead of making wrong assumptions with __linux__.