Add Windows support

Issue #1 resolved
Naoki Koguro repo owner created an issue

For now, we can't add SCM_EXTENSION_ENTRY to Scm_Init_extention() with define-cfn. Need to ask to add new qualifier for SCM_EXTENSION_ENTRY or construct the function with raw C code.

Comments (6)

  1. Hamayama

    こんにちは Hamayama です。

    compile-stub.scm の 387 行目を、

             (dynamic-load (cond-expand
                            (gauche.os.windows (regexp-replace-all #/\\/ stub-so-filename "/"))
                            (else              stub-so-filename))))))))
    

    のようにしたところ、サンプルの hello.scm は動作するようでした。
    環境は、Windows 8.1 (64bit) で MSYS2/MinGW-w64 をインストールしています。
    実行方法は、hello.scm と同じ場所に、以下の内容の hello.bat を作成して実行しました。

    @set PATH=C:\msys64\mingw64\bin;C:\msys64\usr\local\bin;C:\msys64\usr\bin;C:\msys64\bin;%PATH%
    @set MSYSTEM=MINGW64
    gosh hello.scm
    pause
    

    ただし、COMPILED-BINARY-PATH に相対パスを設定すると、 gauche-package compile が以下のエラーになりました。絶対パス (デフォルト もしくは "c:/compile-stub" 等) であれば問題ないようでした。

    *** CGEN-STUB-ERROR: Couldn't read input file: ".\\compile-stub\\gauche-0.9\\sit
    e\\x86_64-pc-mingw64\\hello\\x39944e899edb632ac263d7026b942aa314dcecd9_lib.stub"
    
    Stack Trace:
    _______________________________________
      0  (error <cgen-stub-error> "Couldn't read input file:" stubfile)
            at "C:\\Program Files (x86)\\Gauche\\share\\gauche-0.9\\0.9.5\\lib/gauch
    e/cgen/stub.scm":238
      1  (cgen-genstub file)
            at "C:\\Program Files (x86)\\Gauche\\share\\gauche-0.9\\0.9.5\\lib/gauch
    e/package/compile.scm":84
      2  (with-error-handler (lambda (e) (exit-handler x) (when (condi ...
            [unknown location]
      3  (apply gauche-package-compile src (delete-keyword :output args))
            at "C:\\Program Files (x86)\\Gauche\\share\\gauche-0.9\\0.9.5\\lib/gauch
    e/package/compile.scm":122
      4  (map (lambda (src) (cond ((equal? (path-extension src) OBJEXT ...
            at "C:\\Program Files (x86)\\Gauche\\share\\gauche-0.9\\0.9.5\\lib/gauch
    e/package/compile.scm":119
      5  (with-error-handler (lambda (e) (let ((e e)) (%guard-rec e e  ...
            expanded from (guard (e (else (sys-unlink sofile) (raise e))) (let1 objs
     (
            at "C:\\Program Files (x86)\\Gauche\\share\\gauche-0.9\\0.9.5\\lib/gauch
    e/package/compile.scm":117
      6  (x (cddr args))
            [unknown location]
    
    *** ERROR: gauche-package compile exits with 70
        While loading "./hello.scm" at line 15
    Stack Trace:
    _______________________________________
      0  (errorf "gauche-package compile exits with ~a" (sys-wait-exit ...
            at "C:\\Program Files (x86)\\Gauche\\share\\gauche-0.9\\site\\lib/compil
    e-stub.scm":198
      1  (compile-stublib stub-so-filename stub-ext stublib-src-filena ...
            at "C:\\Program Files (x86)\\Gauche\\share\\gauche-0.9\\site\\lib/compil
    e-stub.scm":382
    
  2. Naoki Koguro reporter

    Strip directory from filename for gauche-package.

    The current directory is changed before running gauche-package. gauche-package will return error if we pass a filename with directory.

    Fixes #1.

    → <<cset 060450ba1c98>>

  3. Naoki Koguro reporter

    レポートありがとうございます。相対パスの問題については修正しました。

    あと、dynamic-loadの問題は、Gauche側で修正されました。

    msys2を入れなおしたりして、私のWindows環境でも動作するようになりましたので、この件についてはクローズします。

  4. Log in to comment