Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perl 5.36 cpan | Socket6 compilation fails #72

Closed
shawnlaffan opened this issue Mar 13, 2023 · 5 comments
Closed

perl 5.36 cpan | Socket6 compilation fails #72

shawnlaffan opened this issue Mar 13, 2023 · 5 comments

Comments

@shawnlaffan
Copy link
Contributor

Socket6 is needed by IO::Socket::INET6 but there are errors in the build stage. See log below.

CPAN testers has no windows results more recent than version 5.28.2 but the module compiles and passes tests on Strawberry perl portable 5.32.0 (with the same integer cast warnings).

I assume I have either missed some details with the patches being applied (see discussion in #56) or there is an issue with the Socket updates that has not previously come to light on other platforms. Maybe this RT is relevant? https://rt.cpan.org/Public/Bug/Display.html?id=140028

Can someone who has built perl 5.37.x or a version with the socket patches have a go at building Socket6? @sisyphus?

And for reference, the relevant patches being applied are https://github.com/StrawberryPerl/Perl-Dist-Strawberry/blob/wip_536/share/perl-5.36/perl_pr19663.diff and perl_pr19663.diff and https://github.com/StrawberryPerl/Perl-Dist-Strawberry/blob/wip_536/share/perl-5.36/rt142390.patch

Fetching https://cpan.metacpan.org/authors/id/U/UM/UMEMOTO/Socket6-0.29.tar.gz ... OK
Configuring Socket6-0.29 ... Checking if your kit is complete...
Looks good
Warning (mostly harmless): No library found for ws2_32.lib
Generating a gmake-style Makefile
Writing Makefile for Socket6
Writing MYMETA.yml and MYMETA.json
Checking dependencies from MYMETA.json ...
Checking if you have ExtUtils::MakeMaker 0 ... Yes (7.66)
OK
Building and testing Socket6-0.29 ... cp Socket6.pm blib\lib/Socket6.pm
Running Mkbootstrap for Socket6 ()
"C:\strawberry\perl\bin\perl.exe" -MExtUtils::Command -e chmod -- 644 "Socket6.bs"
"C:\strawberry\perl\bin\perl.exe" -MExtUtils::Command::MM -e cp_nonempty -- Socket6.bs blib\arch\auto\Socket6\Socket6.bs 644
"C:\strawberry\perl\bin\perl.exe" "C:\strawberry\perl\lib\ExtUtils/xsubpp" -noprototypes -typemap C:\strawberry\perl\lib\ExtUtils\t
ypemap  Socket6.xs > Socket6.xsc
"C:\strawberry\perl\bin\perl.exe" -MExtUtils::Command -e mv -- Socket6.xsc Socket6.c
gcc -c   -DWIN32 -DWIN64 -D__USE_MINGW_ANSI_STDIO -DPERL_TEXTMODE_SCRIPTS -DMULTIPLICITY -DPERL_IMPLICIT_SYS -DUSE_PERLIO -D__USE_M
INGW_ANSI_STDIO -fwrapv -fno-strict-aliasing -mms-bitfields -O2   -DVERSION=\"0.29\" -DXS_VERSION=\"0.29\"  "-IC:\strawberry\perl\l
ib\CORE"   Socket6.c
In file included from Socket6.xs:101:
inet_ntop.c:52:1: error: conflicting types for 'inet_ntop'
   52 | inet_ntop(int af, const void *src, char *dst, SOCKLEN_T size)
      | ^~~~~~~~~
In file included from Socket6.xs:43:
c:\strawberry\c\x86_64-w64-mingw32\include\ws2tcpip.h:401:35: note: previous declaration of 'inet_ntop' was here
  401 | WINSOCK_API_LINKAGE LPCSTR WSAAPI InetNtopA(INT Family, LPCVOID pAddr, LPSTR pStringBuf, size_t StringBufSize);
      |                                   ^~~~~~~~~
Socket6.xs: In function 'XS_Socket6_gethostbyname2':
Socket6.xs:465:10: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
  465 |  ST(0) = (SV *) not_here("gethostbyname2");
      |          ^
Socket6.xs: In function 'XS_Socket6_getipnodebyname':
Socket6.xs:872:10: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
  872 |  ST(0) = (SV *) not_here("getipnodebyname");
      |          ^
Socket6.xs: In function 'XS_Socket6_getipnodebyaddr':
Socket6.xs:943:10: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
  943 |  ST(0) = (SV *) not_here("getipnodebyaddr");
      |          ^
gmake: *** [makefile:350: Socket6.o] Error 1
! Installing Socket6 failed. See C:\spbuild\msys64\.cpanm\work\1678680009.1972\build.log for details. Retry with --force to force i
nstall it.
! Installing the dependencies failed: Module 'Socket6' is not installed
! Bailing out the installation for IO-Socket-INET6-2.73.
FAIL
@sisyphus
Copy link

I, for one, will happily take a look at this when I get back home (ie tomorrow night).

Cheers,
Rob

@sisyphus
Copy link

The patches provided by [email protected] at https://rt.cpan.org/Public/Bug/Display.html?id=140028 work fine with Socket6-0.29, and portably too, AFAICS.
I've tested on the following (where Socket6-0.29 fails to build straight out of the box) :

  1. Windows 11 - perl-5.36.0
  2. Windows 11 - perl-5.37.9
  3. Windows 11 - sp536_20230311
  4. Windows 7 - perl-5.34.0
  5. Windows 7 - perl-5.36.0
  6. Windows 7 - sp536_20230311

Cheers,
Rob

@shawnlaffan
Copy link
Contributor Author

Thanks @sisyphus

Will look into patching Socket6 before building.

@shawnlaffan
Copy link
Contributor Author

shawnlaffan commented Apr 19, 2023

Confirming patching works with a local 5.36. It will be used in the next build.

Edit: patched distro is at https://github.com/StrawberryPerl/Perl-Dist-Strawberry/releases/download/dev_20230318/Socket6-0.29_01.tar.gz

shawnlaffan added a commit that referenced this issue Apr 20, 2023
Patch:
File::Find::Rule: issue #88
Socket6:          issue #72

Update to use latest dlls:
GD:               issue #81

Exclude:
Crypt::OpenSSL::DSA: isssue #86

Archive::Tar:     skip tests on 3.02 due to
                  symlink issues (similar to #67)
@Jacob-Mellichamp
Copy link

I would just like to comment on this thread for future viewers. If you get this error with socket6. Notice the error:

inet_ntop.c:52:1: error: conflicting types for 'inet_ntop'
   52 | inet_ntop(int af, const void *src, char *dst, SOCKLEN_T size)
      | ^~~~~~~~~
In file included from Socket6.xs:43:
c:\strawberry\c\x86_64-w64-mingw32\include\ws2tcpip.h:401:35: note: previous declaration of 'inet_ntop' was here

It's basically just saying that inet_ntop has already been declared. If you navigate to the inet_ntop.c file, line 52.... and comment out the entire declaration. You can then retar the module tar.exe -czvf local.tar.gz <socket 6 module > and then cpan local.tar.gz to fix this error.

For Reference:

/* char *
 * isc_net_ntop(af, src, dst, size)
 *      convert a network format address to presentation format.
 * return:
 *      pointer to presentation format address (`dst'), or NULL (see errno).
 * author:
 *      Paul Vixie, 1996.
 */
// const char *
// inet_ntop(int af, const void *src, char *dst, SOCKLEN_T size)
// {
//         switch (af) {
//         case AF_INET:
//                 return (inet_ntop4(src, dst, (size_t)size));
// #ifdef AF_INET6
//         case AF_INET6:
//                 return (inet_ntop6(src, dst, (size_t)size));
// #endif
//         default:
//                 errno = EAFNOSUPPORT;
//                 return (NULL);
//         }
//         /* NOTREACHED */
// }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants