hb_curl library not found

684 views
Skip to first unread message

Antonio Cardinaux

unread,
Oct 30, 2024, 8:43:24 AM10/30/24
to Harbour Users
Good morning, in a module I have the following line: oCurl := hb_CurlEasy() but when I finish compiling it gives me the following: Error: referenced function(s), not found, but unknown hb_curleasy, hb_curleasysetopt, hb_curleasyperform, hb_curleasycleanup The hbp file has these lines: hbziparc.hbc hbct.hbc gtwvg.hbc hbmisc.hbc hbwin.hbc hbmemio.hbc hbhpdf.hbc hbzebra.hbc hbnf.hbc xhb.hbc -n -w0 -es0 -inc -static -info -std -gtwvg -gui What library could be missing?

Angel Pais

unread,
Oct 30, 2024, 9:00:37 AM10/30/24
to harbou...@googlegroups.com
curl

El mié, 30 oct 2024 a las 9:43, Antonio Cardinaux (<ancar...@gmail.com>) escribió:
Good morning, in a module I have the following line: oCurl := hb_CurlEasy() but when I finish compiling it gives me the following: Error: referenced function(s), not found, but unknown hb_curleasy, hb_curleasysetopt, hb_curleasyperform, hb_curleasycleanup The hbp file has these lines: hbziparc.hbc hbct.hbc gtwvg.hbc hbmisc.hbc hbwin.hbc hbmemio.hbc hbhpdf.hbc hbzebra.hbc hbnf.hbc xhb.hbc -n -w0 -es0 -inc -static -info -std -gtwvg -gui What library could be missing?

--
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
Unsubscribe: harbour-user...@googlegroups.com
Web: https://groups.google.com/group/harbour-users
---
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to harbour-user...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/harbour-users/72886937-2f1a-46a1-a359-f6d242de40d0n%40googlegroups.com.

Gerald Drouillard

unread,
Oct 30, 2024, 9:13:18 AM10/30/24
to harbou...@googlegroups.com
Your compling of harbour did not create the hb_curl... library or the path to it is not in your link script

On Wed, Oct 30, 2024 at 8:43 AM Antonio Cardinaux <ancar...@gmail.com> wrote:
Good morning, in a module I have the following line: oCurl := hb_CurlEasy() but when I finish compiling it gives me the following: Error: referenced function(s), not found, but unknown hb_curleasy, hb_curleasysetopt, hb_curleasyperform, hb_curleasycleanup The hbp file has these lines: hbziparc.hbc hbct.hbc gtwvg.hbc hbmisc.hbc hbwin.hbc hbmemio.hbc hbhpdf.hbc hbzebra.hbc hbnf.hbc xhb.hbc -n -w0 -es0 -inc -static -info -std -gtwvg -gui What library could be missing?

--

Antonio Cardinaux

unread,
Oct 30, 2024, 1:21:35 PM10/30/24
to Harbour Users
But there is no specific library for what is missing? Because with harbor I do not create any library, I only compile the prgs and in the first lines of the hbp file, I put the calls to the libraries that I usually use, that is why I ask what library could be missing?
Message has been deleted

pete....@gmail.com

unread,
Oct 31, 2024, 2:49:04 AM10/31/24
to Harbour Users
Error: referenced function(s), not found, but unknown hb_curleasy, hb_curleasysetopt, hb_curleasyperform, hb_curleasycleanup The hbp file has these lines:


Good morning,
The above error message emitted by compiler is quite clear: it says that the mentioned functions are unknown,
which is true since harbour has no such function family (and  compilers usually do not lie...;-))
Anyhow, their naming suggests that they belong to some 3rd part library that provide wrappers for cURL
Harbour 3.2 (and later fork-versions) include such a contrib library named hbcurl 
and your problem could be easily resolved by adding the line hbcurl.hbc into your .hbp project file,
but this won't help, since the names of those functions are different (although similar). 
If you want to get a list of our hbcurl functions, type in command line: hbmk2 -find curl
(provided that harbour binaries folder is in path).

It seems either you use a harbour variant other than official or you are missing the library of those unknown functions
so you have to somehow find it  and add it in your .hbp file
OR do the highly recommended move and install a current Harbour package and properly adapt your code,
(of course, in that case you need to add the aforementioned line hbcurl.hbc into .hbp file).

PS. please, use a smaller font size in your messages to improve their readability.

regards,
Pete

Message has been deleted

Antonio Cardinaux

unread,
Nov 1, 2024, 9:41:55 AM11/1/24
to Harbour Users
Hello, change hb_curl to curl, this is the function:

function urlLoad(cUrl)

   local hCurl, nRet
   
   if !Empty( hCurl := curl_easy_init() )
      curl_easy_setopt( hCurl, HB_CURLOPT_DOWNLOAD )
      curl_easy_setopt(hCurl, HB_CURLOPT_URL, cUrl)      
      curl_easy_setopt( hCurl, HB_CURLOPT_SSL_VERIFYPEER, .F. )
      curl_easy_setopt( hCurl, HB_CURLOPT_SSL_VERIFYHOST, .F. )
      curl_easy_setopt( hCurl, HB_CURLOPT_FOLLOWLOCATION )
      curl_easy_setopt( hCurl, HB_CURLOPT_FILETIME, 1 )
      curl_easy_setopt( hCurl, HB_CURLOPT_DL_FILE_SETUP, SubStr( cUrl, RAt( "/", cUrl ) + 1 ) )
      curl_easy_setopt( hCurl, HB_CURLOPT_NOPROGRESS, .F. )
      curl_easy_setopt( hCurl, HB_CURLOPT_VERBOSE, .F. )    
      curl_easy_setopt(hCurl, HB_CURLOPT_FAILONERROR, .T.)
       
      nRet = curl_easy_perform( hCurl )
      curl_easy_cleanup( hCurl )
   endif    
     
return nRet

but when I finish compiling it gives me the following error:

can't find -llibcurl

The following hbp file has the lines:


hbziparc.hbc
hbct.hbc
gtwvg.hbc
hbmisc.hbc
hbwin.hbc
hbmemio.hbc
hbhpdf.hbc
hbzebra.hbc
hbnf.hbc
hbcurl.hbc
xhb.hbc

eruj...@gmail.com

unread,
Nov 1, 2024, 10:36:44 AM11/1/24
to harbou...@googlegroups.com

I had the same problem.

 

I downoladed curl-win32-latest.zip from CURL website https://curl.se/download.html, for Windows: https://curl.se/windows/ and copied libcurl.a and libcurl.dll.a to my LIB folder. The program then compiles normaly. For execution I had to copy also libcurl.dll to folder where program is compiled.

 

I don't know how to embed libcurl.dll in exe file, so that I don't have to copy it always to folder where exe file is.

 

Regards, Jure

 

libcurl.a and libcurl.dll.a in LIB folder

 

Libcurl.dll in BIN folder

 

Regards, Jure 

 

Poslano iz programa Pošta za Windows

Antonio Cardinaux

unread,
Nov 4, 2024, 7:39:48 AM11/4/24
to Harbour Users
The issue is that in my case I use the nightly version of harbor

https://sourceforge.net/projects/harbour-project/files/binaries-windows/nightly/harbour-nightly-win.exe/download

in the folder

hb32/lib/win/mingw

The libraries in that folder all start with libhb....

So I don't know if those libraries are useful to solve that problem, since it would be necessary to know how the hbp file would be set to take those new
libraries.

pete....@gmail.com

unread,
Nov 4, 2024, 11:32:00 AM11/4/24
to Harbour Users
On Monday 4 November 2024 at 14:39:48 UTC+2 Antonio Cardinaux wrote:
The issue is that in my case I use the nightly version of harbor
https://sourceforge.net/projects/harbour-project/files/binaries-windows/nightly/harbour-nightly-win.exe/download
That's okay!

in the folder
hb32/lib/win/mingw
also this one...

 The libraries in that folder all start with libhb....
So I don't know if those libraries are useful to solve that problem, since it would be necessary to know how the hbp file would be set to take those new
libraries.

All libraries found into /lib/win/mingw  are prefixed with `lib`.
It's a mingw naming convention which supposedly let people to know
that the file in question is a library file. I guess it's a linux "inheritance", 
becausein windows, for that purpose, we have the file extensions
(which is a much more efficient notation, IMHO).
To make things  a little more (and unnecessarily) complicated the linker (mingw toolset)
is designed to add this `lib` prefix  in any given library name,  which means
that YOU should remove the prefix from the name of the library in your make file!
For example: if you want to include `libhbcurl.a`  into your .hbp make file
you type: -lhbcurl  (-l is the switch for libraries).
Happily, harbour offers  a better way! For any contrib library you want to use, 
it's enough to type into .hbp the relevant contrib .hbc configuration file.
So, for cURL libraries set, you just have to  type `hbcurl.hbc` and you're done; everything 
that's needed to be linked to get curl functionality, it is included in that hbcurl.hbc
Hope the above helps to clarify some things.

regards,
Pete

Antonio Cardinaux

unread,
Nov 5, 2024, 8:49:01 AM11/5/24
to Harbour Users
Well, adding the hbcurl.hbc file to the hbp file, everything seems to work, I had to add the libcurl.dll file to the executable folder and there it was.
I tried with the example I had given:

function urlLoad( cUrl )

   local hCurl, nRet

   if ! Empty( hCurl := curl_easy_init() )

      curl_easy_setopt( hCurl, HB_CURLOPT_DOWNLOAD )
      curl_easy_setopt( hCurl, HB_CURLOPT_URL, cUrl )      
      curl_easy_setopt( hCurl, HB_CURLOPT_SSL_VERIFYPEER, .F. )
      curl_easy_setopt( hCurl, HB_CURLOPT_SSL_VERIFYHOST, .F. )
      curl_easy_setopt( hCurl, HB_CURLOPT_FOLLOWLOCATION )
      curl_easy_setopt( hCurl, HB_CURLOPT_FILETIME, 1 )
      curl_easy_setopt( hCurl, HB_CURLOPT_DL_FILE_SETUP, SubStr( cUrl, RAt( "/", cUrl ) + 1 ) )
      curl_easy_setopt( hCurl, HB_CURLOPT_NOPROGRESS, .F. )
      curl_easy_setopt( hCurl, HB_CURLOPT_VERBOSE, .F. )    
      curl_easy_setopt( hCurl, HB_CURLOPT_FAILONERROR , .T. )
       
      nRet = curl_easy_perform( hCurl )
      curl_easy_cleanup( hCurl )
   endif    
     
return nRet

and it doesn't throw errors, but I really don't know what that number is that the function returns. Well thanks for the help
Message has been deleted

pete....@gmail.com

unread,
Nov 5, 2024, 9:16:49 AM11/5/24
to Harbour Users
On Tuesday 5 November 2024 at 15:49:01 UTC+2 Antonio Cardinaux wrote:
Well, adding the hbcurl.hbc file to the hbp file, everything seems to work, I had to add the libcurl.dll file to the executable folder and there it was.

libcurl.dll is needed because hb32 distributions does not include static hbcurl libs ,  
but that's not a problem, you've easily found the solution.

 
and it doesn't throw errors, but I really don't know what that number is that the function returns. Well thanks for the help


"that number" is the errorcode returned by curl_easy_perform()
a 0 (zero) means everything went OK, a non-zero value indicates an error.
see here for the complete error-codes list: https://curl.se/libcurl/c/libcurl-errors.html

Antonio Cardinaux

unread,
Nov 6, 2024, 6:41:42 AM11/6/24
to Harbour Users
The value returned by the nRet variable is 23

According to the error list it is the following:

CURLE_WRITE_ERROR (23)

An error occurred writing the received data to a local file or an error was returned to libcurl from a write callback.
The value of the variable nRet is 23
According to the error list it is the following:

CURLE_WRITE_ERROR (23)

An error occurred writing the received data to a local file or an error was returned to libcurl from a write callback.

The internet address I want to access is the following:

https://sso.arba.gov.ar/Login/login?service=https%3A%2F%2Fdfe.arba.gov.ar%3A443%2FDomicilioElectronico%2FdfeSetUpInicio.do

diego...@gmail.com

unread,
Nov 7, 2024, 8:45:29 AM11/7/24
to Harbour Users
Antonio, Buen dia. Cual servicio de Arba específicamente estas queriendo utilizar?

Diego.

Antonio Cardinaux

unread,
Nov 11, 2024, 10:44:41 AM11/11/24
to Harbour Users
Hola Diego, es para bajar el padrón, lo que estoy buscando es automatizar de alguna forma para bajar el padron directamente desde la aplicación de harbour. Actualmente lo que hago es ir al sitio, entrar con el cuit de la empresa y una clave, de ahi ir a la parte de los padrones, y bajar el último, despues lo descompacto, porque viene en formato zip, y ahi si ya el proceso lo hago con el sistema en harbour, pero el problema siempre se da cuando no estoy por algun motivo, ahi tengo que explicarle a la persona que va a hacer el proceso los pasos a seguir. 

diego...@gmail.com

unread,
Nov 12, 2024, 8:19:37 AM11/12/24
to Harbour Users

Antonio, Por lo que tengo entendido el padron no se puede descargar sino es por la pagina, luego de loguearte. 
Ahi estuve investigando un poco para ver si con algun tipo de scrap podria hacer el proceso de manera automatica.
Si ves en la imagen que puse abajo carga el nombre del archivo que seria el periodo y luego fuerza un submit. Esto se podria emular tranquilamente. Habria que ver si tiene alguna cookie de sesion y tambien habria que utilizarla. 

Pruebo y cualquier cosa te digo.
....
Antonio, from what I understand, the padron can only be downloaded from the website after logging in. I did some research to see if some kind of scraping could automate the process. If you look at the image I placed below, it loads the filename, which would be the period, and then forces a submit. This could easily be emulated. We would need to check if there’s a session cookie, and it would also need to be used.  

Let me try, and I'll let you know if anything comes up  

Captura de pantalla 2024-11-12 101108.png

Diego.

diego...@gmail.com

unread,
Nov 18, 2024, 6:08:04 PM11/18/24
to Harbour Users
Antonio, aqui prepare un ejemplo de descarga del padron de Arba de manera automatica y sin navegador. Solo necesitas tus credenciales CIT( cuit y clave )
Esta en python pero puedes adaptarlo para harbour. Es utilizar simplemente curl.


El Monday, November 11, 2024 a la(s) 12:44:41 PM UTC-3, Antonio Cardinaux escribió:
Reply all
Reply to author
Forward
0 new messages