Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2001-05

mysql on windows

18 messages · 7 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Fernando Lozano

Hi Michael and list!

I am a teacher in the process of making the computer science department of a brazilian university and a college switch fo free pascal. So far, everybody is liking it!

I have the Windows version of MySQL installed but cannot link the testdb.pp example suplied with fpc-1.0.4 for Windows. I tells it cannot find -lmysqlclient...

My ppc396.cfg is points to the lib directory of my Mysql installation. Using the debuging options from ppc386 and ldw I could find it is looking for libmysqlclient.a and not mysqlclient.lib as suplied with mysql. I tried creating a copy using the name expected by the linker, and now it complains it cannot find -lm. :-(

Should I get a libm.a file somewhere (from a cygwin32 distro)? Or am I going the wrong direction?

Any help will be apreciated. It will be great to fave a FPC app using mysql and gtk+ running on both Windows and Linux. :-)

[]s, Fernando Lozano

Reply by email

Jeff Patterson
to Fernando Lozano

----- Original Message -----

Earlier message 23 lines
From: "Fernando Lozano" To: Cc: Sent: Wednesday, May 30, 2001 6:02 PM Subject: [fpc-pascal]mysql on windows > I have the Windows version of MySQL installed but cannot link the testdb.pp example suplied with fpc-1.0.4 for > Windows. I tells it cannot find -lmysqlclient... > > My ppc396.cfg is points to the lib directory of my Mysql installation. Using the debuging options from ppc386 and > ldw I could find it is looking for libmysqlclient.a and not mysqlclient.lib as suplied with mysql. I tried creating a copy > using the name expected by the linker, and now it complains it cannot find -lm. :-( There is supposed to be a DLL called libmysql.dll that should probably be copied from the MySQL installation to the Windows System directory. Oddly though, not all distribution packages of MySQL for Windows has this DLL included. I managed to get the DLL from an older distribution of MySQL and it seems to work fine with the current version.

Reply by email

Danuta Burnicka

The library 'libmysql.dll' you can also download from the site: http://www.fichtner.net/delphi/mysql.delphi.phtml

Show quoted text 5 lines
There is supposed to be a DLL called libmysql.dll that should probably be copied from the MySQL installation to the Windows System directory. Oddly though, not all distribution packages of MySQL for Windows has this DLL included. I managed to get the DLL from an older distribution of MySQL and it seems to work fine with the current version.

Danuta Burnicka

Kamera wideo Sony, 5000 zl wygraj w konkursie eMarketu i Onet.pl [ http://konkursy.onet.pl/emarket ]

Reply by email

Kanzelsberger Pavel

I have the same problem, anyway DLL is not needed in compilation time... compiler is looking for mysqlclient.lib or .aw? file...

regards, Pavel Kanzelsberger

Earlier message 34 lines
-----Original Message----- From: Jeff Patterson Sent: Thursday, May 31, 2001 12:01 AM To: Subject: Re: [fpc-pascal]mysql on windows ----- Original Message ----- From: "Fernando Lozano" To: Cc: Sent: Wednesday, May 30, 2001 6:02 PM Subject: [fpc-pascal]mysql on windows > I have the Windows version of MySQL installed but cannot link the testdb.pp example suplied with fpc-1.0.4 for > Windows. I tells it cannot find -lmysqlclient... > > My ppc396.cfg is points to the lib directory of my Mysql installation. Using the debuging options from ppc386 and > ldw I could find it is looking for libmysqlclient.a and not mysqlclient.lib as suplied with mysql. I tried creating a copy > using the name expected by the linker, and now it complains it cannot find -lm. :-( There is supposed to be a DLL called libmysql.dll that should probably be copied from the MySQL installation to the Windows System directory. Oddly though, not all distribution packages of MySQL for Windows has this DLL included. I managed to get the DLL from an older distribution of MySQL and it seems to work fine with the current version.

Reply by email

Kanzelsberger Pavel

I get it working by removing the last lines (complete INPUT) from link.res and running ppas.bat, but can someone explain it?

this is what I erased from link.res file:

INPUT(
-lmysqlclient
-lm
-lc
-lc
)

regards, Pavel Kanzelsberger

Earlier message 34 lines
-----Original Message----- From: Fernando Lozano Sent: Wednesday, May 30, 2001 11:02 PM To: Cc: Subject: [fpc-pascal]mysql on windows Hi Michael and list! I am a teacher in the process of making the computer science department of a brazilian university and a college switch fo free pascal. So far, everybody is liking it! I have the Windows version of MySQL installed but cannot link the testdb.pp example suplied with fpc-1.0.4 for Windows. I tells it cannot find -lmysqlclient... My ppc396.cfg is points to the lib directory of my Mysql installation. Using the debuging options from ppc386 and ldw I could find it is looking for libmysqlclient.a and not mysqlclient.lib as suplied with mysql. I tried creating a copy using the name expected by the linker, and now it complains it cannot find -lm. :-( Should I get a libm.a file somewhere (from a cygwin32 distro)? Or am I going the wrong direction? Any help will be apreciated. It will be great to fave a FPC app using mysql and gtk+ running on both Windows and Linux. :-) []s, Fernando Lozano

Reply by email

Peter Vreman
I have the same problem, anyway DLL is not needed in compilation time... compiler is looking for mysqlclient.lib or .aw? file...

With the 1.1 development compiler it is possible to create such import library automatically on compiletime. This will then require the .dll to be available

Peter

Reply by email

Kanzelsberger Pavel

I'm using v1.1 of compiler... but erasing last INPUT() from link.res helps, anyway I don't understand why :)

Pavel

Earlier message 19 lines
-----Original Message----- From: Peter Vreman Sent: Thursday, May 31, 2001 12:56 PM To: Subject: RE: [fpc-pascal]mysql on windows > I have the same problem, anyway DLL is not needed in compilation time... > compiler is looking for mysqlclient.lib or .aw? file... With the 1.1 development compiler it is possible to create such import library automatically on compiletime. This will then require the .dll to be available Peter

Reply by email

Peter Vreman
I'm using v1.1 of compiler... but erasing last INPUT() from link.res helps, anyway I don't understand why :)

Which revision of the mysql.pp do you have? 1.5 is the correct version, it contains the next lines:

{$ifndef win32}
{$linklib c}
{$linklib m}
{$endif}

this will result in not having the -lc and -lm in the link.res

Reply by email

Kanzelsberger Pavel

Yes it's v1.5

{ $Id: mysql.pp,v 1.5 2001/03/13 08:50:38 michael Exp $ }

and contains

{$ifdef win32}
Const mysqllib = 'libmysql';
{$else}
Const mysqllib = 'mysqlclient';
{$endif}
{$ifndef win32}
{$linklib c}
{$linklib m}
{$endif}
Earlier message 25 lines
-----Original Message----- From: Peter Vreman Sent: Thursday, May 31, 2001 2:35 PM To: Subject: RE: [fpc-pascal]mysql on windows > I'm using v1.1 of compiler... but erasing last INPUT() from link.res helps, > anyway I don't understand why :) Which revision of the mysql.pp do you have? 1.5 is the correct version, it contains the next lines: {$ifndef win32} {$linklib c} {$linklib m} {$endif} this will result in not having the -lc and -lm in the link.res

