Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

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

by xiaoyafeng (Deacon)
on Nov 20, 2019 at 03:58 UTC ( #11108928=note: print w/replies, xml ) Need Help??


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

Thanks Rob, I note you use libcurl installed from MSYS2 other than win64 version, that's why you can build successfully I think. Maybe I choose a hard way since I use pure portable strawberry perl suite. ;)




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

  • Comment on Re^7: Can't call libcurl with Inline::C on Windows

Replies are listed 'Best First'.
Re^8: Can't call libcurl with Inline::C on Windows
by syphilis (Bishop) on Nov 20, 2019 at 12:30 UTC
    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
      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

Re^8: Can't call libcurl with Inline::C on Windows
by swl (Priest) on Nov 20, 2019 at 08:30 UTC

    This might be tangential, but have you tried using Alien::curl and forcing a shared install so it downloads and compiles a recent version?

    Access to the libs is then via Alien::curl->libs and similar. See the examples in the Alien::curl and Alien::Base documentation.

      I've tried Alien::Curl, Unfoturatly, it seems download wrong curlxxxx.dll, so it doesn't get things done also ( I don't dig it so much, it seems mingw curl need a runtime dll, )




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

        Did it run a system or share install?

        If the former then it would use the first existing version on your system that it finds in the path. This is the default and needs to be overridden using an environment variable. Details of how to do so are at https://metacpan.org/pod/Alien::Build#ALIEN_INSTALL_TYPE.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2021-09-17 08:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?