rtomayko / posix-spawn

Ruby process spawning library
Other
519 stars 52 forks source link

Get an error when compiling posix-spawn 0.3.13 #84

Closed yrzr closed 4 years ago

yrzr commented 7 years ago
# ruby -Cext extconf.rb
creating Makefile
# cd ext && make
compiling posix-spawn.c                                                                                  
posix-spawn.c: In function ‘posixspawn_obj_to_fd’:
posix-spawn.c:64:14: warning: implicit declaration of function ‘rb_fix2int’ [-Wimplicit-function-declaration]                                                                                                     
    fd = (int)rb_fix2int(obj);                                                                           
              ^
linking shared-object posix_spawn_ext.so                                                                 
posix-spawn.o: In function `posixspawn_obj_to_fd':                                                       
posix-spawn.c:(.text+0x1c4): undefined reference to `rb_fix2int'                                         
collect2: error: ld returned 1 exit status                                                               
make: *** [Makefile:256: posix_spawn_ext.so] Error 1

My ruby version

# ruby -v
ruby 2.3.5p376 (2017-09-14 revision 59905) [armv7a-linux-eabi]

Any ideas about what is going wrong?

yrzr commented 7 years ago

@charliesome

I have noticed that related code "rb_fix2int" is merged from you.

As I don't understand ruby language, limited effects could be done. Could you please help on this issue? Thank you!

yrzr commented 7 years ago

I found out that by making "rb_fix2int" to uppercase, which is "RB_FIX2INT", will fix the problem in armv7. However, it will crash in amd64.

Any ideas?

limansky commented 6 years ago

Faced with a same issue on x86.

limansky commented 6 years ago

It looks like function is missing in libruby32:

 $ nm -D /usr/lib/libruby23.so | grep fix2
000ada63 T rb_fix2short
000ae043 T rb_fix2str
000adabd T rb_fix2ushort

I'm using ruby 2.3.5 on Gentoo Linux.

Carelvd commented 6 years ago

@yrzr It seems from issue #78 that one may simply use the uppercase version of this function for x86 code. I'm do not know enough ruby to advocate how or why this is better, different or worse to the lowercase version. I'd be interested to know though.

@limansky I'm also on an x86 Gentoo, I tried to patch the the 0.3.13 E-Build by replacing rb_fix2int with RB_FIX2INT, but I get the error that RB_FIX2INT is then not defined. In this issue #78 they say they are able to get away with installing version 0.3.12. While somewhat unrelated to posix spawn, If your use case is like mine and you're installing GitlabHQ, run "emerge =dev-lang/ruby/posix-spawn-0.3.12" first the emerge gitlabhq-10.0.6 (Actually bundler pulled in 0.3.13 and failed the build phase)

@limansky Based on your comment this is missing in libruby32, should one of us not file a bug for either the ruby package or the posix-spawn one ?

P.s. I posted this message in the hopes that it'd be helpful and trust it doesn't feel like I hijacked the thread.

limansky commented 6 years ago

@Carelvd I don't use gitlab overlay, so I didn't install posix-spawn via emerge. I was able to install the latest version of gitlab from source with patched posix-spawn.

yrzr commented 6 years ago

@Carelvd actually, after some basic search on the ebuild file of gitlab overlay and the source code of gitlab-ce, I found that the posix-spawn is built and installed through RubyGems, as listed in the file "Gemfile.lock". So it doesn't matter whether you install posix-spawn by portage.

The thing is, you can patch gitlab overlay by modifying the version of posix-spawn in "Gemfile.lock" as a temporary solution, which works fine in my situation.

yrzr commented 6 years ago

Committed an issue in the gitlab overlay to see whether we could make a patch in the overlay first.

Carelvd commented 6 years ago

@yrzr Oh nice, I didn't know one could just edit the Gemfile so easily the .lock extension made me think one shouldn't, I have done very little in ruby to date so I'm not sure what I can just go ahead and clobber just yet. I made a patch for the issue you opened at Awesome-IT and listed my actions to be able to install Gitlabhq on an x86 machine should it be helpful to some one else.

The original reason I tried emerging posix-spawn directly was that I've seen during the installation of an E-Build the gems emerge/bundle pull in are sometimes marked Using rather then Fetching and Installing and that the system gem is installed in this case..

@limansky Cool, I may ask for a copy of that if the fix proposed by @yrzr doesn't work. If I follow properly from what I have done and from what you say one must supply a RB_FIX2INT method within the source code of POSIX to get this working. FYI I've put in merge requests for including gitlab-runner and gitlab-pages in the gitlab overlay.

tmm1 commented 4 years ago

v0.3.14 has been released with a fix.