Sign in Join

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

Mailing lists / fpc-pascal / 2003-06

Error compiling testdb.pp example (mysql)

16 messages · 7 people · –

Reply by email Subscribe to this list Your subscription

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

James Mills

$ fpc testdb
Free Pascal Compiler version 1.0.6 [2002/08/10] for i386 Copyright (c) 1993-2002 by Florian Klaempfl
Target OS: Linux for i386
Compiling testdb.pas
Assembling qtest
Linking testdb
testdb.o(.text+0xaa): In function `program_init':
: undefined reference to `mysql_connect'
testdb.pas(84,3) Error: Error while linking
Closing script ppas.sh

What have I done wrong here ? ...
Yes I have installed the appropiate libmysqlclient-dev (from debian).

cheers
James

- - James Mills Zero Defect Software Engineers Group - ZDSEG

Reply by email

James Mills
to Unknown author: It is not the correct version of mysql. Please check what the mysql_version unit reports…
Show quoted text 21 lines
On Sat, 14 Jun 2003, James Mills wrote: > $ fpc testdb > Free Pascal Compiler version 1.0.6 [2002/08/10] for i386 > Copyright (c) 1993-2002 by Florian Klaempfl > Target OS: Linux for i386 > Compiling testdb.pas > Assembling qtest > Linking testdb > testdb.o(.text+0xaa): In function `program_init': > : undefined reference to `mysql_connect' > testdb.pas(84,3) Error: Error while linking > Closing script ppas.sh > > What have I done wrong here ? ... > Yes I have installed the appropiate libmysqlclient-dev (from debian). It is not the correct version of mysql. Please check what the mysql_version unit reports as a version, and what the version is of the installed mysql.

How on earth do I do that :P ?

cheers
James

Show quoted text 7 lines
Michael. _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal
- - James Mills Zero Defect Software Engineers Group - ZDSEG

Reply by email

Unknown author
to James Mills: $ fpc testdb Free Pascal Compiler version 1.0.6 [2002/08/10] for i386 Copyright (c)…
James Mills wrote 14 lines
$ fpc testdb Free Pascal Compiler version 1.0.6 [2002/08/10] for i386 Copyright (c) 1993-2002 by Florian Klaempfl Target OS: Linux for i386 Compiling testdb.pas Assembling qtest Linking testdb testdb.o(.text+0xaa): In function `program_init': : undefined reference to `mysql_connect' testdb.pas(84,3) Error: Error while linking Closing script ppas.sh What have I done wrong here ? ... Yes I have installed the appropiate libmysqlclient-dev (from debian).

It is not the correct version of mysql. Please check what the mysql_version unit reports as a version, and what the version is of the installed mysql.

Michael.

Reply by email

Unknown author
to James Mills: How on earth do I do that :P ? cheers James - - James Mills Zero Defect Software…
James Mills wrote 24 lines
On Sat, Jun 14, 2003 at 04:08:38PM +0200, wrote: > > > On Sat, 14 Jun 2003, James Mills wrote: > > > $ fpc testdb > > Free Pascal Compiler version 1.0.6 [2002/08/10] for i386 > > Copyright (c) 1993-2002 by Florian Klaempfl > > Target OS: Linux for i386 > > Compiling testdb.pas > > Assembling qtest > > Linking testdb > > testdb.o(.text+0xaa): In function `program_init': > > : undefined reference to `mysql_connect' > > testdb.pas(84,3) Error: Error while linking > > Closing script ppas.sh > > > > What have I done wrong here ? ... > > Yes I have installed the appropiate libmysqlclient-dev (from debian). > > It is not the correct version of mysql. Please check what the mysql_version > unit reports as a version, and what the version is of the installed mysql. How on earth do I do that :P ?

Simple:

program ver;
uses mysql_version;
begin
  Writeln(MYSQL_SERVER_VERSION);
end.

and
cat /usr/include/mysql/mysql_version.h

Should tell you what is installed.

Michael.

Reply by email

