Unable to compile lsapi-4.1

cevo

Active Member
#1
I am on Litespeed WebServer vertsion 5.0RC2
on Ubuntu 14.04
Ruby: 2.2.0p0
Rails: 4.2.0
Gem: 2.4.5
My GCC info
$gcc -v

Using built-in specs.

COLLECT_GCC=gcc

COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.8/lto-wrapper

Target: x86_64-linux-gnu

Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.8.2-19ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.8 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libmudflap --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu

Thread model: posix

gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1)

I would like to compile ruby-lsapi as mentioned in this tutorial https://www.litespeedtech.com/suppo...wiki:other-ext-apps:ruby-on-rails-easy-config

I got following issues


Code:
$ ruby setup.rb config
setup.rb:286: warning: duplicated key at line 287 ignored: "bin-dir"
setup.rb:791:in `load_rbconfig': uninitialized constant Config (NameError)
from setup.rb:771:in `invoke'
from setup.rb:1581:in `<main>'
then I managed to fix this bug by add this line at the beginning of setup.rb


Code:
require'rbconfig'
Config = RbConfig
Then every thing went fine, then I proceeds to next step

Code:
$ruby setup.rb setup

setup.rb:286: warning: duplicated key at line 287 ignored: "bin-dir"

---> ext

---> ext/lsapi

make

compiling lsruby.c

In file included from lsruby.c:7:0:

/usr/local/rvm/rubies/ruby-2.2.0/include/ruby-2.2.0/ruby/backward/util.h:2:2: warning: #warning use "ruby/util.h" instead of bare "util.h" [-Wcpp]

#warning use "ruby/util.h" instead of bare "util.h"

  ^

lsruby.c: In function ‘lsapi_process’:

lsruby.c:242:18: warning: variable ‘pScriptPath’ set but not used [-Wunused-but-set-variable]

    const char * pScriptPath;

                  ^

lsruby.c: In function ‘lsapi_puts_ary’:

lsruby.c:353:9: warning: implicit declaration of function ‘rb_inspecting_p’ [-Wimplicit-function-declaration]

        if (rb_inspecting_p(tmp))

        ^

lsruby.c: In function ‘lsapi_puts’:

lsruby.c:385:17: warning: implicit declaration of function ‘rb_protect_inspect’ [-Wimplicit-function-declaration]

                rb_protect_inspect(lsapi_puts_ary, argv, out);

                ^

lsruby.c: In function ‘Init_lsapi’:

lsruby.c:789:32: error: ‘rb_thread_select’ undeclared (first use in this function)

    LSAPI_Init_Env_Parameters( rb_thread_select );

                                ^

lsruby.c:789:32: note: each undeclared identifier is reported only once for each function it appears in

lsruby.c:780:11: warning: unused variable ‘remove_env’ [-Wunused-variable]

    VALUE remove_env;

          ^

lsruby.c: In function ‘createBodyBuf’:

lsruby.c:484:26: warning: ignoring return value of ‘ftruncate’, declared with attribute warn_unused_result [-Wunused-result]

                ftruncate(fd, s_body.bodyLen);

                          ^

make: *** [lsruby.o] Error 1

setup.rb:658:in `command': system("make") failed (RuntimeError)

from setup.rb:667:in `make'

from setup.rb:1261:in `setup_dir_ext'

from setup.rb:1535:in `block in traverse'

from setup.rb:1552:in `dive_into'

from setup.rb:1533:in `traverse'

from setup.rb:1537:in `block (2 levels) in traverse'

from setup.rb:1536:in `each'

from setup.rb:1536:in `block in traverse'

from setup.rb:1552:in `dive_into'

from setup.rb:1533:in `traverse'

from setup.rb:1527:in `block in exec_task_traverse'

from setup.rb:1522:in `each'

from setup.rb:1522:in `exec_task_traverse'

from setup.rb:1249:in `exec_setup'

from setup.rb:999:in `exec_setup'

from setup.rb:829:in `invoke'

from setup.rb:776:in `invoke'

from setup.rb:1581:in `<main>'


Then I try another installation method
Code:
$ gem install ruby-lsapi

Building native extensions.  This could take a while...

ERROR:  Error installing ruby-lsapi:

ERROR: Failed to build gem native extension.


    /usr/local/rvm/rubies/ruby-2.2.0/bin/ruby -r ./siteconf20150101-25425-1flpg8v.rb extconf.rb

checking for main() in -lsocket... no

creating Makefile


make "DESTDIR=" clean


make "DESTDIR="

compiling lsruby.c

In file included from lsruby.c:7:0:

/usr/local/rvm/rubies/ruby-2.2.0/include/ruby-2.2.0/ruby/backward/util.h:2:2: warning: #warning use "ruby/util.h" instead of bare "util.h" [-Wcpp]

#warning use "ruby/util.h" instead of bare "util.h"

  ^

lsruby.c: In function ‘lsapi_process’:

lsruby.c:228:18: warning: variable ‘pScriptPath’ set but not used [-Wunused-but-set-variable]

    const char * pScriptPath;

                  ^

lsruby.c: In function ‘lsapi_puts_ary’:

