Topic: linux ;)

hey ya GMan,

n e plans to launch a linux version of the mod?
i have got it to compile on linux by removing the #include <winsock.h> because as far as i can see its not used.  however if i compile a program using the module i get:

Building main
Compiling:main.bmx
flat assembler  version 1.64
3 passes, 9315 bytes.
Linking:main
/home/gavin/bin/BlitzMax/mod/pub.mod/mysql.mod/mysql.release.linux.a(mysql.cpp.release.linux.o)(.text+0x57): In function `bmx_mysql_field_name':
mysql.cpp: undefined reference to `mysql_fetch_field_direct'
/home/gavin/bin/BlitzMax/mod/pub.mod/mysql.mod/mysql.release.linux.a(mysql.cpp.release.linux.o)(.text+0x93): In function `bmx_mysql_insert_id':
mysql.cpp: undefined reference to `mysql_insert_id'
/home/gavin/bin/BlitzMax/mod/pub.mod/mysql.mod/mysql.release.linux.a(mysql.cpp.release.linux.o)(.text+0xab): In function `bmx_mysql_eof':
mysql.cpp: undefined reference to `mysql_eof'
/home/gavin/bin/BlitzMax/mod/pub.mod/mysql.mod/mysql.release.linux.a(mysql.cpp.release.linux.o)(.text+0x105): In function `bmx_mysql_field_length':
mysql.cpp: undefined reference to `mysql_fetch_lengths'
/home/gavin/bin/BlitzMax/mod/pub.mod/mysql.mod/mysql.release.linux.a(mysql.cpp.release.linux.o)(.text+0x136): In function `bmx_mysql_num_rows':
mysql.cpp: undefined reference to `mysql_num_rows'
/home/gavin/bin/BlitzMax/mod/pub.mod/mysql.mod/mysql.release.linux.a(mysql.cpp.release.linux.o)(.text+0x14a): In function `bmx_mysql_affected_rows':
mysql.cpp: undefined reference to `mysql_affected_rows'
/home/gavin/bin/BlitzMax/mod/pub.mod/mysql.mod/mysql.release.linux.a(mysql.cpp.release.linux.o)(.text+0x164): In function `bmx_mysql_real_query':
mysql.cpp: undefined reference to `mysql_real_query'
/home/gavin/bin/BlitzMax/mod/pub.mod/mysql.mod/mysql.release.linux.a(mysql.cpp.release.linux.o)(.text+0x187): In function `bmx_mysql_select_db':
mysql.cpp: undefined reference to `mysql_select_db'
/home/gavin/bin/BlitzMax/mod/pub.mod/mysql.mod/mysql.release.linux.a(mysql.cpp.release.linux.o)(.text+0x1bc): In function `bmx_mysql_real_connect':
mysql.cpp: undefined reference to `mysql_real_connect'
/home/gavin/bin/BlitzMax/mod/pub.mod/mysql.mod/mysql.release.linux.a(mysql.cpp.release.linux.o)(.text+0x216): In function `bmx_mysql_init':
mysql.cpp: undefined reference to `mysql_init'
/home/gavin/bin/BlitzMax/mod/pub.mod/mysql.mod/mysql.release.linux.a(mysql.cpp.release.linux.o)(.text+0x3c): In function `bmx_mysql_real_escape_string':
mysql.cpp: undefined reference to `mysql_real_escape_string'
/home/gavin/bin/BlitzMax/mod/pub.mod/mysql.mod/mysql.release.linux.a(mysql.cpp.release.linux.o)(.text+0x6c): In function `bmx_mysql_data_seek':
mysql.cpp: undefined reference to `mysql_data_seek'
/home/gavin/bin/BlitzMax/mod/pub.mod/mysql.mod/mysql.release.linux.a(mysql.cpp.release.linux.o)(.text+0x7e): In function `bmx_mysql_free_result':
mysql.cpp: undefined reference to `mysql_free_result'
/home/gavin/bin/BlitzMax/mod/pub.mod/mysql.mod/mysql.release.linux.a(mysql.cpp.release.linux.o)(.text+0xc6): In function `bmx_mysql_fetch_row':
mysql.cpp: undefined reference to `mysql_fetch_row'
/home/gavin/bin/BlitzMax/mod/pub.mod/mysql.mod/mysql.release.linux.a(mysql.cpp.release.linux.o)(.text+0xda): In function `bmx_mysql_use_result':
mysql.cpp: undefined reference to `mysql_use_result'
/home/gavin/bin/BlitzMax/mod/pub.mod/mysql.mod/mysql.release.linux.a(mysql.cpp.release.linux.o)(.text+0xee): In function `bmx_mysql_store_result':
mysql.cpp: undefined reference to `mysql_store_result'
/home/gavin/bin/BlitzMax/mod/pub.mod/mysql.mod/mysql.release.linux.a(mysql.cpp.release.linux.o)(.text+0x11e): In function `bmx_mysql_num_fields':
mysql.cpp: undefined reference to `mysql_num_fields'
/home/gavin/bin/BlitzMax/mod/pub.mod/mysql.mod/mysql.release.linux.a(mysql.cpp.release.linux.o)(.text+0x1dc): In function `bmx_mysql_error':
mysql.cpp: undefined reference to `mysql_error'
/home/gavin/bin/BlitzMax/mod/pub.mod/mysql.mod/mysql.release.linux.a(mysql.cpp.release.linux.o)(.text+0x1f4): In function `bmx_mysql_errno':
mysql.cpp: undefined reference to `mysql_errno'
/home/gavin/bin/BlitzMax/mod/pub.mod/mysql.mod/mysql.release.linux.a(mysql.cpp.release.linux.o)(.text+0x20a): In function `bmx_mysql_close':
mysql.cpp: undefined reference to `mysql_close'
collect2: ld returned 1 exit status
Build Error: Failed to link /home/gavin/Desktop/game/main
Process complete

