rtomayko / posix-spawn

Ruby process spawning library
Other
519 stars 52 forks source link

Does not compile on OpenBSD #24

Closed worr closed 9 years ago

worr commented 12 years ago

Probably caused by the lack of spawn.h in OpenBSD

[ will on charmeleon ] ( blog ) % gem install jekyll
Building native extensions.  This could take a while...
ERROR:  Error installing jekyll:
        ERROR: Failed to build gem native extension.

        /home/will/.rvm/rubies/ruby-1.9.3-preview1/bin/ruby extconf.rb
creating Makefile

make
compiling posix-spawn.c
posix-spawn.c:9:19: error: spawn.h: No such file or directory
In file included from /home/will/.rvm/rubies/ruby-1.9.3-preview1/include/ruby-1.9.1/ruby/ruby.h:24,
                 from /home/will/.rvm/rubies/ruby-1.9.3-preview1/include/ruby-1.9.1/ruby.h:32,
                 from posix-spawn.c:14:
/home/will/.rvm/rubies/ruby-1.9.3-preview1/include/ruby-1.9.1/i386-openbsd5.0/ruby/config.h:17:1: warning: "_GNU_SOURCE" redefined
posix-spawn.c:3:1: warning: this is the location of the previous definition
posix-spawn.c:103: error: expected declaration specifiers or '...' before 'posix_spawn_file_actions_t'
posix-spawn.c: In function 'posixspawn_file_actions_addclose':
posix-spawn.c:113: warning: implicit declaration of function 'posix_spawn_file_actions_addclose'
posix-spawn.c:113: error: 'fops' undeclared (first use in this function)
posix-spawn.c:113: error: (Each undeclared identifier is reported only once
posix-spawn.c:113: error: for each function it appears in.)
posix-spawn.c: At top level:
posix-spawn.c:129: error: expected declaration specifiers or '...' before 'posix_spawn_file_actions_t'
posix-spawn.c: In function 'posixspawn_file_actions_adddup2':
posix-spawn.c:141: warning: implicit declaration of function 'posix_spawn_file_actions_adddup2'
posix-spawn.c:141: error: 'fops' undeclared (first use in this function)
posix-spawn.c: At top level:
posix-spawn.c:155: error: expected declaration specifiers or '...' before 'posix_spawn_file_actions_t'
posix-spawn.c: In function 'posixspawn_file_actions_addopen':
posix-spawn.c:173: warning: implicit declaration of function 'posix_spawn_file_actions_addopen'
posix-spawn.c:173: error: 'fops' undeclared (first use in this function)
posix-spawn.c: At top level:
posix-spawn.c:186: error: expected declaration specifiers or '...' before 'posix_spawn_file_actions_t'
posix-spawn.c: In function 'posixspawn_file_actions_operations_iter':
posix-spawn.c:190: error: 'fops' undeclared (first use in this function)
posix-spawn.c:190: error: too many arguments to function 'posixspawn_file_actions_addclose'
posix-spawn.c:193: error: too many arguments to function 'posixspawn_file_actions_adddup2'
posix-spawn.c:196: error: too many arguments to function 'posixspawn_file_actions_addopen'
posix-spawn.c: At top level:
posix-spawn.c:210: error: expected ')' before '*' token
posix-spawn.c:230: error: expected declaration specifiers or '...' before 'posix_spawnattr_t'
posix-spawn.c: In function 'posixspawn_set_pgroup':
posix-spawn.c:237: error: 'POSIX_SPAWN_SETPGROUP' undeclared (first use in this function)
posix-spawn.c:238: warning: implicit declaration of function 'posix_spawnattr_setpgroup'
posix-spawn.c:238: error: 'pattr' undeclared (first use in this function)
posix-spawn.c: In function 'each_env_check_i':
posix-spawn.c:253: warning: unused parameter 'arg'
posix-spawn.c: In function 'rb_posixspawn_pspawn':
posix-spawn.c:330: error: 'posix_spawn_file_actions_t' undeclared (first use in this function)
posix-spawn.c:330: error: expected ';' before 'fops'
posix-spawn.c:331: error: 'posix_spawnattr_t' undeclared (first use in this function)
posix-spawn.c:331: error: expected ';' before 'attr'
posix-spawn.c:332: warning: ISO C90 forbids mixed declarations and code
posix-spawn.c:341: warning: ISO C90 forbids mixed declarations and code
posix-spawn.c:381: warning: ISO C90 forbids mixed declarations and code
posix-spawn.c:391: warning: implicit declaration of function 'posixspawn_file_actions_init'
posix-spawn.c:391: error: 'fops' undeclared (first use in this function)
posix-spawn.c:392: warning: implicit declaration of function 'posix_spawnattr_init'
posix-spawn.c:392: error: 'attr' undeclared (first use in this function)
posix-spawn.c:395: error: 'POSIX_SPAWN_SETSIGMASK' undeclared (first use in this function)
posix-spawn.c:397: warning: implicit declaration of function 'posix_spawnattr_setsigmask'
posix-spawn.c:407: error: too many arguments to function 'posixspawn_set_pgroup'
posix-spawn.c:409: warning: implicit declaration of function 'posix_spawnattr_setflags'
posix-spawn.c:418: warning: implicit declaration of function 'posix_spawnp'
posix-spawn.c:427: warning: implicit declaration of function 'posix_spawn_file_actions_destroy'
posix-spawn.c:428: warning: implicit declaration of function 'posix_spawnattr_destroy'
posix-spawn.c:320: warning: unused parameter 'self'
*** Error code 1

