in reply to Need Help Porting XS Modules to Windows

but have no idea how to get the XS modules compiled.

It's just a matter of running 'perl Build.pl', 'perl Build', 'perl Build test' and 'perl Build install', fixing errors as they arise.
When I try to build ICC-Support-Lapack-0.6 on StrawberryPerl-5.28.0, I get the following error during the 'perl Build' stage:
src\xs_arrays.c:13:10: fatal error: Accelerate/Accelerate.h: No such f +ile or directory #include <Accelerate/Accelerate.h> ^~~~~~~~~~~~~~~~~~~~~~~~~
Where do I find Accelerate/Accelerate.h ?

<UPDATE>
I see that Accelerate/Accelerate.h is a macos system header.
So the first thing that needs to be done is to provide a replacement of that part of the macos system library for Windows.
</UPDATE>

Trying to build ICC-Support-Levmar-0.50, I get (during 'perl Build' step):
g++.exe -o "blib\arch\auto\ICC\Support\Levmar\Levmar.xs.dll" -Wl,--bas +e-file,"lib\ICC\Support\Levmar.base" -Wl,--image-base,0x2d170000 -mdl +l -s -L"C:\_64\strawberry-5.28.0\perl\lib\CORE" -L"C:\_64\strawberry- +5.28.0\c\lib" "lib\ICC\Support\Levmar.lds" -framework Accelerate "lib +\ICC\Support\Levmar.exp" g++.exe: error: Accelerate: No such file or directory g++.exe: error: unrecognized command line option '-framework' dlltool --def "lib\ICC\Support\Levmar.def" --output-exp "lib\ICC\Suppo +rt\Levmar.exp" --base-file "lib\ICC\Support\Levmar.base" dlltool: Unable to open base-file: lib\ICC\Support\Levmar.base g++.exe -o "blib\arch\auto\ICC\Support\Levmar\Levmar.xs.dll" -Wl,--ima +ge-base,0x2d170000 -mdll -s -L"C:\_64\strawberry-5.28.0\perl\lib\CORE +" -L"C:\_64\strawberry-5.28.0\c\lib" "lib\ICC\Support\Levmar.lds" -fr +amework Accelerate "lib\ICC\Support\Levmar.exp" g++.exe: error: Accelerate: No such file or directory g++.exe: error: unrecognized command line option '-framework'
I think there's some macos-specific stuff in there that needs to be replaced. Also, just before the above-quoted excerpt of the Levmar build I see:
Generating script 'lib\ICC\Support\Levmar.lds' dlltool --def "lib\ICC\Support\Levmar.def" --output-exp "lib\ICC\Suppo +rt\Levmar.exp"
Neither of those commands generate an error, but neither 'lib\ICC\Support\Levmar.lds' nor 'lib\ICC\Support\Levmar.exp' are created.

Cheers,
Rob

Replies are listed 'Best First'.
Re^2: Need Help Porting XS Modules to Windows
by Anonymous Monk on Oct 01, 2018 at 07:35 UTC

    Accelerate is Apple's implementation of BLAS and LAPACK, very old linear algebra libraries. A good free implementation of BLAS (and a part of LAPACK) for Windows is OpenBLAS. (A very good one, but only available to academics or for a fee, is Intel MKL.) On non-Apple platforms C source code should #include <cblas.h> or mkl.h, depending on preprocessor directives. I'm not sure whether it's possible to get a free LAPACK implementation for Windows without having a Fortran compiler, though.

    The funny thing is that src\xs_arrays.c only uses the three constants CblasNoTrans,CblasTrans,CblasConjTrans from BLAS header and does the rest of the array manipulation by hand. (At least that's what it seemed to me while I skimmed the file.)

      The funny thing is that src\xs_arrays.c only uses the three constants CblasNoTrans,CblasTrans,CblasConjTrans from BLAS header and does the rest of the array manipulation by hand

      So, in src/xs_arrays.c, I've replaced:
      #include <Accelerate/Accelerate.h>
      with:
      typedef enum {CblasNoTrans=111, CblasTrans=112, CblasConjTrans=113} CB +LAS_TRANSPOSE;
      and that enables xs_arrays.c to be compiled.
      The same alteration needs also to be made to src/xs_stat.c.

      But lib/ICC/Support/Lapack.xs also includes Accelerate/Accelerate.h - only this time the above "typedef enum ..." is insufficient as a replacement.
      So I've included some additional definitions to Lapack.xs (from cblas.h):
      typedef enum {CblasNoTrans=111, CblasTrans=112, CblasConjTrans=113} CB +LAS_TRANSPOSE; typedef enum {CblasRowMajor=101, CblasColMajor=102} CBLAS_LAYOUT; typedef enum {CblasUpper=121, CblasLower=122} CBLAS_UPLO; typedef enum {CblasNonUnit=131, CblasUnit=132} CBLAS_DIAG; typedef enum {CblasLeft=141, CblasRight=142} CBLAS_SIDE; typedef int __CLPK_integer; typedef double __CLPK_doublereal;
      That just about enables the thing to compile, but having altered Lapack.xs, I inevitably get the following errors:
      lib\\ICC\\Support\\Lapack.xs:1:1: error: stray '\357' in program &#65279;/* ^ lib\\ICC\\Support\\Lapack.xs:1:2: error: stray '\273' in program &#65279;/* ^ lib\\ICC\\Support\\Lapack.xs:1:3: error: stray '\277' in program &#65279;/* ^
      and I don't know why such a complaint is being made about a file that appears to be entirely valid.

      I've run out of time for tonight.

      Cheers,
      Rob
        appears to be entirely valid

        Exactly! :)

        Someone had forgotten a ZERO WIDTH NO-BREAK SPACE (which is encoded to ef bb bf in UTF-8) in the beginning of the file. Programmers' text editors usually highlight such "strange" characters, but in this case, my copy of Vim says that a three-byte file with this code point consists of "0 lines and 3 characters", but looks entirely empty.