i have moved the lib file to the right location as well

Re: linux ;)

greetings gavinb smile  welcome the board!  you are correct in that winsock.h is not required for linux.  it was actually something i had to add in to get it to work on windows.  now, it appears that its either not finding or not liking the libmySQL.a file for linux.  which linux distribution did you download?  where did you locate the .a file?

i dont currently have a linux machine but i will try to help you best i can.

Re: linux ;)

hey ya, the linux distro is Suse 9.3 and the .a file is the one u included in the archive big_smile

Re: linux ;)

gavinb wrote:

the .a file is the one u included in the archive big_smile

that is probably the issue then.  i dont remember including it but that is the windows .a file.  sorry about that sad  you will need a linux one.  i havent tried downloading any of the linux distros yet, but one of them should have the .a needed in it.

Re: linux ;)

dude, havin so much trouble gettin a libmysql.a for linux, turning to the mysql forums wink

Re: linux ;)

hmmm.  i may have to bump up priority on getting together a linux box...

Re: linux ;)

Welll dont worry too much, its just the .a file i think :S then its sorted. then u can stick it on here as a linux pkg wink

Re: linux ;)

i just saw the elive topic under the Linux forum on blitzmax.com.  im going to give it a whirl.  that will let me use my existing machine and not mess anything up.  tried puppy, but this one is confirmed working.  ill let ya know.

Re: linux ;)

hmm...where is it u link to the libmysql.a?

Re: linux ;)

managed to get it down to this:

Building main
Compiling:main.bmx
flat assembler  version 1.64
4 passes, 19935 bytes.
Linking:main.debug
/usr/lib/libmySQL.a(my_compress.o)(.text+0x66): In function `my_uncompress':
: undefined reference to `uncompress'
/usr/lib/libmySQL.a(my_compress.o)(.text+0x11c): In function `my_compress_alloc':
: undefined reference to `compress'
collect2: ld returned 1 exit status
Build Error: Failed to link /home/gavin/Desktop/game/main.debug
Process complete

Re: linux ;)

those almost look like ZLib functions.  try adding this right above the Import "-lmySQL" statement:

?Linux
Import Pub.ZLib
?

so the end result would look like:

Import Pub.ISQLDB
Import BRL.Blitz

?Linux
Import Pub.ZLib
?
Import "-lmySQL"
Import "mysql.cpp"

if that doesnt work, try:

Import Pub.ISQLDB
Import BRL.Blitz

?Linux
Import "-lz"
?
Import "-lmySQL"
Import "mysql.cpp"

Re: linux ;)

Import Pub.ISQLDB
Import BRL.Blitz

?Linux
Import "-lz"
?
Import "-lmySQL"
Import "mysql.cpp"

gets rid of errors, now it works A.OK, thanks dude

Re: linux ;)

*UPDATE - it works better under linux than Windows ....lol, coz there are a few steps to it not just whats mentioned in this thread i'll write summin up tomrrow and post it for you to do as u wish

Re: linux ;)

glad you got it working! 

gavinb wrote:

coz there are a few steps to it not just whats mentioned in this thread i'll write summin up tomrrow and post it for you to do as u wish

that would be very much appreciated thank you smile

Re: linux ;)

Right well firstly once you got the std. blitzmax install working, download the ISQLDB and mysql modules.
goto rpm.pbone.net and click the advanced serach option, search for mysql-devel and tick the box for your linux distro. download/install the mysql devel package that you want. in mycase it was mysql-devel-4.1.1.a.rpm
laucnh a console and use 'su' to change to root. then 'cd /usr/lib/mysql' us 'ls' to see a list of files. int he list should be libmysqlclient.a in the console type 'cp libmysqlclient.a ../libmySQL.a' and make sure you keep the right case for the letters.

next you'll need to edit mysql.cpp in the mysql.mod folder and comment out the #include <winsock.h> and save the file.

next edit the mysql.bmx in the same directory and add:

?Linux
Import "-lz"
?

just above:

Import "-lmySQL"
Import "mysql.cpp"

then save the file and compile modules.  those are all the steps i took and it works fine

Re: linux ;)

excellent thank you.  when i free up some time i will add your instructions to the install.txt and merge in the Linux particular code.

Re: linux ;)

smile
great, thanks for the great module again, it is certainly helpw ith creating my game.  not to mention other software

Re: linux ;)

Hi guys,

First I would like to thank gman for his great work on this module - this is really helpful!

I have not yet looked thoroughly at the module for PostgreSQL (but will do it this weekend). However, I have the same problem as gavinb with _compress and _uncompress - but on Mac OS X (Intel), and importing ZLib does not fix it.

Do you have any suggestions what to do about it?

Thanks and greetings from Germany,
Winni

Re: linux ;)

greetings Winni smile  i have a mac mini so i will try to look at this something in the next few days.  sorry i cant be faster, but i have a busy weekend ahead.

Re: linux ;)

Years later. In the 21st century. This are the voyages of the starship Macintosh...

I found it:

Import "-L/usr/local/mysql/lib -lmysqlclient -lz -lsystemstubs"
Import "mysql.cpp"

This will compile and link on a PowerPC Mac with MySQL 5.0.24. smile

The only problem: It does not seem to work anyhow.


I tried this to connect to a local MySQL server:

Local conn:ISQLDB=SetISQLDBDriver(GetMySQLDBDriver(True,"localhost","root","","mysql"))
Local result:ISQLResult=conn.execute("SELECT * FROM db")

But result is null, even though this should return something.

Maybe I will find an answer to that as well. For today, I´m tired enough. ;-)

Greetz,
Winni