Sockets, Threads, xHarbour and Linux

Sockets, Threads, xHarbour and Linux

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

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

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

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

Postby Antonio Linares » Wed Aug 06, 2008 12:22 pm

Doug,

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

checkout.sh
Code: Select all  Expand view  RUN
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: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Antonio Linares » 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
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: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

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

Didn't quite work

Postby xProgrammer » Thu Aug 07, 2008 3: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:

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


Any suggestions?

Regards

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

Postby Antonio Linares » Thu Aug 07, 2008 9: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby xProgrammer » Thu Aug 07, 2008 1: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)
User avatar
xProgrammer
 
Posts: 464
Joined: Tue May 16, 2006 7:47 am
Location: Australia

Postby xProgrammer » Thu Aug 07, 2008 1:43 pm

Hi Antonio

This is from one of your early posts on this forum

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


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

Postby Antonio Linares » Thu Aug 07, 2008 4:49 pm

Doug,

yes, thats it. Thanks! :-)

Also we may need unixodbc too.
regards, saludos

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

Some Progress

Postby xProgrammer » 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:
Code: Select all  Expand view  RUN
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
xProgrammer
 
Posts: 464
Joined: Tue May 16, 2006 7:47 am
Location: Australia

Postby Antonio Linares » Fri Aug 08, 2008 6:19 am

Doug,

fnmatch.h needs to be available:

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

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

Only possibly slight progress

Postby xProgrammer » Sat Aug 09, 2008 8: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
User avatar
xProgrammer
 
Posts: 464
Joined: Tue May 16, 2006 7:47 am
Location: Australia

Next

Return to FiveLinux / FiveDroid (Android)

Who is online

Users browsing this forum: No registered users and 1 guest