Can't compile ruby-lsapi on Centos 64bit

Discussion in 'Bug Reports' started by aemadrid, Nov 1, 2006.

  1. aemadrid

    aemadrid New Member

    Can't figure out how to compile ruby-lsapi on this server. Any ideas?

    LiteSpeed/2.2.4 Standard

    # uname -a
    Linux xyz.domain.com 2.6.9-42.0.3.ELsmp #1 SMP Fri Oct 6 06:28:26 CDT 2006 x86_64 x86_64 x86_64 GNU/Linux

    # cat /etc/redhat-release
    CentOS release 4.4 (Final)

    # rpm -qa|grep gcc
    libgcc-3.4.6-3
    libgcc-3.4.6-3
    compat-libgcc-296-2.96-132.7.2
    gcc-3.4.6-3

    # gem install ruby-lsapi
    Building native extensions. This could take a while...
    lsruby.c: In function `lsapi_ruby_setenv':
    lsruby.c:60: warning: implicit declaration of function `ruby_setenv'
    lsruby.c:62: warning: implicit declaration of function `ruby_unsetenv'
    lsruby.c: In function `lsapi_fork_child':
    lsruby.c:216: warning: implicit declaration of function `setsid'
    lsruby.c:242: warning: implicit declaration of function `usleep'
    lsruby.c:284: warning: implicit declaration of function `fork'
    lsruby.c:288: warning: implicit declaration of function `getppid'
    lsruby.c:306: warning: implicit declaration of function `close'
    lsruby.c:318: warning: implicit declaration of function `getpgrp'
    lsruby.c: In function `chdir_file':
    lsruby.c:401: warning: implicit declaration of function `chdir'
    lsruby.c: In function `lsapi_write':
    lsruby.c:448: warning: unused variable `data'
    lsruby.c: At top level:
    lsruby.c:32: warning: 'lsapi_objrefs' defined but not used
    lsruby.c:56: warning: 'lsapi_ruby_setenv' defined but not used
    lsruby.c:73: warning: 'lsapi_free_data' defined but not used
    lsruby.c:395: warning: 'chdir_file' defined but not used
    lsruby.c:671: warning: 'lsapi_isatty' defined but not used
    /usr/bin/ld: skipping incompatible /usr/lib/libruby.so when searching for -lruby
    /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../libruby.so when searching for -lruby
    /usr/bin/ld: skipping incompatible /usr/lib/libruby.so when searching for -lruby
    /usr/bin/ld: cannot find -lruby
    collect2: ld returned 1 exit status
    make: *** [lsapi.so] Error 1
    /usr/bin/ld: skipping incompatible /usr/lib/libruby.so when searching for -lruby
    /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../libruby.so when searching for -lruby
    /usr/bin/ld: skipping incompatible /usr/lib/libruby.so when searching for -lruby
    /usr/bin/ld: cannot find -lruby
    collect2: ld returned 1 exit status
    make: *** [lsapi.so] Error 1
    ruby extconf.rb install ruby-lsapi
    checking for main() in -lsocket... no
    creating Makefile

    make
    gcc -fPIC -O0 -g -pipe -m32 -march=i386 -mtune=pentium4 -Wall -fPIC -I. -I/usr/lib/ruby/1.8/i386-linux -I/usr/lib/ruby/1.8/i386-linux -I. -c lsruby.c
    gcc -fPIC -O0 -g -pipe -m32 -march=i386 -mtune=pentium4 -Wall -fPIC -I. -I/usr/lib/ruby/1.8/i386-linux -I/usr/lib/ruby/1.8/i386-linux -I. -c lsapilib.c
    gcc -shared -L"/usr/lib" -o lsapi.so lsruby.o lsapilib.o -lruby -ldl -lcrypt -lm -lc

    make install
    gcc -shared -L"/usr/lib" -o lsapi.so lsruby.o lsapilib.o -lruby -ldl -lcrypt -lm -lc

    make clean
    Successfully installed ruby-lsapi-1.11

    # cd /usr/lib/ruby/gems/1.8/gems/ruby-lsapi-1.11

    # ruby setup.rb
    ---> lib
    <--- lib
    ---> ext
    ---> ext/lsapi
    /usr/bin/ruby /usr/lib/ruby/gems/1.8/gems/ruby-lsapi-1.11/ext/lsapi/extconf.rb
    checking for main() in -lsocket... no
    creating Makefile
    <--- ext/lsapi
    <--- ext
    ---> lib
    <--- lib
    ---> ext
    ---> ext/lsapi
    make
    gcc -shared -L"/usr/lib" -o lsapi.so lsruby.o lsapilib.o -lruby -ldl -lcrypt -lm -lc
    /usr/bin/ld: skipping incompatible /usr/lib/libruby.so when searching for -lruby
    /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../libruby.so when searching for -lruby
    /usr/bin/ld: skipping incompatible /usr/lib/libruby.so when searching for -lruby
    /usr/bin/ld: cannot find -lruby
    collect2: ld returned 1 exit status
    make: *** [lsapi.so] Error 1
    setup.rb:655:in `command': system("make") failed (RuntimeError)
    from setup.rb:664:in `make'
    from setup.rb:1258:in `setup_dir_ext'
    from setup.rb:1532:in `traverse'
    from setup.rb:1549:in `dive_into'
    from setup.rb:1530:in `traverse'
    from setup.rb:1534:in `traverse'
    from setup.rb:1533:in `traverse'
    from setup.rb:1549:in `dive_into'
    from setup.rb:1530:in `traverse'
    from setup.rb:1524:in `exec_task_traverse'
    from setup.rb:1519:in `exec_task_traverse'
    from setup.rb:1246:in `exec_setup'
    from setup.rb:996:in `exec_setup'
    from setup.rb:813:in `invoke'
    from setup.rb:773:in `invoke'
    from setup.rb:1578

    # gem install ruby-lsapi -- --build=x86_64-redhat-linux-gnu --host=x86_64-redhat-linux-gnu --target =x86_64-redhat-linux-gnu --with-libdir=lib64
    Building native extensions. This could take a while...
    lsruby.c: In function `lsapi_ruby_setenv':
    lsruby.c:60: warning: implicit declaration of function `ruby_setenv'
    lsruby.c:62: warning: implicit declaration of function `ruby_unsetenv'
    lsruby.c: In function `lsapi_fork_child':
    lsruby.c:216: warning: implicit declaration of function `setsid'
    lsruby.c:242: warning: implicit declaration of function `usleep'
    lsruby.c:284: warning: implicit declaration of function `fork'
    lsruby.c:288: warning: implicit declaration of function `getppid'
    lsruby.c:306: warning: implicit declaration of function `close'
    lsruby.c:318: warning: implicit declaration of function `getpgrp'
    lsruby.c: In function `chdir_file':
    lsruby.c:401: warning: implicit declaration of function `chdir'
    lsruby.c: In function `lsapi_write':
    lsruby.c:448: warning: unused variable `data'
    lsruby.c: At top level:
    lsruby.c:32: warning: 'lsapi_objrefs' defined but not used
    lsruby.c:56: warning: 'lsapi_ruby_setenv' defined but not used
    lsruby.c:73: warning: 'lsapi_free_data' defined but not used
    lsruby.c:395: warning: 'chdir_file' defined but not used
    lsruby.c:671: warning: 'lsapi_isatty' defined but not used
    /usr/bin/ld: skipping incompatible /usr/lib/libruby.so when searching for -lruby
    /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../libruby.so when searching for -lruby
    /usr/bin/ld: skipping incompatible /usr/lib/libruby.so when searching for -lruby
    /usr/bin/ld: cannot find -lruby
    collect2: ld returned 1 exit status
    make: *** [lsapi.so] Error 1
    /usr/bin/ld: skipping incompatible /usr/lib/libruby.so when searching for -lruby
    /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../libruby.so when searching for -lruby
    /usr/bin/ld: skipping incompatible /usr/lib/libruby.so when searching for -lruby
    /usr/bin/ld: cannot find -lruby
    collect2: ld returned 1 exit status
    make: *** [lsapi.so] Error 1
    ruby extconf.rb install ruby-lsapi -- --build=x86_64-redhat-linux-gnu --host=x86_64-redhat-linux-gnu --target=x86_64-redhat-linux-gnu --with-libdir=lib64
    checking for main() in -lsocket... no
    creating Makefile

    make
    gcc -fPIC -O0 -g -pipe -m32 -march=i386 -mtune=pentium4 -Wall -fPIC -I. -I/usr/lib/ruby/1.8/i386-linux -I/usr/lib/ruby/1.8/i386-linux -I. -c lsruby.c
    gcc -fPIC -O0 -g -pipe -m32 -march=i386 -mtune=pentium4 -Wall -fPIC -I. -I/usr/lib/ruby/1.8/i386-linux -I/usr/lib/ruby/1.8/i386-linux -I. -c lsapilib.c
    gcc -shared -L"/usr/lib" -o lsapi.so lsruby.o lsapilib.o -lruby -ldl -lcrypt -lm -lc

    make install
    gcc -shared -L"/usr/lib" -o lsapi.so lsruby.o lsapilib.o -lruby -ldl -lcrypt -lm -lc

    make clean
    Successfully installed ruby-lsapi-1.11
    Last edited: Nov 1, 2006
  2. mistwang

    mistwang LiteSpeed Staff

    I don't know exactly what went wrong, looks like a ruby library problem. I recommend you to install ruby 1.8.4 or 1.8.5 from source if ruby is from the centos distribution.
  3. aemadrid

    aemadrid New Member

    It is Ruby 1.8.4 from Centos Plus. I have everything else setup so changing to Ruby 1.8.4 from source might not be the best option for me. Doy ou have any idea why it is saying that the ruby lib is not compatible? Isn't it a 64bit issue?

    Thanks in advance,


    Adrian Madrid
  4. xing

    xing LiteSpeed Staff

  5. aemadrid

    aemadrid New Member

    # ruby setup.rb config
    ---> ext
    ---> ext/lsapi
    /usr/bin/ruby /root/installed/ruby-lsapi-1.11/ext/lsapi/extconf.rb
    checking for main() in -lsocket... no
    creating Makefile
    <--- ext/lsapi
    <--- ext

    # ruby setup.rb setup
    ---> ext
    ---> ext/lsapi
    make
    gcc -fPIC -O0 -g -pipe -m32 -march=i386 -mtune=pentium4 -Wall -fPIC -I. -I/usr/lib/ruby/1.8/i386-linux -I/usr/l
    ib/ruby/1.8/i386-linux -I/root/installed/ruby-lsapi-1.11/ext/lsapi -c lsruby.c
    lsruby.c: In function `lsapi_ruby_setenv':
    lsruby.c:60: warning: implicit declaration of function `ruby_setenv'
    lsruby.c:62: warning: implicit declaration of function `ruby_unsetenv'
    lsruby.c: In function `lsapi_fork_child':
    lsruby.c:216: warning: implicit declaration of function `setsid'
    lsruby.c:242: warning: implicit declaration of function `usleep'
    lsruby.c:284: warning: implicit declaration of function `fork'
    lsruby.c:288: warning: implicit declaration of function `getppid'
    lsruby.c:306: warning: implicit declaration of function `close'
    lsruby.c:318: warning: implicit declaration of function `getpgrp'
    lsruby.c: In function `chdir_file':
    lsruby.c:401: warning: implicit declaration of function `chdir'
    lsruby.c: In function `lsapi_write':
    lsruby.c:448: warning: unused variable `data'
    lsruby.c: At top level:
    lsruby.c:32: warning: 'lsapi_objrefs' defined but not used
    lsruby.c:56: warning: 'lsapi_ruby_setenv' defined but not used
    lsruby.c:73: warning: 'lsapi_free_data' defined but not used
    lsruby.c:395: warning: 'chdir_file' defined but not used
    lsruby.c:671: warning: 'lsapi_isatty' defined but not used
    gcc -fPIC -O0 -g -pipe -m32 -march=i386 -mtune=pentium4 -Wall -fPIC -I. -I/usr/lib/ruby/1.8/i386-linux -I/usr/l
    ib/ruby/1.8/i386-linux -I/root/installed/ruby-lsapi-1.11/ext/lsapi -c lsapilib.c
    gcc -shared -L"/usr/lib" -o lsapi.so lsruby.o lsapilib.o -lruby -ldl -lcrypt -lm -lc
    /usr/bin/ld: skipping incompatible /usr/lib/libruby.so when searching for -lruby
    /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../libruby.so when searching for
    -lruby
    /usr/bin/ld: skipping incompatible /usr/lib/libruby.so when searching for -lruby
    /usr/bin/ld: cannot find -lruby
    collect2: ld returned 1 exit status
    make: *** [lsapi.so] Error 1
    setup.rb:655:in `command': system("make") failed (RuntimeError)
    from setup.rb:664:in `make'
    from setup.rb:1258:in `setup_dir_ext'
    from setup.rb:1532:in `traverse'
    from setup.rb:1549:in `dive_into'
    from setup.rb:1530:in `traverse'
    from setup.rb:1534:in `traverse'
    from setup.rb:1533:in `traverse'
    from setup.rb:1549:in `dive_into'
    from setup.rb:1530:in `traverse'
    from setup.rb:1524:in `exec_task_traverse'
    from setup.rb:1519:in `exec_task_traverse'
    from setup.rb:1246:in `exec_setup'
    from setup.rb:996:in `exec_setup'
    from setup.rb:826:in `invoke'
    from setup.rb:773:in `invoke'
    from setup.rb:1578

    # ruby setup.rb install
    rm -f InstalledFiles
    ---> ext
    ---> ext/lsapi
    no ruby extention exists: 'ruby setup.rb setup' first
    Try 'ruby setup.rb --help' for detailed usage.
  6. mistwang

    mistwang LiteSpeed Staff

    Don't know why, the Makefile generated by ruby want to build 32bit binary, however, your ruby lib might be 64bit, so link failed.

    You can manually remove compiler options "-m32 -march=i386 -mtune=pentium4" from ext/lsapi/Makefile. then do "make clean" "make install" under ext/lsapi/ directory.
  7. xing

    xing LiteSpeed Staff

    We also cannot reproduce this error on our own CentOS 4.4 64bit machine.

    [root@monster4 ~]# rpm -qa | grep compat
    compat-libstdc++-33-3.2.3-47.3
    compat-db-4.1.25-9
    compat-libstdc++-296-2.96-132.7.2
    compat-openldap-2.1.30-6.4E
    java-1.4.2-gcj-compat-1.4.2.0-27jpp
    compat-glibc-headers-2.3.2-95.30
    compat-glibc-2.3.2-95.30
    compat-libgcc-296-2.96-132.7.2
    compat-db-4.1.25-9
    compat-libcom_err-1.0-5

    [root@monster4 ~]# rpm -qa | grep gcc
    gcc-c++-3.4.6-3
    libgcc-3.4.6-3
    gcc-java-3.4.6-3
    libgcc-3.4.6-3
    gcc-3.4.6-3
    gcc-g77-3.4.6-3
    compat-libgcc-296-2.96-132.7.2
  8. aemadrid

    aemadrid New Member

    Thanks again for the info. I made the changes but still I'm getting in trouble when compiling. Here are the steps I took and what errors I got:

    # cd /root/installed/ruby-lsapi-1.11/ext/lsapi

    # vi Makefile

    #CFLAGS = -fPIC -O0 -g -pipe -m32 -march=i386 -mtune=pentium4 -Wall -fPIC
    CFLAGS = -fPIC -O0 -g -pipe -Wall -fPIC

    # make clean

    # make install
    gcc -fPIC -O0 -g -pipe -Wall -fPIC -I. -I/usr/lib/ruby/1.8/i386-linux -I/usr/lib/ruby/1.8/i386-linux -I/root/installed/ruby-lsapi-1.11/ext/lsapi -c lsruby.c
    lsruby.c: In function `lsapi_ruby_setenv':
    lsruby.c:60: warning: implicit declaration of function `ruby_setenv'
    lsruby.c:62: warning: implicit declaration of function `ruby_unsetenv'
    lsruby.c: In function `lsapi_fork_child':
    lsruby.c:216: warning: implicit declaration of function `setsid'
    lsruby.c:242: warning: implicit declaration of function `usleep'
    lsruby.c:284: warning: implicit declaration of function `fork'
    lsruby.c:288: warning: implicit declaration of function `getppid'
    lsruby.c:306: warning: implicit declaration of function `close'
    lsruby.c:318: warning: implicit declaration of function `getpgrp'
    lsruby.c: In function `chdir_file':
    lsruby.c:401: warning: implicit declaration of function `chdir'
    lsruby.c: In function `lsapi_write':
    lsruby.c:448: warning: unused variable `data'
    lsruby.c: At top level:
    lsruby.c:32: warning: 'lsapi_objrefs' defined but not used
    lsruby.c:56: warning: 'lsapi_ruby_setenv' defined but not used
    lsruby.c:73: warning: 'lsapi_free_data' defined but not used
    lsruby.c:395: warning: 'chdir_file' defined but not used
    lsruby.c:671: warning: 'lsapi_isatty' defined but not used
    gcc -fPIC -O0 -g -pipe -Wall -fPIC -I. -I/usr/lib/ruby/1.8/i386-linux -I/usr/lib/ruby/1.8/i386-linux -I/root/installed/ruby-lsapi-1.11/ext/lsapi -c lsapilib.c
    gcc -shared -L"/usr/lib" -o lsapi.so lsruby.o lsapilib.o -lruby -ldl -lcrypt -lm -lc
    /usr/bin/ld: skipping incompatible /usr/lib/libruby.so when searching for -lruby
    /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../libruby.so when searching for -lruby
    /usr/bin/ld: skipping incompatible /usr/lib/libruby.so when searching for -lruby
    /usr/bin/ld: cannot find -lruby
    collect2: ld returned 1 exit status
    make: *** [lsapi.so] Error 1
  9. mistwang

    mistwang LiteSpeed Staff

    Just uninstall the ruby package and install ruby/rails from source, it is pretty easy. :)
  10. aemadrid

    aemadrid New Member

    I think I'm going to have to try that. I've done it before but my only deterrent is all the gems I have already installed. I'll see if I can figure out how to uninstall those safely.

    BTW, here are the rpms I'm missing:

    java-1.4.2-gcj-compat-1.4.2.0-27jpp
    compat-glibc-headers-2.3.2-95.30
    compat-glibc-2.3.2-95.30
    compat-db-4.1.25-9
    gcc-java-3.4.6-3
    gcc-g77-3.4.6-3
    gcc-c++-3.4.6-3

    I installed these ones (don't know if the other ones are really important:

    compat-glibc-headers.x86_64 1:2.3.2-95.30
    gcc-c++.x86_64 0:3.4.6-3
    libstdc++-devel.x86_64 0:3.4.6-3

    Failed still so I will give the custom ruby install and report.

    Thanks again,


    Adrian Madrid
  11. aemadrid

    aemadrid New Member

    Removed the ruby rpms and installed ruby from source and it solved the issue. Very weird stuff. Thank you so much for your help!


    Adrian Madrid

Share This Page