FSI.exe does not work under Ubuntu 10.10

后端 未结 2 754
死守一世寂寞
死守一世寂寞 2021-01-05 23:27

Update: Tried November CTP release. Same error message. Forgot to mention that this server has the Ubuntu server edition installed. I don\'t have this issue on my Ubuntu

相关标签:
2条回答
  • 2021-01-06 00:04

    F# has never worked for me under Linux. Today with Mono 2.8 and the November 2010 drop of F# (which confusingly has the exact same version number as the previous release?!) I get:

    $ sudo ./install-mono.sh
    In order to add FSharp.Core.dll to the Mono GAC the DLL needs to be
    re-signed with the mono.snk key. The mono.snk key is available from
    the 'Mono Sources'.
    
      http://www.mono-project.com/
      http://github.com/mono/mono/raw/master/mcs/class/mono.snk
    
    For example, run:
      wget -O mono.snk http://github.com/mono/mono/raw/master/mcs/class/mono.snk
    
    Then re-run this script.
    
    An alternative to installing the DLLs in the Mono GAC is to add the
    FSharp bin directory to the MONO_PATH variable. For more information
    on 'How Mono Finds Assemblies' see http://www.mono-project.com/Gacutil
    

    If I run the wget command that it suggests then it dies:

    $ wget -O mono.snk http://github.com/mono/mono/raw/master/mcs/class/mono.snk
    --2010-11-23 17:02:43--  http://github.com/mono/mono/raw/master/mcs/class/mono.snk
    Resolving github.com... 207.97.227.239
    Connecting to github.com|207.97.227.239|:80... connected.
    HTTP request sent, awaiting response... 301 Moved Permanently
    Location: https://github.com/mono/mono/raw/master/mcs/class/mono.snk [following]
    --2010-11-23 17:02:44--  https://github.com/mono/mono/raw/master/mcs/class/mono.snk
    Connecting to github.com|207.97.227.239|:443... connected.
    ERROR: certificate common name `*.github.com' doesn't match requested host name `github.com'.
    To connect to github.com insecurely, use `--no-check-certificate'.
    Unable to establish SSL connection.
    

    Now if I rerun the F# installer I get a different error:

    $ sudo ./install-mono.sh
    -- Resigning FSharp.Core.dll with mono.snk
    ERROR: Invalid number of parameters.
    
    Usage: sn [-q | -quiet] options [parameters]
    
     -q | -quiet            Quiet mode (minimal display)
    
    Help options
     -? | -h                Show this help screen about the tool
     -? | -h config         Configuration options
     -? | -h csp            Crypto Service Provider (CSP) related options
     -? | -h convert        Format convertion options
     -? | -h sn             StrongName signing options
    -- Installing FSharp DLLS into the GAC
    Failure adding assembly bin/FSharp.Core.dll to the cache: Strong name cannot be verified for delay-signed assembly
    

    If I copy the mono.snk file from the Mono 2.8 directory into the F# directory by hand then the installer seems to work:

    $ sudo ./install-mono.sh
    -- Resigning FSharp.Core.dll with mono.snk
    Assembly bin/FSharp.Core.dll signed.
    -- Installing FSharp DLLS into the GAC
    Installed bin/FSharp.Core.dll into the gac (/usr/local/lib/mono/gac)
    

    But F# itself still fails to work in exactly the same way that it did before (appearing to hang whenever input is entered):

    $ mono bin/fsi.exe
    
    Microsoft (R) F# 2.0 Interactive build 2.0.0.0
    Copyright (c) Microsoft Corporation. All Rights Reserved.
    
    For help type #help;;
    
    > 1+2*3;;
    

    I have to use CTRL+Z to regain control and then kill %1 to kill the rogue process.

    0 讨论(0)
  • 2021-01-06 00:08

    Feel really awkward to answer my own question. Anyway, I'll answer it so other people can benefit from.

    First of all, install libreadline-dev and libreadline5 so you can get rid of the following error message

    Failed to install ctrl-c handler - Ctrl-C handling will not be available. Error was: Exception has been thrown by the target of an invocation

    If you encounter fsi.exe stuck issue, try

     fsi --gui-
    

    It works perfectly in my case.

    Here is my understanding of why such an issue happened. If you look into the code, you will find out fsi.exe actually references System.Windows.Forms, which further links to the Window system. In my case, I ran fsi in a server without X system installed. Consequently, fsi stuck there trying to talk to the nonexistent X. That explains why I don't have the issue in my desktop.

    0 讨论(0)
提交回复
热议问题