Reply by email

Michael Van Canneyt
to Kanzelsberger Pavel
Kanzelsberger Pavel wrote 16 lines
Yes it's v1.5 { $Id: mysql.pp,v 1.5 2001/03/13 08:50:38 michael Exp $ } and contains {$ifdef win32} Const mysqllib = 'libmysql'; {$else} Const mysqllib = 'mysqlclient'; {$endif} {$ifndef win32} {$linklib c} {$linklib m} {$endif}

But in that case, the library 'mysqlclient' should not be looked for, so with which compiler are you working ?

Michael.

Reply by email

Kanzelsberger Pavel

Win32 version of compiler... looks like that WIN32 is not defined?

Earlier message 35 lines
-----Original Message----- From: Michael Van Canneyt Sent: Thursday, May 31, 2001 3:11 PM To: '' Subject: RE: [fpc-pascal]mysql on windows On Thu, 31 May 2001, Kanzelsberger Pavel wrote: > Yes it's v1.5 > > { $Id: mysql.pp,v 1.5 2001/03/13 08:50:38 michael Exp $ } > > and contains > > {$ifdef win32} > Const mysqllib = 'libmysql'; > {$else} > Const mysqllib = 'mysqlclient'; > {$endif} > > {$ifndef win32} > {$linklib c} > {$linklib m} > {$endif} But in that case, the library 'mysqlclient' should not be looked for, so with which compiler are you working ? Michael.

