Uploaded image for project: 'CUBRID APIs'
  1. CUBRID APIs
  2. APIS-296

Cannot use Ruby Driver on Windows

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: Ruby 9.2.0.0001
    • Component/s: Ruby Driver
    • Labels:
      None
    • Environment:

      CUBRID 8.4.1.6004

      Description

      An affiliate user reported the following:
      "I tried using the Windows ruby driver (cubrid-0.61-x86-mingw32), but it won't load. It brings up a Windows dialog box stating: 'The procedure entry point cci_glo_new could not be located in the dynamic link library cascci.dll'.

      Basically, it appears to be compiled against a different version of CUBRID than the current Windows download, so it doesn't work."

        Activity

        Hide
        jinhu 李金虎 added a comment - - edited

        The step to reproduce this error:

        (1) Install ruby on Windows using rubyinstaller Ruby 1.8.7-p371.exe:
        http://rubyinstaller.org/downloads/
        (2) Install ruby Development Kit. It can be found here:
        http://rubyinstaller.org/downloads/
        (3) Set the below into PATH:
        ...\ruby-devkit\mingw\bin
        ...\ruby-devkit\bin
        (4) Build CUBRID ruby driver:

        D:\code\cubrid-ruby> cd ext
        D:\code\cubrid-ruby\ext> ruby extconf.rb
        D:\code\cubrid-ruby\ext>make
        gcc -I. -I/C/Ruby187/lib/ruby/1.8/i386-mingw32 -I/C/Ruby187/lib/ruby/1.8/i386-mi
        ngw32 -I. -ID:\code\cubridapis\CUBRID/include -ID:\code\cubridapis\CUBRID/includ
        e    -g -O2 -DFD_SETSIZE=256    -c conn.c
        In file included from c:/Ruby187/lib/ruby/1.8/i386-mingw32/ruby.h:755:0,
                         from cubrid.h:35,
                         from conn.c:31:
        c:/Ruby187/lib/ruby/1.8/i386-mingw32/missing.h:29:8: error: redefinition of 'str
        uct timezone'
        In file included from c:/Ruby187/lib/ruby/1.8/i386-mingw32/win32/win32.h:57:0,
                         from c:/Ruby187/lib/ruby/1.8/i386-mingw32/defines.h:186,
                         from c:/Ruby187/lib/ruby/1.8/i386-mingw32/ruby.h:37,
                         from cubrid.h:35,
                         from conn.c:31:
        d:\downloads\ruby-devkit\mingw\bin\../lib/gcc/i686-w64-mingw32/4.7.2/../../../..
        /i686-w64-mingw32/include/time.h:260:8: note: originally defined here
        make: *** [conn.o] Error 1
        

        (5) Solve the above error:
        ruby.h includes missing.h.
        In missing.h:

        #if !defined(HAVE_STRUCT_TIMEZONE)
        struct timezone {
            int tz_minuteswest;
            int tz_dsttime;
        };
        #endif
        

        So, the reason of the error in the "make" is that:
        The above is conflicted with the ruby-devkit\mingw\i686-w64-mingw32\include\time.h:

        #ifndef _TIMEZONE_DEFINED /* also in sys/time.h */
        #define _TIMEZONE_DEFINED
        struct timezone {
          int tz_minuteswest;
          int tz_dsttime;
        };
        
          extern int __cdecl mingw_gettimeofday (struct timeval *p, struct timezone *z);
        #endif /* _TIMEZONE_DEFINED */
        

        So, remove the 'struct timezone' definition in missing.h to avoid the error in 'make'.

        (6) run make
        The result is as below:

        D:\code\cubrid-ruby\ext>make
        gcc -shared -s -o cubrid.so conn.o cubrid.o error.o oid.o stmt.o -L. -LC:/Ruby18
        7/lib -LD:\code\cubridapis\CUBRID/lib -L.  -Wl,--enable-auto-image-base,--enable
        -auto-import,--export-all   -lmsvcrt-ruby18 -lcascci  -lshell32 -lws2_32
        conn.o: In function `cubrid_conn_glo_new':
        D:\code\cubrid-ruby\ext/conn.c:373: undefined reference to `cci_glo_new'
        oid.o: In function `cubrid_oid_glo_load':
        D:\code\cubrid-ruby\ext/oid.c:551: undefined reference to `cci_glo_load'
        oid.o: In function `cubrid_oid_glo_save':
        D:\code\cubrid-ruby\ext/oid.c:587: undefined reference to `cci_glo_save'
        oid.o: In function `cubrid_oid_glo_size':
        D:\code\cubrid-ruby\ext/oid.c:611: undefined reference to `cci_glo_data_size'
        oid.o: In function `cubrid_oid_glo_drop':
        D:\code\cubrid-ruby\ext/oid.c:642: undefined reference to `cci_glo_destroy_data'
        
        collect2.exe: error: ld returned 1 exit status
        make: *** [cubrid.so] Error 1
        
        Show
        jinhu 李金虎 added a comment - - edited The step to reproduce this error: (1) Install ruby on Windows using rubyinstaller Ruby 1.8.7-p371.exe: http://rubyinstaller.org/downloads/ (2) Install ruby Development Kit. It can be found here: http://rubyinstaller.org/downloads/ (3) Set the below into PATH: ...\ruby-devkit\mingw\bin ...\ruby-devkit\bin (4) Build CUBRID ruby driver: D:\code\cubrid-ruby> cd ext D:\code\cubrid-ruby\ext> ruby extconf.rb D:\code\cubrid-ruby\ext>make gcc -I. -I/C/Ruby187/lib/ruby/1.8/i386-mingw32 -I/C/Ruby187/lib/ruby/1.8/i386-mi ngw32 -I. -ID:\code\cubridapis\CUBRID/include -ID:\code\cubridapis\CUBRID/includ e -g -O2 -DFD_SETSIZE=256 -c conn.c In file included from c:/Ruby187/lib/ruby/1.8/i386-mingw32/ruby.h:755:0, from cubrid.h:35, from conn.c:31: c:/Ruby187/lib/ruby/1.8/i386-mingw32/missing.h:29:8: error: redefinition of 'str uct timezone' In file included from c:/Ruby187/lib/ruby/1.8/i386-mingw32/win32/win32.h:57:0, from c:/Ruby187/lib/ruby/1.8/i386-mingw32/defines.h:186, from c:/Ruby187/lib/ruby/1.8/i386-mingw32/ruby.h:37, from cubrid.h:35, from conn.c:31: d:\downloads\ruby-devkit\mingw\bin\../lib/gcc/i686-w64-mingw32/4.7.2/../../../.. /i686-w64-mingw32/include/time.h:260:8: note: originally defined here make: *** [conn.o] Error 1 (5) Solve the above error: ruby.h includes missing.h. In missing.h: #if !defined(HAVE_STRUCT_TIMEZONE) struct timezone { int tz_minuteswest; int tz_dsttime; }; #endif So, the reason of the error in the "make" is that: The above is conflicted with the ruby-devkit\mingw\i686-w64-mingw32\include\time.h: #ifndef _TIMEZONE_DEFINED /* also in sys/time.h */ #define _TIMEZONE_DEFINED struct timezone { int tz_minuteswest; int tz_dsttime; }; extern int __cdecl mingw_gettimeofday (struct timeval *p, struct timezone *z); #endif /* _TIMEZONE_DEFINED */ So, remove the 'struct timezone' definition in missing.h to avoid the error in 'make'. (6) run make The result is as below: D:\code\cubrid-ruby\ext>make gcc -shared -s -o cubrid.so conn.o cubrid.o error.o oid.o stmt.o -L. -LC:/Ruby18 7/lib -LD:\code\cubridapis\CUBRID/lib -L. -Wl,--enable-auto-image-base,--enable -auto-import,--export-all -lmsvcrt-ruby18 -lcascci -lshell32 -lws2_32 conn.o: In function `cubrid_conn_glo_new': D:\code\cubrid-ruby\ext/conn.c:373: undefined reference to `cci_glo_new' oid.o: In function `cubrid_oid_glo_load': D:\code\cubrid-ruby\ext/oid.c:551: undefined reference to `cci_glo_load' oid.o: In function `cubrid_oid_glo_save': D:\code\cubrid-ruby\ext/oid.c:587: undefined reference to `cci_glo_save' oid.o: In function `cubrid_oid_glo_size': D:\code\cubrid-ruby\ext/oid.c:611: undefined reference to `cci_glo_data_size' oid.o: In function `cubrid_oid_glo_drop': D:\code\cubrid-ruby\ext/oid.c:642: undefined reference to `cci_glo_destroy_data' collect2.exe: error: ld returned 1 exit status make: *** [cubrid.so] Error 1
        Hide
        jinhu 李金虎 added a comment - - edited

        Analysis:

        The cci_glo_xxx APIs in CCI are not exported into dll in Windows and are not used now, and they aren't documented in official website.

        Solution:
        Remove the code related to glo.

        Committed in https://github.com/HelloJamesLee/cubrid-ruby and merged into https://github.com/CUBRID/cubrid-ruby

        Show
        jinhu 李金虎 added a comment - - edited Analysis: The cci_glo_xxx APIs in CCI are not exported into dll in Windows and are not used now, and they aren't documented in official website. Solution: Remove the code related to glo. Committed in https://github.com/HelloJamesLee/cubrid-ruby and merged into https://github.com/CUBRID/cubrid-ruby

          People

          • Assignee:
            cn15800 谢韦华[Bert]
            Reporter:
            ovidiu.veliscu Veliscu Ovidiu
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: