Page 1 of 2

Sockets, Threads, xHarbour and Linux

PostPosted: Wed Aug 06, 2008 10:12 am
by xProgrammer
Hi all

I wanted to do some socket programming and was glad to see that the INet....() functions appear to be implemented in the Linux version of xHarbour. I tried to start with the examples given under the INetServer() function in the xHarbour documentation but note that StartThread() and WaitForThreads() are either not implemented or are in some library that I'm not linking or whatever.

Can anyone tell me how to manage threads under Linux with xHarbour?

Thanks

xProgrammer

PostPosted: Wed Aug 06, 2008 11:16 am
by Antonio Linares
Doug,

You need a more recent xHarbour build. You can build it yourself from the xHarbour CVS or we can build it here and send it to you :-)

PostPosted: Wed Aug 06, 2008 11:20 am
by Antonio Linares
Doug,

These are the examples provided with xharbour:

http://www.mediafire.com/?sharekey=395f ... c67cfa0fb8

PostPosted: Wed Aug 06, 2008 11:46 am
by xProgrammer
Hi Antonio

Thanks for the prompt replies.

The mediafire link comes up (briefly) with a message that these are private files and won't let me access them.

Whilst I must learn one day to build xHarbour from the CVS, getting one built by you sounds good and guarantees compatability.

Thanks

Doug

PostPosted: Wed Aug 06, 2008 12:22 pm
by Antonio Linares
Doug,

First of all you need to create a checkout.sh file with these contents:

checkout.sh
Code: Select all  Expand view
cvs -d:pserver:anonymous@xharbour.cvs.sourceforge.net:/cvsroot/xharbour login

cvs -z3 -d:pserver:anonymous@xharbour.cvs.sourceforge.net:/cvsroot/xharbour co -P xharbour

Give it execution permissions: chmod +x ./checkout.sh

Then simply do: ./checkout.sh
xHarbour will start downloading to your computer, in the same folder where checkout.sh is

You may need to install CVS: sudo apt-get install cvs

PostPosted: Wed Aug 06, 2008 12:49 pm
by Antonio Linares
Doug,

Once you have done the checkout, go to the created folder xharbour and change permissions of make_gnu.sh:

chmod +x ./make_gnu.sh

then simply do:

./make_gnu.sh

BTW, you need to have bison installed:
sudo apt-get install bison

PostPosted: Wed Aug 06, 2008 12:51 pm
by Antonio Linares
Doug,

In the meantime, here you have again the thread examples, this time using rapidshare:

http://rapidshare.com/files/135266411/examples.zip.html

Didn't quite work

PostPosted: Thu Aug 07, 2008 3:29 am
by xProgrammer
Hi Antonio

installed cvs
installed bison
created checkout.sh
it seemed to run fine
ran make_gnu.sh
Lots happened but got a series of errors with messge:

Code: Select all  Expand view
/usr/bin/ld: cannot find -lrtl
collect2: ld returned 1 exit status


Any suggestions?

Regards

Doug

PostPosted: Thu Aug 07, 2008 9:54 am
by Antonio Linares
Doug,

The problem comes from odbc.c as it uses some header files that are not available, so as odbc.o is part of the rtl library, then it can't get built.

I remember that we had to install a package to get odbc support for Linux, but I have been looking in these forums and can't find it.

PostPosted: Thu Aug 07, 2008 1:37 pm
by xProgrammer
Hi Antonio

I can remember a reference to that package somewhere - I think in this forum. I will try to find it.

Thanks

Doug
(xProgrammer)

PostPosted: Thu Aug 07, 2008 1:43 pm
by xProgrammer
Hi Antonio

This is from one of your early posts on this forum

Code: Select all  Expand view
sudo apt-get install unixODBC-dev


Is that it?

PostPosted: Thu Aug 07, 2008 4:49 pm
by Antonio Linares
Doug,

yes, thats it. Thanks! :-)

Also we may need unixodbc too.

Some Progress

PostPosted: Fri Aug 08, 2008 12:08 am
by xProgrammer
Hi Antonio

I made some progress.

Installed unicODBC-dev. That automatically installed unixodbc also (amongst other things)

Reran make_gnu.sh but it falls over when in xharbour/source/rtl/linux/gcc and it tries to compile (gcc) strmatch.c with the following output:
Code: Select all  Expand view
In file included from ../../strmatch.c:55:
../../../../include/hbapi.h:330: Warning: type qualifier ignored on function return type
../../strmatch.c: In function 'hb_strMatchFile':
../../strmatch.c:354 warning: implicit declaration of function 'fnmatch'
../../strmatch.c:354 error 'FNM_PERIOD' undeclared (first use in this function)
../../strmatch.c:354 error 'FNM_PATHNAME' undeclared (first use in this function)
make[3] *** [strmatch.o] Error 1


So something is still not quite right

Thanks

Doug
(xProgrammer)

PostPosted: Fri Aug 08, 2008 6:19 am
by Antonio Linares
Doug,

fnmatch.h needs to be available:

http://www.koders.com/c/fid090AE42BE655 ... 3F987.aspx

Only possibly slight progress

PostPosted: Sat Aug 09, 2008 8:02 am
by xProgrammer
Hi Antonio
downloaded fnmatch.h but didn't fix problem.

added #include "fnmatch.h" to strmatch.c

mak_gnu.sh falls over having entered utils/hbrun.

Regards

Doug