Reply by email

Kanzelsberger Pavel

thanks!

Earlier message 20 lines
-----Original Message----- From: Jonas Maebe Sent: Thursday, May 31, 2001 3:27 PM To: Subject: Re: [fpc-pascal]mysql on windows On donderdag, mei 31, 2001, at 03:27 , Kanzelsberger Pavel wrote: > Win32 version of compiler... looks like that WIN32 is not defined? Use -va while compiling the unit to see what is rejected and accepted regarding defines. The most likely is that the compiler is using another compiled unit somewhere, use -vt while compiling your program to see which one. Jonas

Reply by email

Fernando Lozano

Hi Jeff,

Show quoted text 16 lines
> I have the Windows version of MySQL installed but cannot link the testdb.pp example suplied with fpc-1.0.4 for > Windows. I tells it cannot find -lmysqlclient... > > My ppc396.cfg is points to the lib directory of my Mysql installation. Using the debuging options from ppc386 and > ldw I could find it is looking for libmysqlclient.a and not mysqlclient.lib as suplied with mysql. I tried creating a copy > using the name expected by the linker, and now it complains it cannot find -lm. :-( There is supposed to be a DLL called libmysql.dll that should probably be copied from the MySQL installation to the Windows System directory. Oddly though, not all distribution packages of MySQL for Windows has this DLL included. I managed to get the DLL from an older distribution of MySQL and it seems to work fine with the current version.

My installation of MySQL includes libmysql.dll, but it is not enough. MySQL docs tell you must link against libmysql.lib to use libmysql.dll, so I tried this, renaming libmysql.lib to libmysqlclient.a as fpc looks for. The result is the same as before, ldw complains about missing -lm.

Maybe you have a complete cygwin32 environment installed or some other package that provides libm.a just like an Unix OS would.

[]s, Fernando Lozano

Reply by email

Fernando Lozano

Hi Kanzelsberger,

I have the same problem, anyway DLL is not needed in compilation time... compiler is looking for mysqlclient.lib or .aw? file...

My debugging shows that the compiler (actually ldw.exe, the linker) is looking for libmysqlclient.a. Renaming the libmysql.dll or libmysqlclient.lib to libmysqlclient.a solvers the error about -lmysqlclient but shows a new error about -lm.

The MySQL manual states you need to link libmysql.lib to use libmysql.dll. I guess I need to get a working libm.a from somewhere, maybe cygwin.

[]s, Fernando Lozano

Reply by email

Fernando Lozano

Hi Kanzelsberger,

Show quoted text 11 lines
I get it working by removing the last lines (complete INPUT) from link.res and running ppas.bat, but can someone explain it? this is what I erased from link.res file: INPUT( -lmysqlclient -lm -lc -lc )

Really works, that is, the program can connect to a mysql database and get data from it?

[]s, Fernando Lozano

Reply by email

Fernando Lozano

Hi Kanzelsberger,

I'm using v1.1 of compiler... but erasing last INPUT() from link.res helps, anyway I don't understand why :)

I guess libmysql that contains the references to libc and libm as needed to generate an executable. Does anyone knows how check this, and if I am right how to patch the (mysql) libraries so they do not include this information anymore?

By the way, the same error (about -lm and -lc) happens when I try to compile the Interbase 6.0 demo. The Interbase 4.0 compiles, links and runs fine though.

[]s, Fernando Lozano

Reply by email

Fernando Lozano

Hi Kanzelsberger and list

I am using 1.0.4 binary as provided on freepascal.org. Looks like I'll have to rebuild the unit mysql and make sure win32 is defined...

Whom should I talk to to ask for a fix on the binary distributions form fpc web site?

[]s, Fernando Lozano

Show quoted text 16 lines
Yes it's v1.5 { $Id: mysql.pp,v 1.5 2001/03/13 08:50:38 michael Exp $ } and contains {$ifdef win32} Const mysqllib = 'libmysql'; {$else} Const mysqllib = 'mysqlclient'; {$endif} {$ifndef win32} {$linklib c} {$linklib m} {$endif}

Reply by email