Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Need a 'Curl' library for xHarbour

532 views
Skip to first unread message

Mel Smith

unread,
May 1, 2013, 12:23:31 AM5/1/13
to
Hi:

I note that our Harbour group brothers have a library based on the Curl
(Transferring Urls) software. It is called hbcurl.

Would somebody here care to build/provide an xHarbour version of this
library. (I took a look at the instructions for building libcurl.lib for a
C-based system but it overwhelms my meagre talents). A look at the contrib
section in the Harbour repositorymay provide needed clues for someone here.

The web site for the latest version of Curl is: http://curl.haxx.se

Thanks !

--
Mel Smith


Enrico Maria Giordano

unread,
May 1, 2013, 7:47:28 AM5/1/13
to
Mel,

> I note that our Harbour group brothers have a library based on the Curl
> (Transferring Urls) software. It is called hbcurl.

It's in xHarbour's repository too. I don't know why it does not build,
though. Probably a problem in the makefile. We'd need Andi here... :-(

EMG

--
EMAG Software Homepage: http://www.emagsoftware.it
The EMG's ZX-Spectrum Page: http://www.emagsoftware.it/spectrum
The Best of Spectrum Games: http://www.emagsoftware.it/tbosg
The EMG Music page: http://www.emagsoftware.it/emgmusic


dlzc

unread,
May 1, 2013, 9:47:28 AM5/1/13
to
Dear Mel Smith:

On Tuesday, April 30, 2013 9:23:31 PM UTC-7, Mel Smith wrote:
...
> I note that our Harbour group brothers have a
> library based on the Curl (Transferring Urls)
> software. It is called hbcurl.
...
> The web site for the latest version of Curl
> is: http://curl.haxx.se

Also a version here, recently updated:
http://sourceforge.net/projects/curl/?source=directory
... MIT license

David A. Smith

Mel Smith

unread,
May 1, 2013, 10:38:44 AM5/1/13
to
Hi Enrico & David:

Enrico:
I didn't see that we had the package in our contrib folder. I'll take a
further look today.

David:
The main site has version 7.30.0 (April 12, 2013) available for
download.

The sourceforge site has a very slightly older version (April 4/13 ??)

> http://sourceforge.net/projects/curl/?source=directory

Anyway, thank you both. I'll take a look at xHarbour's contrib and see if I
can get it to build ...

-Mel


Mel Smith

unread,
May 1, 2013, 11:18:25 AM5/1/13
to
Enrico said:

> It's in xHarbour's repository too. I don't know why it does not build,
> though. Probably a problem in the makefile. We'd need Andi here... :-(

Hi Enrico:

I just built hbcurl for xharbour.

What we had to do was :

SET HB_DIR_CURL=C:\CURL

then:

make_bc contrib

in order for the build to complete !

Thank you for the impetus to look !

-Mel


cul...@gmail.com

unread,
May 2, 2013, 10:47:45 AM5/2/13
to
Mel

For what you need curl. tipclasses do the same thing of hbcurl

Regards
Luiz

Mel Smith

unread,
May 2, 2013, 11:21:26 AM5/2/13
to
Luiz said:

>
> For what you need curl. tipclasses do the same thing of hbcurl


Hi Luiz:

I got interested in Curl a few months ago, and realized the package was
becoming predominant in its 'copying a URL -- cURL' role.

Because I now have a need to visit a public site and retrieve (and
parse) some 20,000 pages, and because CURL seems to do this almost
instanteously, and because I am now familiar with the curl.exe command line
executable, I thought it would be advantageous to learn and use Curl
library as a part of my proggie.

So, yesterday, I built it, but (sadly) my new test Curl Package did not
link.

Below is the simple test prg that compiled but failed to link. Hope
someone can resolve this probably simple linking error.

Thanks for the comment/suggestion Luiz.

-Mel Smith


*********************************
// Test program for libcurl

#include "hbcurl.ch"
#include "fileio.ch"
#include "common.ch"
#include "simpleio.ch"

FUNCTION MAIN( )
local curl

CLS
? Testing set up of the Curl Library Package"

curl := curl_easy_init() // curl is a handle

if (curl > 0)
? "curl is initialized curl="+ntoc(curl)
// carry on with testing and ..
// do the curl_easy_perform() stuff in here
else
? "curl failed to initialize"
endif

curl_easy_cleanup(curl) // cleans up the handle

? "Press key..."
Inkey( 0 )

RETURN NIL

************************

Here are the first three lines of the linkage error file:
*******************************************
Error: Unresolved external 'WSAIoctl' referenced from
C:\XHARBOUR\LIB\HBCURL.LIB|hbcurl
Error: Unresolved external '_curl_global_init_mem' referenced from
C:\XHARBOUR\LIB\HBCURL.LIB|hbcurl
Error: Unresolved external '_curl_global_cleanup' referenced from
C:\XHARBOUR\LIB\HBCURL.LIB|hbcurl
// many similar errors below.
******************************************



