FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveLinux / FiveDroid (Android) Sockets, Threads, xHarbour and Linux
Posts: 464
Joined: Tue May 16, 2006 07:47 AM
Sockets, Threads, xHarbour and Linux
Posted: Wed Aug 06, 2008 10:12 AM

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

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Sockets, Threads, xHarbour and Linux
Posted: Wed Aug 06, 2008 11:16 AM

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 :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Sockets, Threads, xHarbour and Linux
Posted: Wed Aug 06, 2008 11:20 AM

Doug,

These are the examples provided with xharbour:

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

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 464
Joined: Tue May 16, 2006 07:47 AM
Sockets, Threads, xHarbour and Linux
Posted: Wed Aug 06, 2008 11:46 AM

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

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Sockets, Threads, xHarbour and Linux
Posted: Wed Aug 06, 2008 12:22 PM
Doug,

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

checkout.sh
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
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Sockets, Threads, xHarbour and Linux
Posted: Wed Aug 06, 2008 12:49 PM

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

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Sockets, Threads, xHarbour and Linux
Posted: Wed Aug 06, 2008 12:51 PM

Doug,

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

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

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 464
Joined: Tue May 16, 2006 07:47 AM
Didn't quite work
Posted: Thu Aug 07, 2008 03:29 AM
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:

/usr/bin/ld: cannot find -lrtl
collect2: ld returned 1 exit status


Any suggestions?

Regards

Doug
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Sockets, Threads, xHarbour and Linux
Posted: Thu Aug 07, 2008 09:54 AM

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.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 464
Joined: Tue May 16, 2006 07:47 AM
Sockets, Threads, xHarbour and Linux
Posted: Thu Aug 07, 2008 01:37 PM

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)

Posts: 464
Joined: Tue May 16, 2006 07:47 AM
Sockets, Threads, xHarbour and Linux
Posted: Thu Aug 07, 2008 01:43 PM
Hi Antonio

This is from one of your early posts on this forum

sudo apt-get install unixODBC-dev


Is that it?
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Sockets, Threads, xHarbour and Linux
Posted: Thu Aug 07, 2008 04:49 PM

Doug,

yes, thats it. Thanks! :-)

Also we may need unixodbc too.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 464
Joined: Tue May 16, 2006 07:47 AM
Some Progress
Posted: Fri Aug 08, 2008 12:08 AM
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:
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)
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Sockets, Threads, xHarbour and Linux
Posted: Fri Aug 08, 2008 06:19 AM

Doug,

fnmatch.h needs to be available:

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

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 464
Joined: Tue May 16, 2006 07:47 AM
Only possibly slight progress
Posted: Sat Aug 09, 2008 08:02 AM

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