nginx / unit

NGINX Unit - universal web app server - a lightweight and versatile open source server that simplifies the application stack by natively executing application code across eight different programming language runtimes.
https://unit.nginx.org
Apache License 2.0
5.29k stars 325 forks source link

auto/modules/ruby: line 181: build/include/nxt_/BINARYPATH/ruby_mounts.h: No such file or directory #947

Closed d3cline closed 10 months ago

d3cline commented 10 months ago

I ran into an error after building ruby from source for CentOS7,

Ruby build,

wget https://cache.ruby-lang.org/pub/ruby/3.0/ruby-3.0.3.tar.gz
./configure --prefix=$HOME --with-soname=ruby_303 --enable-shared --libdir=$HOME/lib --includedir=$HOME/include
make
make install

Bug,

[me@server unit]$ ./configure ruby  --ruby=$HOME/bin/ruby 
configuring Ruby module
checking for Ruby library ... not found
checking for Ruby library in /home/me/lib ... found
checking for Ruby version ... 3.0.3
auto/modules/ruby: line 181: build/include/nxt_/home/me/bin/ruby_mounts.h: No such file or directory

Fix is to make the dir and manually copy the code from the module file,

[me@server unit]$ mkdir build/include/nxt_/home
mkdir: cannot create directory ‘build/include/nxt_/home’: No such file or directory
[me@server unit]$ mkdir build/include/nxt_
[me@server unit]$ mkdir build/include/nxt_/home
[me@server unit]$ mkdir build/include/nxt_/home/me
[me@server unit]$ mkdir build/include/nxt_/home/me/bin
[me@server unit]$ vim build/include/nxt_/home/me/bin/ruby_mounts.h
[me@server unit]$ ./configure ruby  --ruby=$HOME/bin/ruby 
configuring Ruby module
checking for Ruby library ... not found
checking for Ruby library in /home/me/lib ... found
checking for Ruby version ... 3.0.3
 + Ruby module: /home/me/bin/ruby.unit.so

The header file,

        #include <ruby.h>

        int main(void) {
            static const char *argv[3] = {
                \"NGINX_Unit\", \"-rrbconfig\",
                \"-eprint RbConfig::CONFIG['libdir']\"
            };

            RUBY_INIT_STACK;
            ruby_init();
            return ruby_run_node(ruby_options(3, (char **) argv));
        }

Why and can this be fixed so the file does not need manual population?

d3cline commented 10 months ago

P.S. It doesn't actually build, and renders more errors

Fatal error: can't create build/src/ruby/nxt_ruby-/home/USER/bin/ruby.o: No such file or directory
make: *** [build/src/ruby/nxt_ruby-/home/USER/bin/ruby.o] Error 2

the .o file does exist /home/USER/unit/ruby-3.0.3/ruby.o

d3cline commented 10 months ago

PPS creating the dirs that it kept failing with there were about 3 got it to build the ruby.unit.so file so it can be done, its just a bit of path magic

d3cline commented 10 months ago

I found a tailing slash that might have been the cause, if this error pops up check any export commands