lsruby.c:339:6: warning: implicit declaration of function ‘rb_inspecting_p’ [-Wimplicit-function-declaration]

      if (rb_inspecting_p(tmp))

      ^

lsruby.c: In function ‘lsapi_puts’:

lsruby.c:371:13: warning: implicit declaration of function ‘rb_protect_inspect’ [-Wimplicit-function-declaration]

            rb_protect_inspect(lsapi_puts_ary, argv[i], out);

            ^

lsruby.c: In function ‘Init_lsapi’:

lsruby.c:564:32: error: ‘rb_thread_select’ undeclared (first use in this function)

    LSAPI_Init_Env_Parameters( rb_thread_select );

                                ^

lsruby.c:564:32: note: each undeclared identifier is reported only once for each function it appears in

lsruby.c:634:26: warning: assignment from incompatible pointer type [enabled by default]

    s_req_data->fn_write = LSAPI_Write_r;

                          ^

lsruby.c:644:29: warning: assignment from incompatible pointer type [enabled by default]

    s_stderr_data->fn_write = LSAPI_Write_Stderr_r;

                            ^

lsruby.c:558:11: warning: unused variable ‘remove_env’ [-Wunused-variable]

    VALUE remove_env;

          ^

make: *** [lsruby.o] Error 1


make failed, exit code 2


Gem files will remain installed in /usr/local/rvm/gems/ruby-2.2.0/gems/ruby-lsapi-4.1 for inspection.

Results logged to /usr/local/rvm/gems/ruby-2.2.0/extensions/x86_64-linux/2.2.0/ruby-lsapi-4.1/gem_make.out

But still got the error, Anyone know how to fix?
Code:
lsruby.c:564:32: error: ‘rb_thread_select’ undeclared (first use in this function)

    LSAPI_Init_Env_Parameters( rb_thread_select );
 
Last edited:

cevo

Active Member
#2
after did some research seems like 'rb_thread_select' is obsolete, so I have changed the code of
lsruby.c from

Code:
LSAPI_Init_Env_Parameters( rb_thread_select );
to
Code:
LSAPI_Init_Env_Parameters( rb_thread_fd_select );
but now got another compilation error
Code:
# make

compiling lsruby.c

In file included from lsruby.c:7:0:

/usr/local/rvm/rubies/ruby-2.2.0/include/ruby-2.2.0/ruby/backward/util.h:2:2: warning: #warning use "ruby/util.h" instead of bare "util.h" [-Wcpp]

#warning use "ruby/util.h" instead of bare "util.h"

  ^

lsruby.c: In function ‘lsapi_process’:

lsruby.c:228:18: warning: variable ‘pScriptPath’ set but not used [-Wunused-but-set-variable]

    const char * pScriptPath;

                  ^

lsruby.c: In function ‘lsapi_puts_ary’:

lsruby.c:339:6: warning: implicit declaration of function ‘rb_inspecting_p’ [-Wimplicit-function-declaration]

      if (rb_inspecting_p(tmp))

      ^

lsruby.c: In function ‘lsapi_puts’:

lsruby.c:371:13: warning: implicit declaration of function ‘rb_protect_inspect’ [-Wimplicit-function-declaration]

            rb_protect_inspect(lsapi_puts_ary, argv[i], out);

            ^

lsruby.c: In function ‘Init_lsapi’:

lsruby.c:564:5: warning: passing argument 1 of ‘LSAPI_Init_Env_Parameters’ from incompatible pointer type [enabled by default]

    LSAPI_Init_Env_Parameters( rb_thread_fd_select );

    ^

In file included from lsruby.c:10:0:

lsapilib.h:359:5: note: expected ‘fn_select_t’ but argument is of type ‘int (*)(int,  struct rb_fdset_t *, struct rb_fdset_t *, struct rb_fdset_t *, struct timeval *)’

int LSAPI_Init_Env_Parameters( fn_select_t fp );

    ^

lsruby.c:634:26: warning: assignment from incompatible pointer type [enabled by default]

    s_req_data->fn_write = LSAPI_Write_r;

                          ^

lsruby.c:644:29: warning: assignment from incompatible pointer type [enabled by default]

    s_stderr_data->fn_write = LSAPI_Write_Stderr_r;

                            ^

lsruby.c:558:11: warning: unused variable ‘remove_env’ [-Wunused-variable]

    VALUE remove_env;

          ^

In file included from /usr/local/rvm/rubies/ruby-2.2.0/include/ruby-2.2.0/ruby.h:33:0,

                from lsruby.c:2:

lsruby.c: In function ‘lsapi_eval_string_wrap’:

/usr/local/rvm/rubies/ruby-2.2.0/include/ruby-2.2.0/ruby/ruby.h:551:44: error: call to ‘rb_check_safe_str’ declared with attribute error: rb_check_safe_str() and Check_SafeStr() are obsolete; use SafeStringValue() instead

# define Check_SafeStr(v) rb_check_safe_str((VALUE)(v))

                                            ^

lsruby.c:220:9: note: in expansion of macro ‘Check_SafeStr’

        Check_SafeStr(str);

        ^

make: *** [lsruby.o] Error 1
Seems like Ruby LSAPI is not compatible with latest ruby version. Anyone know which version Ruby currently support?
 
Top