Compiling mysql-ruby-2.8 problems


#1

Hello,

I am trying to compile mysql-ruby-2.8
(http://rubyforge.org/frs/?group_id=4550) on windows, but ‘ruby
extconf.rb’ reports such error:


checking for main() in libmysql.lib… no


The mkmf.log has:


checked program was:
/* begin /
1: #define WIN32_LEAN_AND_MEAN
2: #include <winsock2.h>
3: #include <windows.h>
4:
5: /top/
6: int main() { return 0; }
7: int t() { void ((volatile p)()); p = (void (()()))main; return 0; }
/
end */


I see no mysql related headers to be included. I guess they are required
to declare ‘main’ symbol?

In extconf.rb I see:


require ‘mkmf’

if /mswin32/ =~ RUBY_PLATFORM
inc, lib = dir_config(‘mysql’)
exit 1 unless have_library(“libmysql”)
elseif …


have_library(“libmysql”) specified only the library name but the headers
parameter is missed. So how it expected to know which mysql headers to
#include?

Also, this ‘main’ function checked… What is it? Why so odd symbol
name?

I am so confused… May be some one can clarify things :slight_smile:

Thanks,

  • Alex

#2

I have compiled it (had wrong environment), but still don’t understand
how have_library works. So explanations are welcome :slight_smile:


#3

Alex 2k8 wrote:

I have compiled it (had wrong environment), but still don’t understand
how have_library works. So explanations are welcome :slight_smile:

Getcha. ‘main’ stands for ‘int main()’ and actually does nothing here,
as main is always present. The real check for library presense comes
from linker.


#4

Alex 2k8 wrote:

I have compiled it (had wrong environment), but still don’t understand
how have_library works. So explanations are welcome :slight_smile:

Hello Alex

I m very knew to Ruby, and I m also having similar issue. i.e.
checking for main() in libmysql.lib… no

Can you please advise on the resolution

Thanks
Kraz


#5

Kz Byz wrote:

I m very knew to Ruby, and I m also having similar issue. i.e.
checking for main() in libmysql.lib… no

Can you please advise on the resolution

Hi Kz,

In case you are working in Windows then do this.

  1. Download the attachment dll from
    http://www.dll-files.com/dllindex/dll-files.shtml?libmysql
    2.SAVE that file into c:\ruby\bin\
  2. gem install mysql
  3. CHECK your code now…

Regards,
P.Raveendran


#6

Hello, Kraz

The steps to get NMAKE was:

  1. Start > Visual Studio 2008 > Visual Studio Tools > Visual Studio
    Command Prompt

  2. ruby extconf.rb
    –with-mysql-include=C:\PROGRA~1\MYSQL\MYSQLS~1.1\INCLUDE
    –with-mysql-lib=C:\PROGRA~1\MYSQL\MYSQLS~1.1\LIB\OPT\

Regards,

  • Alex