Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^8: Can't call libcurl with Inline::C on Windows

by syphilis (Bishop)
on Nov 20, 2019 at 12:30 UTC ( #11108935=note: print w/replies, xml ) Need Help??


in reply to Re^7: Can't call libcurl with Inline::C on Windows
in thread Can't call libcurl with Inline::C on Windows

I note you use libcurl installed from MSYS2 other than win64 version, that's why you can build successfully I think

Yes, that probably makes it a bit simpler - certainly a lot simpler than the builds I did a couple of years ago against static libraries that I had built from source.

I finally solved the problem regarding the "loadable library and perl binaries" mismatch - and in so doing, I discovered that I had faced (and solved) the exact same problem when I built Net-Curl-0.37.
There's a line in the Makefile.PL:
CCFLAGS => $devel_cflags . ' ' . $curl{cflags} . $bits, that needs to be modified to: CCFLAGS => $Config::Config{ccflags} . ' ' . $devel_cflags . ' ' . $ +curl{cflags} . $bits,
That change then also brings about the need to patch Curl.xs:
--- Curl.xs_orig 2019-11-20 11:44:50 +1100 +++ Curl.xs 2019-11-20 22:55:23 +1100 @@ -17,6 +17,11 @@ #include "perl.h" #include "XSUB.h" +#ifdef __MINGW32__ +#undef fread +#undef fwrite +#endif + #include <curl/curl.h> #include <curl/easy.h> #include <curl/multi.h>
I got rid of the overflow in conversion from 'long long unsigned int' to 'int' warning by patching Curl_multi.xsh:
--- Curl_multi.xsh_orig 2019-11-20 11:54:58 +1100 +++ Curl_multi.xsh 2019-11-20 11:55:35 +1100 @@ -564,8 +564,8 @@ int socket_action( multi, sockfd=CURL_SOCKET_BAD, ev_bitmask=0 ) Net::Curl::Multi multi - int sockfd - int ev_bitmask + IV sockfd + IV ev_bitmask PREINIT: int remaining; CURLMcode ret;
though it doesn't seem to make any difference to the way that the test suite behaves .... and the test suite doesn't behave very well.
A lot of the tests fail or hang. And the examples scripts hang or crash - except for examples/04-share-threads.pl (which runs fine).

The Net-Curl-0.41 test suite covers much more than the Net-Curl-0.37 suite did. 0.37 passed all of its tests, and 0.41 still passes the same tests.
The problems are with the other tests in 0.41 (ie the ones that weren't in 0.37).
I've no idea how useful Net-Curl is on Windows - I think it's a good idea to stick with Inline::C if you can get it to do what you need.

I also built Net-Curl-0.41 with Strawberry Perl 5.30.0.1 - again, building against the MSYS2 libraries.
I get identical results with Strawberry Perl - which is to be expected.
Strawberry Perl's perl/bin/pkg-config.bat doesn't automatically find the Curl library, so I renamed it to pkg-config.bat_hide. With that done, the MSYS2 mingw64/pkg-config.exe gets used instead, and the Curl library is found.

Cheers,
Rob

Replies are listed 'Best First'.
Re^9: Can't call libcurl with Inline::C on Windows
by xiaoyafeng (Deacon) on Nov 22, 2019 at 05:30 UTC
    Really Thanks Rob, these two days I've also dig the issue of libcur and strawberry perl. Plus your suggestions and research, I believe the following points will help build libcurl on windows successfully.
  • use MSYS2 libcur-dev, don't download directly or use Alien::Curl etc. since libcurl use libssh2.dll,libcrypto-1_1-x64.dll and many others, you may miss something.
  • don't use pkg-config of strawberry perl just edit --libs --inc parameters
  • use Inline::C other than Net::Curl, the latter is too linux to run smoothly on windows
  • Thanks again Rob, your replies and suggestions is like a guiding light.





    I am trying to improve my English skills, if you see a mistake please feel free to reply or /msg me a correction

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11108935]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2021-10-25 11:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My first memorable Perl project was:







    Results (89 votes). Check out past polls.

    Notices?