rtomayko / posix-spawn

Ruby process spawning library
Other
520 stars 52 forks source link

Unable to install on Termux #91

Open khemarato opened 6 months ago

khemarato commented 6 months ago

Running gem install posix-spawn on Termux currently gives me:

ERROR:  Error installing posix-spawn:
        ERROR: Failed to build gem native extension.

    current directory: /data/data/com.termux/files/usr/lib/ruby/gems/3.2.0/gems/posix-spawn-0.3.15/ext
/data/data/com.termux/files/usr/bin/ruby extconf.rb
creating Makefile

current directory: /data/data/com.termux/files/usr/lib/ruby/gems/3.2.0/gems/posix-spawn-0.3.15/ext
make DESTDIR\= sitearchdir\=./.gem.20240307-28064-kq11bf sitelibdir\=./.gem.20240307-28064-kq11bf clean

current directory: /data/data/com.termux/files/usr/lib/ruby/gems/3.2.0/gems/posix-spawn-0.3.15/ext
make DESTDIR\= sitearchdir\=./.gem.20240307-28064-kq11bf sitelibdir\=./.gem.20240307-28064-kq11bf
compiling posix-spawn.c
posix-spawn.c:226:27: error: incompatible function pointer types passing 'int (VALUE, VALUE, posix_spawn_file_actions_t *)' (aka 'int (unsigned long, unsigned long, struct __posix_spawn_file_actions **)') to parameter of type 'int (*)(VALUE, VALUE, VALUE)' (aka 'int (*)(unsigned long, unsigned long, unsigned long)') [-Wincompatible-function-pointer-types]
  226 |         rb_hash_foreach(options, posixspawn_file_actions_operations_iter, (VALUE)fops);
      |                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/data/data/com.termux/files/usr/include/ruby-3.2.0/ruby/internal/intern/hash.h:83:40: note: passing argument to parameter 'func' here
   83 | void rb_hash_foreach(VALUE hash, int (*func)(VALUE key, VALUE val, VALUE arg), VALUE arg);
      |                                        ^
1 error generated.
make: *** [Makefile:248: posix-spawn.o] Error 1

make failed, exit code 2

Gem files will remain installed in /data/data/com.termux/files/usr/lib/ruby/gems/3.2.0/gems/posix-spawn-0.3.15 for inspection.
Results logged to /data/data/com.termux/files/usr/lib/ruby/gems/3.2.0/extensions/aarch64-linux-android/3.2.0/posix-spawn-0.3.15/gem_make.out
feolea commented 6 months ago

Same here in a Mac OS Sonoma M1 (but trying to build as x86_64 with ruby 3.2.3 in rvm)

prabhanshu commented 6 months ago

Facing same issue on Mac OS Sonoma M2 @feolea how are you building as x86_64?

taketo1113 commented 6 months ago

I success to install with below config in macOS Sonoma 14.3.1 (M1).

$ bundle config build.posix-spawn --with-cflags="-Wno-incompatible-function-pointer-types"
feolea commented 6 months ago

Facing same issue on Mac OS Sonoma M2 @feolea how are you building as x86_64?

Using Rosetta @prabhanshu

feolea commented 6 months ago

Thank you so much @taketo1113 I was able to follow your idea and in my setup was able to install it using: (Sonoma 14.4 M1 RVM)

gem install posix-spawn -v 0.3.15 -- --with-cflags=\"-Wno-incompatible-function-pointer-types\"