PerlFFI / FFI-Platypus-Lang-Go

8 stars 2 forks source link

Install problems on Windows 10 #9

Open maximusfox opened 4 years ago

maximusfox commented 4 years ago

Hi. I try to install your module using cpanminus, but have an error. Is it posible to fix? Install log:

cpanm (App::cpanminus) 1.7044 on perl 5.028000 built for MSWin32-x64-multi-thread
Work directory is C:\Users\USER/.cpanm/work/1593319076.2624
You have make C:\Strawberry\c\bin\gmake.exe
You have LWP 6.44
Falling back to Archive::Tar 2.30
Searching FFI::Platypus::Lang::Go () on cpanmetadb ...
--> Working on FFI::Platypus::Lang::Go
Fetching http://www.cpan.org/authors/id/P/PL/PLICEASE/FFI-Platypus-Lang-Go-0.01.tar.gz
-> OK
Unpacking FFI-Platypus-Lang-Go-0.01.tar.gz
Entering FFI-Platypus-Lang-Go-0.01
Checking configure dependencies from META.json
Checking if you have Capture::Tiny 0 ... Yes (0.48)
Checking if you have ExtUtils::MakeMaker 6.64 ... Yes (7.34)
Configuring FFI-Platypus-Lang-Go-0.01
Running Makefile.PL
Checking if your kit is complete...
Looks good
Generating a gmake-style Makefile
Writing Makefile for FFI::Platypus::Lang::Go
Writing MYMETA.yml and MYMETA.json
-> OK
Checking dependencies from MYMETA.json ...
Checking if you have Class::Method::Modifiers 0 ... Yes (2.12)
Checking if you have Path::Tiny 0 ... Yes (0.104)
Checking if you have FFI::Build::File::Base 0 ... Yes (1.30)
Checking if you have Test2::V0 0.000060 ... Yes (0.000114)
Checking if you have Capture::Tiny 0 ... Yes (0.48)
Checking if you have FFI::Platypus 1.24 ... Yes (1.30)
Checking if you have FFI::Build::Platform 0 ... Yes (1.30)
Checking if you have FFI::Build::File::Library 0 ... Yes (1.30)
Checking if you have File::ShareDir::Dist::Install 0 ... Yes (0.07)
Checking if you have File::chdir 0 ... Yes (0.1010)
Checking if you have Ref::Util 0 ... Yes (0.204)
Checking if you have File::ShareDir::Dist 0.07 ... Yes (0.07)
Building and testing FFI-Platypus-Lang-Go-0.01
cp lib/FFI/Platypus/Type/GoString.pm blib\lib/FFI/Platypus/Type/GoString.pm
cp lib/FFI/Go/String.pm blib\lib/FFI/Go/String.pm
cp lib/FFI/Platypus/Lang/Go.pm blib\lib/FFI/Platypus/Lang/Go.pm
cp lib/FFI/Build/File/GoMod.pm blib\lib/FFI/Build/File/GoMod.pm
"C:\Strawberry\perl\bin\perl.exe" inc/mymm-build.pl
Found go go1.14.3
For arch windows/amd64
gmake: *** [Makefile:955: mymm-build] Error -1073741819
-> FAIL Installing FFI::Platypus::Lang::Go failed. See C:\Users\USER\.cpanm\work\1593319076.2624\build.log for details. Retry with --force to force install it.
plicease commented 4 years ago

I am guessing it is crashing somewhere here:

https://github.com/Perl5-FFI/FFI-Platypus-Lang-Go/blob/master/inc/mymm-build.pl#L93-L99

Because if it was a compile error it should print the appropriate diagnostic. It looks like Perl and go have the same arch (amd64). I think a Go uintptr should be the same as a C size_t?

maximusfox commented 4 years ago

My Go version: go version go1.14.3 windows/amd64 My Perl version: This is perl 5, version 28, subversion 0 (v5.28.0) built for MSWin32-x64-multi-thread As i am anderstand both have amd64 arch.