James Mills
to Unknown author
Show quoted text 38 lines
On Sun, 15 Jun 2003, James Mills wrote: > On Sat, Jun 14, 2003 at 04:08:38PM +0200, wrote: > > > > > > On Sat, 14 Jun 2003, James Mills wrote: > > > > > $ fpc testdb > > > Free Pascal Compiler version 1.0.6 [2002/08/10] for i386 > > > Copyright (c) 1993-2002 by Florian Klaempfl > > > Target OS: Linux for i386 > > > Compiling testdb.pas > > > Assembling qtest > > > Linking testdb > > > testdb.o(.text+0xaa): In function `program_init': > > > : undefined reference to `mysql_connect' > > > testdb.pas(84,3) Error: Error while linking > > > Closing script ppas.sh > > > > > > What have I done wrong here ? ... > > > Yes I have installed the appropiate libmysqlclient-dev (from debian). > > > > It is not the correct version of mysql. Please check what the mysql_version > > unit reports as a version, and what the version is of the installed mysql. > > How on earth do I do that :P ? Simple: program ver; uses mysql_version; begin Writeln(MYSQL_SERVER_VERSION); end.

Okay I didn't know such a unit existed :)

Here's the info you wanted...

cheers
James

$ fpc test
Free Pascal Compiler version 1.0.6 [2002/08/10] for i386 Copyright (c) 1993-2002 by Florian Klaempfl
Target OS: Linux for i386
Compiling test.pas
Assembling ver
Linking test
8 Lines compiled, 1.0 sec

Sun Jun 15 01:05:14
~
$ ./test
3.21.28-gamma

Sun Jun 15 01:05:15
~
$ mutt
Mailbox is unchanged.

Sun Jun 15 01:05:27
~
$ cat /usr/include/mysql/mysql_version.h
/* Copyright Abandoned 1996, 1999, 2001 MySQL AB
This file is public domain and comes with NO WARRANTY of any kind */

/* Version numbers for protocol & mysqld */

#ifndef _mysql_version_h
#define _mysql_version_h
#ifdef _CUSTOMCONFIG_
#include <custom_conf.h>
#else
#define PROTOCOL_VERSION 10
#define MYSQL_SERVER_VERSION "4.0.13"
#ifndef MYSQL_SERVER_SUFFIX
#define MYSQL_SERVER_SUFFIX ""
#endif
#define FRM_VER 6
#define MYSQL_VERSION_ID 40013
#define MYSQL_PORT 3306
#define MYSQL_UNIX_ADDR "/var/run/mysqld/mysqld.sock" #define MYSQL_CONFIG_NAME "my"

/* mysqld compile time options */
#ifndef MYSQL_CHARSET
#define MYSQL_CHARSET "latin1"
#endif /* MYSQL_CHARSET */
#endif /* _CUSTOMCONFIG_ */
#endif /* _mysql_version_h */

Show quoted text 12 lines
and cat /usr/include/mysql/mysql_version.h Should tell you what is installed. Michael. _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal
- - James Mills Zero Defect Software Engineers Group - ZDSEG

Reply by email

Unknown author
to James Mills
James Mills wrote 43 lines
On Sat, Jun 14, 2003 at 05:01:38PM +0200, wrote: > > > On Sun, 15 Jun 2003, James Mills wrote: > > > On Sat, Jun 14, 2003 at 04:08:38PM +0200, wrote: > > > > > > > > > On Sat, 14 Jun 2003, James Mills wrote: > > > > > > > $ fpc testdb > > > > Free Pascal Compiler version 1.0.6 [2002/08/10] for i386 > > > > Copyright (c) 1993-2002 by Florian Klaempfl > > > > Target OS: Linux for i386 > > > > Compiling testdb.pas > > > > Assembling qtest > > > > Linking testdb > > > > testdb.o(.text+0xaa): In function `program_init': > > > > : undefined reference to `mysql_connect' > > > > testdb.pas(84,3) Error: Error while linking > > > > Closing script ppas.sh > > > > > > > > What have I done wrong here ? ... > > > > Yes I have installed the appropiate libmysqlclient-dev (from debian). > > > > > > It is not the correct version of mysql. Please check what the mysql_version > > > unit reports as a version, and what the version is of the installed mysql. > > > > How on earth do I do that :P ? > > Simple: > > program ver; > > uses mysql_version; > > begin > Writeln(MYSQL_SERVER_VERSION); > end. Okay I didn't know such a unit existed :) Here's the info you wanted...

Correction: the info which you need :-)

Seems that you have mysql version 4 installed.
The units we distribute standard work with MySQL 3.23.

There are units for mysql version 4 as well, but you must compile and install them separately. Get the sources of the packages , and look in packages/base/mysql/mysql4