Enrico Maria Giordano

unread,
May 2, 2013, 2:19:06 PM5/2/13
to
Mel,

> Error: Unresolved external 'WSAIoctl' referenced from
> C:\XHARBOUR\LIB\HBCURL.LIB|hbcurl

Try to link Ws2_32.lib.

> Error: Unresolved external '_curl_global_init_mem' referenced from
> C:\XHARBOUR\LIB\HBCURL.LIB|hbcurl
> Error: Unresolved external '_curl_global_cleanup' referenced from
> C:\XHARBOUR\LIB\HBCURL.LIB|hbcurl
> // many similar errors below.

I can't find the definitions of those functions anywhere in the xHarbour
repository, sorry. It seems that the version on curl in the SVN is not
complete. :-(

cul...@gmail.com

unread,
May 2, 2013, 2:39:29 PM5/2/13
to
Mel

did you link curl libraries?

Regards
Luiz

Em quarta-feira, 1 de maio de 2013 01h23min31s UTC-3, Mel Smith escreveu:

Mel Smith

unread,
May 2, 2013, 2:51:03 PM5/2/13
to
Luiz said:
> did you link curl libraries?

Hi Luiz:

Yes, I linked \xharbour\lib\hbcurl.lib

I re-built the ib with BCC 6.6.0 also.

So, now while I'm waiting for an inspiration, I tried following the
instructions from the Curl site to build from source:

e.g.,

c:\curl\>SET BCCDIR=C:\BORLAND\BCC66
c:\curl\>make borland

But, during the compile process, two errors were found regarding
"pollfd"


Here's the last part of the build log:

****************************
.\BCC_objs\cookie.int:
cpp32 -q -P- -5 -O2 -tWM -w -w-aus -w-ccc -w-dup -w-prc -w-pro -w-rch -w-sig
-w-spa -w-inl -w-pia -w-pin -Dinline=__inline -I.;..\include -DNDEBUG -DWIN32
-DBUILDING_LIBCURL -DUSE_WINDOWS_SSPI -DCURL_DISABLE_LDAP -o.\BCC_objs\http.int
.\http.c
.\http.c:
bcc32 -q -c -5 -O2 -tWM -w -w-aus -w-ccc -w-dup -w-prc -w-pro -w-rch -w-sig
-w-spa -w-inl -w-pia -w-pin -Dinline=__inline -o.\BCC_objs\http.obj
.\BCC_objs\http.int
.\BCC_objs\http.int:
Error E2238 .\BCC_objs\http.int 157260: Multiple declaration for 'pollfd'
Error E2344 .\BCC_objs\http.int 118921: Earlier declaration of 'pollfd'
*** 2 errors in Compile ***

** error 2 ** deleting .\BCC_objs\http.obj

** error 1 ** deleting borland
***********************************


Mel Smith

unread,
May 2, 2013, 3:22:12 PM5/2/13
to
Enrico said:
>> Error: Unresolved external 'WSAIoctl' referenced from
>> C:\XHARBOUR\LIB\HBCURL.LIB|hbcurl
>
> Try to link Ws2_32.lib.

Hi Enrico:

I linked that file (i.e.\borland\bcc66\lib\psdk\ws2_32.lib

Result:

This cleaned up the *first* of thos errors only.

THank you.

-Mel


Saulius

unread,
May 4, 2013, 1:56:50 AM5/4/13
to
Hi Mel,

> Yes, I linked \xharbour\lib\hbcurl.lib

You must link at least libcurl library from curl lib directory also.
Curl must be compiled with proper compiler.
Borland is in compilers list, see curl docs.
I am not curl user, so can't help more.

Saulius


Mel Smith

unread,
May 4, 2013, 10:49:33 AM5/4/13
to
Saulius said:

> You must link at least libcurl library from curl lib directory also.
> Curl must be compiled with proper compiler.
> Borland is in compilers list, see curl docs.
> I am not curl user, so can't help more.

Hi Saulius:

Altho I linked hbcurl.lib with my tiny test package, I didn't realize
that the \curl\lib\libcurl.lib library *also* had to be linked. !!

However, because I use BCC 6.5 and BCC 6.6.0, I tried (over the last two
days) to build the libcurl library according to the recipe given by the Curl
people.

They give simple, straightforward instructions in building with Borland
(using BCC55). Because I have all the Borland compilers on my dev machine,
I tried them all. But in all cases, I had two compile faults when compiling
the .c files --> to .int files -- to .obj files. I corrected one of these
faults, but couldn't figure out how to cure the other one. So, in these 26
.c files, two failed to compile, and thus no libraery could be built.

*Then*, I tried building the libcurl package with the MinGW32 compiler
on my system, and the compile/link worked perfectly -- giving me libcurl.lib
(but compiled with the *wrong* compiler :(( )

So, in order to report the Curl failure on the Borland compilers, I now
have to join their mailing list, and submit the bug and wait..

Grrrrr ...

So, in summary, I can't link the libcurl.lib with my test package,
until I can build it with Borland --- but the build with Borland fails.

Puzzle, puzzle ...

But maybe, one of you folks could take a look at the two compile
failures (of approx 26 .c files), and correct them ???

Thanks for the response !

-Mel




Enrico Maria Giordano

unread,
May 4, 2013, 10:59:16 AM5/4/13
to
Mel,

> But maybe, one of you folks could take a look at the two compile
> failures (of approx 26 .c files), and correct them ???

If you send me the two guilty files then I'll try to compile and fix them.

Mel Smith

unread,
May 4, 2013, 12:43:48 PM5/4/13
to
Enrico said:

> If you send me the two guilty files then I'll try to compile and fix them.

Hi Enrico:

The first failure concerns a conflict between two header files:
Borland's winsock2.h and Curl's select.h, and how there are Multiple
declarations of the structure for 'pollfd' in both of these files. The
select.h definition is *different* from the definition in the winsock2.h
file.

The second error doesn't show up until you remove the definition from
select.h (which is a 'killer' because of the difference). But then you get a
second failure in a later compile (vrbl undefined) and I've forgotten the
module now ...

So, I think that downloading the Curl package from www.curl.haxx.se is
the best way to resolve the problem.

I'm getting discouraged now :(

Thanks for offering to help !

-Mel



Enrico Maria Giordano

unread,
May 4, 2013, 1:44:03 PM5/4/13
to
Mel,

> So, I think that downloading the Curl package from www.curl.haxx.se is
> the best way to resolve the problem.

I just downloaded curl-7.30.0.zip. Is it the right package? I don't
understand how to build it... :-(

Mel Smith

unread,
May 4, 2013, 2:36:57 PM5/4/13
to
Enrico said:
> I just downloaded curl-7.30.0.zip. Is it the right package? I don't
> understand how to build it... :-(
>


Enrico:

Yes, it is the correct package.

Here's how *I* built (or tried to build) my curl executable and
libcurl.lib :


1. I made a directory called CURL on my C: Drive (i.e., c:\curl\ )

2. Then I expanded the curl-7.30.0.zip file into this directory

3. Of course, this made a sub-dir called something like curl-7.30.0
....

4. So then I xcopied everyting in this long-names sub-dir to the root
of Curl (I still hate file and sub-dir names longer than 8 characters !)

5. Then, back in to the root of CURL, I did the following:

a. set BCCDIR=c:\borland\bcc66
b. make borland > borland.log
c. // Then examine the borland.log and see the 1st compile
failure.

d. // To clean out this failure and try again simply use,

make borland-clean

Please let me know if I have not given enough information to you

... and *Thank you* for helping !

-Mel



Enrico Maria Giordano

unread,
May 4, 2013, 3:22:00 PM5/4/13
to
Mel,

> Enrico:
>
> Yes, it is the correct package.

Great! :-)

> Here's how *I* built (or tried to build) my curl executable and
> libcurl.lib :
>
>
> 1. I made a directory called CURL on my C: Drive (i.e., c:\curl\ )
>
> 2. Then I expanded the curl-7.30.0.zip file into this directory
>
> 3. Of course, this made a sub-dir called something like curl-7.30.0
> ....
>
> 4. So then I xcopied everyting in this long-names sub-dir to the
> root of Curl (I still hate file and sub-dir names longer than 8 characters
> !)
>
> 5. Then, back in to the root of CURL, I did the following:
>
> a. set BCCDIR=c:\borland\bcc66
> b. make borland > borland.log
> c. // Then examine the borland.log and see the 1st compile
> failure.
>
> d. // To clean out this failure and try again simply use,
>
> make borland-clean
>
> Please let me know if I have not given enough information to you

Your informations are very useful! Now, I get this error:

Error E2451 .\easy.c 201: Undefined symbol 'wcsdup'

Is it the same that you got?

Mel Smith

unread,
May 4, 2013, 3:31:20 PM5/4/13
to
Enrico said:

> Your informations are very useful! Now, I get this error:
>
> Error E2451 .\easy.c 201: Undefined symbol 'wcsdup'
>
> Is it the same that you got?

Hi Enrico:

Yes, but that is the *second* error I got -- *after* changing select.h
and commenting out the pollfd struct

Did you not get the *first* error with pollfd ???

-Mel


Mel Smith

unread,
May 4, 2013, 3:52:20 PM5/4/13
to
I said:
>
> Yes, but that is the *second* error I got -- *after* changing select.h
> and commenting out the pollfd struct
>
> Did you not get the *first* error with pollfd ???


Hi Enrico:

I forgot to mention that, during the build of the BCC package, a new
directory is created under the lib sub-dir

This sub-sub-dir name is: BCC_objs (i.e., c:\curl\lib\BCC_objs\ )

This sub-dir contains all the intermediate c files (i.e., http.int, and
followng that, all the .obj files. Then assumedly, after that, the linking
will take place.)

If you look at the .int files, you'll find each is approx 10meg in size
!

So, when you look at the borland.log you'll see error messages like:
..... http:int 158239 : Multiple declaration for 'pollfd'

The value 158239 is actually the *Line Number* in the intermediate file
where the compiler noticed the error. Then, you can track back to the
actual file that caused the error (in my case select.h and winsock2.h )

What a headache !! (Hope you get to bed tonite sometime. I'm going for
a family party later third afternoon -- so will be out-of-touch in a few
hours).

Thanks again !

-Mel


Enrico Maria Giordano

unread,
May 4, 2013, 4:29:24 PM5/4/13
to
Mel,
No. But I'm using BCC582. Sorry, I don't know how to solve the problem. How
you already pointed out, we probably need to report it to curl developers...
:-(

Mel Smith

unread,
May 4, 2013, 4:52:23 PM5/4/13
to
Enrico said:

>
> No. But I'm using BCC582. Sorry, I don't know how to solve the problem.
> How you already pointed out, we probably need to report it to curl
> developers... :-(


Hi Enrico:

I haven't tried BCC582 yet, but will do so. But, I think, like you do,
that this is a job for the Curl developers.

Thanks for your efforts !

signing off for the day now .

-Mel


Mel Smith

unread,
May 6, 2013, 10:43:16 AM5/6/13
to
I said:
> Hi Enrico:
>
> I haven't tried BCC582 yet, but will do so. But, I think, like you do,
> that this is a job for the Curl developers.
>
> Thanks for your efforts !
>
> signing off for the day now .
>
> -Mel


Hi Enrico:

I registered with the Curl Mailing List, and posted my error. (and now
I'm swamped with emails from other international Curl users about all sort
of questions but *none* relates to our particular problem: compiling with
Borland). But, *this morning*, Daniel Sternberg himself (originator of
Curl) replied to me stating that he was having a problem understanding the
error message that was produced by bcc32, and he didn't understand the 'big
number' in the error message !

So, I re-explained the double include and also noted that the 'big
number' was the line number in the intermediate file (in my case, http.int)

But in the meantime, I am puzzled why *you* don't receive the exact same
error message as I do when running BCC 5.8.2. ?

Apparently, *your* system does not get a doubly-defined pollfd struct
when I *do* get this error ?!? Perhaps *your* BCC58 is different than mine,
or we have different paths, or what ??? Hmmmmm ...

-Mel


Enrico Maria Giordano

unread,
May 6, 2013, 10:50:52 AM5/6/13
to
Mel,

> But in the meantime, I am puzzled why *you* don't receive the exact
> same
> error message as I do when running BCC 5.8.2. ?

Because pollfd is in winsock2.h of BCC660 but not in BCC582.

Mel Smith

unread,
May 6, 2013, 11:14:01 AM5/6/13
to
Enrico said:
> Because pollfd is in winsock2.h of BCC660 but not in BCC582.
>

Hi Enrico:

Thanks for the clarification !

Now, when I look at *my* BCC66, I note that there are *no* .h header
files directly under the ..\include\ sub-dir ???

So, back to puzzling again ...


-Mel


Enrico Maria Giordano

unread,
May 6, 2013, 11:34:50 AM5/6/13
to
Mel,

> Now, when I look at *my* BCC66, I note that there are *no* .h header
> files directly under the ..\include\ sub-dir ???

???

So, how you can use this compiler? It can't work without the .h files.

Mel Smith

unread,
May 6, 2013, 12:00:35 PM5/6/13
to
Enrico said:
>
> So, how you can use this compiler? It can't work without the .h files.

Hi Enrico:

The .h files are 'buried' under several sub-dirs *under* ..\include\

...\include\dinkumware 20 or so .h files
...\include\windows\crtl 114 .h files
...\include\windows\rtl some .h files
...\include\windows\sdf 1462 .h files

So, I have to set up my bcc32.cfg file for these headers: -I"all these
many dirs here"

*and* even if I change to BCC5.8.2 to build libcurl, I forgot that my
'Path' still points to BCC66 !!

So, when building curl, I also have to set my path exclusively to BCC58
*first*. (I have *all* the Borland compilers on my system and in the
path --- BCC66 first)

Then, I get the 'wcsdup' undefined symbol --- same as your !

Thanks,

-Mel


0 new messages