Sockets, Threads, xHarbour and Linux

User avatar
xProgrammer
Posts: 464
Joined: Tue May 16, 2006 7:47 am
Location: Australia

Sockets, Threads, xHarbour and Linux

Post 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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post 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 :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Doug,

These are the examples provided with xharbour:

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

Antonio Linares
www.fivetechsoft.com
User avatar
xProgrammer
Posts: 464
Joined: Tue May 16, 2006 7:47 am
Location: Australia

Post 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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Doug,

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

checkout.sh

Code: Select all

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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post 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
Last edited by Antonio Linares on Wed Aug 06, 2008 12:53 pm, edited 1 time in total.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post 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
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
xProgrammer
Posts: 464
Joined: Tue May 16, 2006 7:47 am
Location: Australia

Didn't quite work

Post 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

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

Regards

Doug
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

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

Antonio Linares
www.fivetechsoft.com
User avatar
xProgrammer
Posts: 464
Joined: Tue May 16, 2006 7:47 am
Location: Australia

Post 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)
User avatar
xProgrammer
Posts: 464
Joined: Tue May 16, 2006 7:47 am
Location: Australia

Post by xProgrammer »

Hi Antonio

This is from one of your early posts on this forum

Code: Select all

sudo apt-get install unixODBC-dev
Is that it?
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Doug,

yes, thats it. Thanks! :-)

Also we may need unixodbc too.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
xProgrammer
Posts: 464
Joined: Tue May 16, 2006 7:47 am
Location: Australia

Some Progress

Post 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

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)
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Doug,

fnmatch.h needs to be available:

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

Antonio Linares
www.fivetechsoft.com
User avatar
xProgrammer
Posts: 464
Joined: Tue May 16, 2006 7:47 am
Location: Australia

Only possibly slight progress

Post 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
Post Reply