I warn against using mysql with FPC. Their API changes quite often in incompatible ways, which can be masked with C macros but which cannot be masked with Pascal functions.

Try and use firebird instead is my usual advice.

Michael.

Reply by email

Alan Mead
to James Mills: $ fpc testdb Free Pascal Compiler version 1.0.6 [2002/08/10] for i386 Copyright (c)…

Are there known issues with 1.0.6 and it's finding the configuration file? Does it matter whether I compile using the 'fpc' or 'ppc386' command (they differ on my system):

ian]$ more ~amead/fpc.cfg
-gl
-Co
-Cr
ian]$ ls -l `which ppc386`
lrwxrwxrwx 1 root root 25 May 17 08:49 /usr/bin/ppc386 -> /usr/lib/fpc/1.0.6/ppc386*
ian]$ ls -l `which fpc`
-rwxr-xr-x 1 root root 78020 May 23 2002 /usr/bin/fpc* ian]$ ls -l /usr/lib/fpc/1.0.6/ppc386
-rwxr-xr-x 1 root root 897844 May 23 2002 /usr/lib/fpc/1.0.6/ppc386*
ian]$ rpm -qf /usr/bin/fpc
fpc-1.0.6-1
ian]$ rpm -qf /usr/lib/fpc/1.0.6/ppc386
fpc-1.0.6-1

I ask because my programs are not automatically being compiled with the desired options '-Cr -Co -gl'. I can enable range checking in the source file with {$R+}, is there a similar solution for -gl?

-Alan

=====
A Congressman was once asked about his attitude toward whiskey. "If you mean the demon drink that poisons the mind, pollutes the body, desecrates family life, and inflames sinners, then I'm against it. "

"But if you mean the elixir of Christmas cheer, the shield against winter chill, the taxable potion that puts needed funds into public coffers to comfort little crippled children, then I'm for it."

"This is my position, and I will not compromise."

__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

Reply by email

James Mills
to Unknown author: Correction: the info which you need :-) Seems that you have mysql version 4 installed.…
Show quoted text 62 lines
On Sun, 15 Jun 2003, James Mills wrote: > On Sat, Jun 14, 2003 at 05:01:38PM +0200, wrote: > > > > > > On Sun, 15 Jun 2003, James Mills wrote: > > > > > On Sat, Jun 14, 2003 at 04:08:38PM +0200, wrote: > > > > > > > > > > > > On Sat, 14 Jun 2003, James Mills wrote: > > > > > > > > > $ fpc testdb > > > > > Free Pascal Compiler version 1.0.6 [2002/08/10] for i386 > > > > > Copyright (c) 1993-2002 by Florian Klaempfl > > > > > Target OS: Linux for i386 > > > > > Compiling testdb.pas > > > > > Assembling qtest > > > > > Linking testdb > > > > > testdb.o(.text+0xaa): In function `program_init': > > > > > : undefined reference to `mysql_connect' > > > > > testdb.pas(84,3) Error: Error while linking > > > > > Closing script ppas.sh > > > > > > > > > > What have I done wrong here ? ... > > > > > Yes I have installed the appropiate libmysqlclient-dev (from debian). > > > > > > > > It is not the correct version of mysql. Please check what the mysql_version > > > > unit reports as a version, and what the version is of the installed mysql. > > > > > > How on earth do I do that :P ? > > > > Simple: > > > > program ver; > > > > uses mysql_version; > > > > begin > > Writeln(MYSQL_SERVER_VERSION); > > end. > > Okay I didn't know such a unit existed :) > > Here's the info you wanted... Correction: the info which you need :-) Seems that you have mysql version 4 installed. The units we distribute standard work with MySQL 3.23. There are units for mysql version 4 as well, but you must compile and install them separately. Get the sources of the packages , and look in packages/base/mysql/mysql4 I warn against using mysql with FPC. Their API changes quite often in incompatible ways, which can be masked with C macros but which cannot be masked with Pascal functions. Try and use firebird instead is my usual advice.

What about sqlite ? Has anyone gotten that to work in any application they've developed.

cheers
James

Show quoted text 7 lines
Michael. _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal
- - James Mills Zero Defect Software Engineers Group - ZDSEG

Reply by email

James Mills
to tuxx: is there an example of how to write an IRC Client with FPC, the isock*.pp examples only…
tuxx wrote
Hello, is there an example of how to write an IRC Client with FPC, the isock*.pp examples only show how to read until i get a "QUIT".