Stop in /home/will/.rvm/gems/ruby-1.9.3-preview1/gems/posix-spawn-0.3.6/ext (line 92 of /usr/share/mk/sys.mk).

Gem files will remain installed in /home/will/.rvm/gems/ruby-1.9.3-preview1/gems/posix-spawn-0.3.6 for inspection.
Results logged to /home/will/.rvm/gems/ruby-1.9.3-preview1/gems/posix-spawn-0.3.6/ext/gem_make.out
ajiwo commented 12 years ago

I also have this issue, but finally get it working. from posix_spawn.h then run patch -N < posix_spawn.diff i got this spawn.h copy this file to $rvm_path/usr/include

rtomayko commented 9 years ago

Would love to verify posix-spawn is currently compiling + working on OpenBSD so leaving this old issue open for a bit. If you have recent experience w/ OpenBSD please leave a note here.

dsp-eoss commented 9 years ago

Hi,

I've successfully installed posix-spawn on OpenBSD 5.6 amd64, running in a Vagrant/VMware Fusion VM (base box: fnichol/openbsd-5.6-amd64), without fiddling with anything. Details follow:

# uname -a 
OpenBSD puffy.localdomain 5.6 GENERIC.MP#333 amd64

Tested with the following rubies:

ftp://ftp.openbsd.org//pub/OpenBSD/5.6/packages/amd64/ruby-1.9.3.545p0.tgz ftp://ftp.openbsd.org//pub/OpenBSD/5.6/packages/amd64/ruby-2.0.0.481.tgz ftp://ftp.openbsd.org//pub/OpenBSD/5.6/packages/amd64/ruby-2.1.2.tgz

(IOW, I haven't tried with ports- the VM doesn't have ports installed- so they're all older versions).

For both 1.9.3 and 2.1, I get this output:

Fetching: posix-spawn-0.3.11.gem (100%)
Building native extensions.  This could take a while...
Successfully installed posix-spawn-0.3.11
1 gem installed
Installing ri documentation for posix-spawn-0.3.11...
Installing RDoc documentation for posix-spawn-0.3.11...
# echo $?
0

For 2.0, I get this:

# gem20 install posix-spawn                                                                                                                                         
Fetching: posix-spawn-0.3.11.gem (100%)
Building native extensions.  This could take a while...
Successfully installed posix-spawn-0.3.11
Parsing documentation for posix-spawn-0.3.11
unable to convert "\xD8" from ASCII-8BIT to UTF-8 for lib/posix_spawn_ext.so, skipping
Installing ri documentation for posix-spawn-0.3.11
1 gem installed
# echo $?
0

Playing around in IRB, posix-spawn seems to be working just fine.

HTH :-)

rtomayko commented 9 years ago

Works for me. Thanks so much @dsp-eoss!

vtamara commented 9 years ago

According to https://github.com/tmm1/pygments.rb/issues/45 and my experience, it doesn't work in OpenBSD 5.6 but it works in 5.7.