Forum: Ruby Compiling mysql-ruby-2.8 problems

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
E1e2dd8c03c8e9e0680cfd802df0a04b?d=identicon&s=25 Alex 2k8 (alex_2k8)
on 2009-01-28 23:20
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 :-)

Thanks,
  - Alex
E1e2dd8c03c8e9e0680cfd802df0a04b?d=identicon&s=25 Alex 2k8 (alex_2k8)
on 2009-01-29 02:47
I have compiled it (had wrong environment), but still don't understand
how have_library works. So explanations are welcome :-)
E1e2dd8c03c8e9e0680cfd802df0a04b?d=identicon&s=25 Alex 2k8 (alex_2k8)
on 2009-01-29 14:54
Alex 2k8 wrote:
> I have compiled it (had wrong environment), but still don't understand
> how have_library works. So explanations are welcome :-)

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.
Bc8591ca2e0f85cb9e52b9858f7a9255?d=identicon&s=25 Kz Byz (krazonline)
on 2009-04-06 02:15
Alex 2k8 wrote:
> I have compiled it (had wrong environment), but still don't understand
> how have_library works. So explanations are welcome :-)

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
Da22709962fc0cf31068e779c78ab6be?d=identicon&s=25 Raveendran .P (jazzezravi)
on 2009-04-06 08:16
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\
3. gem install mysql
4. CHECK your code now..


Regards,
P.Raveendran
http://raveendran.wordpress.com
E1e2dd8c03c8e9e0680cfd802df0a04b?d=identicon&s=25 Alex 2k8 (alex_2k8)
on 2009-04-06 11:51
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
This topic is locked and can not be replied to.