Catch :)

Little irc bot I wrote (very incomplete), do what you will with it :)

cheers
James

Show quoted text 6 lines
thx. _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal
- - James Mills Zero Defect Software Engineers Group - ZDSEG

Reply by email

Peter Vreman
to Alan Mead: Are there known issues with 1.0.6 and it's finding the configuration file? Does it…
you wrote 24 lines
Are there known issues with 1.0.6 and it's finding the configuration file? Does it matter whether I compile using the 'fpc' or 'ppc386' command (they differ on my system): ian]$ more ~amead/fpc.cfg -gl -Co -Cr ian]$ ls -l `which ppc386` lrwxrwxrwx 1 root root 25 May 17 08:49 /usr/bin/ppc386 -> /usr/lib/fpc/1.0.6/ppc386* ian]$ ls -l `which fpc` -rwxr-xr-x 1 root root 78020 May 23 2002 /usr/bin/fpc* ian]$ ls -l /usr/lib/fpc/1.0.6/ppc386 -rwxr-xr-x 1 root root 897844 May 23 2002 /usr/lib/fpc/1.0.6/ppc386* ian]$ rpm -qf /usr/bin/fpc fpc-1.0.6-1 ian]$ rpm -qf /usr/lib/fpc/1.0.6/ppc386 fpc-1.0.6-1 I ask because my programs are not automatically being compiled with the desired options '-Cr -Co -gl'. I can enable range checking in the source file with {$R+}, is there a similar solution for -gl?

/usr/bin/fpc is only a wrapper and does not include any knowledge to compile a file. The only task for it is to call the correct compiler based on the -P setting, when not specified it calls the default compiler. This default compiler can be checked by running

/usr/bin/fpc -PB

The compiler will first try to load ~/.fpc.cfg, when not found it'll look for ~/.ppc386.cfg when not found it looks for /etc/fpc.cfg and finally for /etc/ppc386.cfg

Peter

Reply by email

Unknown author
to James Mills: What about sqlite ? Has anyone gotten that to work in any application they've developed.…
James Mills wrote 66 lines
On Sat, Jun 14, 2003 at 06:30:09PM +0200, wrote: > > > On Sun, 15 Jun 2003, James Mills wrote: > > > On Sat, Jun 14, 2003 at 05:01:38PM +0200, wrote: > > > > > > > > > On Sun, 15 Jun 2003, James Mills wrote: > > > > > > > On Sat, Jun 14, 2003 at 04:08:38PM +0200, wrote: > > > > > > > > > > > > > > > On Sat, 14 Jun 2003, James Mills wrote: > > > > > > > > > > > $ fpc testdb > > > > > > Free Pascal Compiler version 1.0.6 [2002/08/10] for i386 > > > > > > Copyright (c) 1993-2002 by Florian Klaempfl > > > > > > Target OS: Linux for i386 > > > > > > Compiling testdb.pas > > > > > > Assembling qtest > > > > > > Linking testdb > > > > > > testdb.o(.text+0xaa): In function `program_init': > > > > > > : undefined reference to `mysql_connect' > > > > > > testdb.pas(84,3) Error: Error while linking > > > > > > Closing script ppas.sh > > > > > > > > > > > > What have I done wrong here ? ... > > > > > > Yes I have installed the appropiate libmysqlclient-dev (from debian). > > > > > > > > > > It is not the correct version of mysql. Please check what the mysql_version > > > > > unit reports as a version, and what the version is of the installed mysql. > > > > > > > > How on earth do I do that :P ? > > > > > > Simple: > > > > > > program ver; > > > > > > uses mysql_version; > > > > > > begin > > > Writeln(MYSQL_SERVER_VERSION); > > > end. > > > > Okay I didn't know such a unit existed :) > > > > Here's the info you wanted... > > Correction: the info which you need :-) > > Seems that you have mysql version 4 installed. > The units we distribute standard work with MySQL 3.23. > > There are units for mysql version 4 as well, but you must compile and > install them separately. Get the sources of the packages , and look in > packages/base/mysql/mysql4 > > I warn against using mysql with FPC. Their API changes quite often in > incompatible ways, which can be masked with C macros but which cannot > be masked with Pascal functions. > > Try and use firebird instead is my usual advice. What about sqlite ? Has anyone gotten that to work in any application they've developed.

I don't know of any report. But if you want to give it a try, I just converted the C headers for it, I can send them to you.

Michael.

Reply by email

James Mills
to Unknown author
Show quoted text 73 lines
On Sun, 15 Jun 2003, James Mills wrote: > On Sat, Jun 14, 2003 at 06:30:09PM +0200, wrote: > > > > > > On Sun, 15 Jun 2003, James Mills wrote: > > > > > On Sat, Jun 14, 2003 at 05:01:38PM +0200, wrote: > > > > > > > > > > > > On Sun, 15 Jun 2003, James Mills wrote: > > > > > > > > > On Sat, Jun 14, 2003 at 04:08:38PM +0200, wrote: > > > > > > > > > > > > > > > > > > On Sat, 14 Jun 2003, James Mills wrote: > > > > > > > > > > > > > $ fpc testdb > > > > > > > Free Pascal Compiler version 1.0.6 [2002/08/10] for i386 > > > > > > > Copyright (c) 1993-2002 by Florian Klaempfl > > > > > > > Target OS: Linux for i386 > > > > > > > Compiling testdb.pas > > > > > > > Assembling qtest > > > > > > > Linking testdb > > > > > > > testdb.o(.text+0xaa): In function `program_init': > > > > > > > : undefined reference to `mysql_connect' > > > > > > > testdb.pas(84,3) Error: Error while linking > > > > > > > Closing script ppas.sh > > > > > > > > > > > > > > What have I done wrong here ? ... > > > > > > > Yes I have installed the appropiate libmysqlclient-dev (from debian). > > > > > > > > > > > > It is not the correct version of mysql. Please check what the mysql_version > > > > > > unit reports as a version, and what the version is of the installed mysql. > > > > > > > > > > How on earth do I do that :P ? > > > > > > > > Simple: > > > > > > > > program ver; > > > > > > > > uses mysql_version; > > > > > > > > begin > > > > Writeln(MYSQL_SERVER_VERSION); > > > > end. > > > > > > Okay I didn't know such a unit existed :) > > > > > > Here's the info you wanted... > > > > Correction: the info which you need :-) > > > > Seems that you have mysql version 4 installed. > > The units we distribute standard work with MySQL 3.23. > > > > There are units for mysql version 4 as well, but you must compile and > > install them separately. Get the sources of the packages , and look in > > packages/base/mysql/mysql4 > > > > I warn against using mysql with FPC. Their API changes quite often in > > incompatible ways, which can be masked with C macros but which cannot > > be masked with Pascal functions. > > > > Try and use firebird instead is my usual advice. > > What about sqlite ? Has anyone gotten that to work in any application > they've developed. I don't know of any report. But if you want to give it a try, I just converted the C headers for it, I can send them to you.

Please :) I would love them as I have no idea how to convert C headers myself. Need to learn one day...
All I have here is a pascal unit for beos but it either doesn't work, or there's a in sqlite (which I completely doubt). If you want to have a look at that, search for: "sqlite beos pascal" on google.

But yeah, please send them :)

cheers
James

Show quoted text 7 lines
Michael. _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal
- - James Mills Zero Defect Software Engineers Group - ZDSEG

Reply by email

Jonas Maebe
to Alan Mead: Are there known issues with 1.0.6 and it's finding the configuration file? Does it…
Alan Mead wrote
Are there known issues with 1.0.6 and it's finding the configuration file?

There is one problem that sometimes pops up:
<http://www.freepascal.org/faq.html#cfgfiles>.

Does it matter whether I compile using the 'fpc' or 'ppc386' command (they differ on my system):

It shouldn't.

I ask because my programs are not automatically being compiled with the desired options '-Cr -Co -gl'.

Check whether there isn't a (.)ppc386.cfg somewhere left on your system from a previous version.

I can enable range checking in the source file with {$R+}, is there a similar solution for -gl?

No.

Jonas

Reply by email

Eduardo Morras
to Jonas Maebe: There is one problem that sometimes pops up: <http://www.freepascal.org/faq.html#cfgfiles>…
Show quoted text 6 lines
ewhere left on your system from a previous version. >I can enable range checking in >the source file with {$R+}, is there a similar solution for -gl? No.

Just put in the uses clause the unit LineInfo the first one.

Las personas se dividen en tres grupos, los que saben contar y los que no. There are three groups of people, who can count, and who cannot.

Reply by email