I am add debug print to inc/mymm-build.pl using Data::Dumper module: print Dumper(\%types); Then i am try to run gmake manualy, and have this error againe:

λ gmake
"C:\Strawberry\perl\bin\perl.exe" inc/mymm-build.pl
Found go go1.14.3
For arch windows/amd64
$VAR1 = {
          'gouint64' => 'sint64',
          'goint8' => 'sint8',
          'gochan' => 'opaque',
          'gouint8' => 'sint8',
          'gomap' => 'opaque',
          'gouint32' => 'sint32',
          'gobool' => 'uint8',
          'gobyte' => 'uint8',
          'gorune' => 'sint32',
          'gofloat32' => 'float',
          'goint64' => 'sint64',
          'goint32' => 'sint32',
          'goint16' => 'sint16',
          'gouint' => 'uint64',
          'goint' => 'sint64',
          'gouintptr' => 'uint64',
          'gofloat64' => 'double',
          'gouint16' => 'sint16'
        };
gmake: *** [Makefile:955: mymm-build] Error -1073741819

Generated simple.h:

/* Code generated by cmd/cgo; DO NOT EDIT. */

/* package command-line-arguments */

#line 1 "cgo-builtin-export-prolog"

#include <stddef.h> /* for ptrdiff_t below */

#ifndef GO_CGO_EXPORT_PROLOGUE_H
#define GO_CGO_EXPORT_PROLOGUE_H

#ifndef GO_CGO_GOSTRING_TYPEDEF
typedef struct { const char *p; ptrdiff_t n; } _GoString_;
#endif

#endif

/* Start of preamble from import "C" comments.  */

/* End of preamble from import "C" comments.  */

/* Start of boilerplate cgo prologue.  */
#line 1 "cgo-gcc-export-header-prolog"

#ifndef GO_CGO_PROLOGUE_H
#define GO_CGO_PROLOGUE_H

typedef signed char GoInt8;
typedef unsigned char GoUint8;
typedef short GoInt16;
typedef unsigned short GoUint16;
typedef int GoInt32;
typedef unsigned int GoUint32;
typedef long long GoInt64;
typedef unsigned long long GoUint64;
typedef GoInt64 GoInt;
typedef GoUint64 GoUint;
typedef __SIZE_TYPE__ GoUintptr;
typedef float GoFloat32;
typedef double GoFloat64;
typedef float _Complex GoComplex64;
typedef double _Complex GoComplex128;

/*
  static assertion to make sure the file is being used on architecture
  at least with matching size of GoInt.
*/
typedef char _check_for_64_bit_pointer_matching_GoInt[sizeof(void*)==64/8 ? 1:-1];

#ifndef GO_CGO_GOSTRING_TYPEDEF
typedef _GoString_ GoString;
#endif
typedef void *GoMap;
typedef void *GoChan;
typedef struct { void *t; void *v; } GoInterface;
typedef struct { void *data; GoInt len; GoInt cap; } GoSlice;

#endif

/* End of boilerplate cgo prologue.  */

#ifdef __cplusplus
extern "C" {
#endif

extern GoUintptr SizeOfBool();

extern GoUintptr SizeOfInt();

extern GoUintptr SizeOfUint();

#ifdef __cplusplus
}
#endif
plicease commented 4 years ago

Interesting. I was able to get to my windows box this morning and reproduce this error. It seems to be creating the config.pl needed for runtime correctly, but something in unwinding the simple.so file is going sideways.

As a workaround you can add || (exit 0) to the call to inc/mymm-build.pl to get make to ignore the error. You can adjust the Makefile.PL like this:

    $postamble .=
      "pure_all :: mymm-build\n" .
      "mymm-build :\n" .
      "\t\$(FULLPERL) inc/mymm-build.pl || (exit 0)\n\n";

obviously this is a bug somewhere, so I'd like to figure out why it is exiting with an error.

maximusfox commented 4 years ago

I am adjust Makefile.PL like you say. Then do this:

gmake
gmake test
gmake install

And module successfuly installed. I think cpanm --force FFI::Platypus::Lang::Go should work fine too.