Good day everyone
And thank you in advance for reading this!
So, here is the thing:
I have a very old Kylix Project, which used to run on a pure 32-bit (Suse) Linux.
The project uses the class/component "TSQLConnection" from the "SqlExpr" unit, to connect to a very old MySQL 3 (not exactly sure about the minor version).
The goal is to keep the code as compatible as possible and it should be converted/ported to Lazarus and be able to connect to a MySQL 3.
Besides all of this, the project runs in its own isolated 32bit Linux environment (with it's own 32bit libs) via chroot in an overlayed multiarch Linux, where Lazarus/FPC is installed and used for porting.
I have found, that FPC offers a unit "mysql3", which I would like to use (and need?).
So I decided to implement the unit and started compiling a test project for i386 on the overlaying Linux machine.
(The cross-compiler settings, etc. has been configured and installed by fpcupdeluxe)
The first (linker) error was, that the "mysqlclient" library was missing.
/usr/bin/i586-suse-linux-ld: cannot find -lmysqlclient
After some research, I found that I can add some paths with the "-Fl" parameter and added the paths below.
In the chroot directory (where the old project resides and links to it's own libraries), I could find some mysqlclient libraries:
(THIS IS WITHIN THE CHROOT DIRECTORY)
SuSE8:/ # find -name libmysqlclient*
./usr/lib/libmysqlclient.so.10
./usr/lib/libmysqlclient.so.7.0.0
./usr/lib/libmysqlclient.so.10.0.0
./usr/lib/libmysqlclient.so.7
./usr/lib/mysql/libmysqlclient.so.10
./usr/lib/mysql/libmysqlclient.a
./usr/lib/mysql/libmysqlclient.so.10.0.0
./usr/lib/mysql/libmysqlclient.so
./usr/lib/mysql/libmysqlclient.la
SuSE8:/ # find -name libsqlmy*
./usr/local/lib/libsqlmy.so
./usr/local/lib/libsqlmy23.so
./usr/local/lib/k3/libsqlmy.so
./usr/local/lib/k3/libsqlmy23.so
./usr/local/lib/k3/libsqlmy23.so.1.0
./usr/local/lib/libsqlmy23.so.1.0
./usr/local/lib/k1/libsqlmy.so.1
./usr/local/lib/k1/libsqlmy.so.1.0
After adding these paths to the "-Fl" parameter, I get another linker error:
Debug: /usr/bin/i586-suse-linux-ld: /chroot_directory/usr/lib/mysql//libmysqlclient.so: undefined reference to `errno@GLIBC_2.0'
The old Kylix Project has code like this:
SQLConn.VendorLib := 'libmysqlclient.so.10.0.0';
SQLConn.LibraryName := 'libsqlmy.so';
SQLConn.ConnectionName := 'MySqlConnection';
SQLConn.DriverName := 'MYSQL';
SQLConn.GetDriverFunc := 'getSQLDriverMYSQL';
SQLConn.Params.Add ( 'DriverName=MYSQL' );
SQLConn.Params.Add ( 'BlobSize=-1' );
SQLConn.Params.Add ( 'Database=' + db_str );
So now my question is: How can I proceed the linking? And will my built Lazarus Application work within the chroot directory with these old libs and successfully connect to a MySQL 3 database?
I would like to avoid upgrading the database, the libraries and so fort and keep it as original as possible.
Thank you so much for your help in advance!
If you need any further information, please let me know.