Bug 27701 - When we use mkbundle to make a native executable, sometimes it will throw exception about "msvcrt" not found
Summary: When we use mkbundle to make a native executable, sometimes it will throw exc...
Status: RESOLVED INVALID
Alias: None
Product: Runtime
Classification: Mono
Component: Tools ()
Version: 3.12.0
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-03-05 10:33 UTC by Prashant Cholachagudda
Modified: 2015-04-02 14:28 UTC (History)
4 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED INVALID

Description Prashant Cholachagudda 2015-03-05 10:33:06 UTC
Customer made an mono application and uses mkbundle to make a native executable
when we run the application on target machine sometimes it will throw exception about "msvcrt" not found.

Here is the mono debug log when running on target machine:https://gist.github.com/prashantvc/f29cf0439d8018df87ed

Sample code:

public static void Main (string[] args)
{
if (args.Length != 1) {
Console.WriteLine ("Usage: msvcrtException <test file Path>");
return;
}
Mono.Unix.UnixSymbolicLinkInfo i = new Mono.Unix.UnixSymbolicLinkInfo( args[0] ) ;
if (i.IsRegularFile)
Console.WriteLine ("'{0}' is regular file", args [0]);
else
Console.WriteLine ("'{0}' is not regular file", args [0]);
}


Build log: https://gist.github.com/prashantvc/4884bcf5cace3788296a
Comment 2 Rodrigo Kumpera 2015-04-02 14:28:54 UTC
They need to bundle the configuration file as Mono.Posix needs it.

kumpera-13:mono-ps4 kumpera$ mkbundle --help
OS is: Darwin
Usage is: mkbundle [options] assembly1 [assembly2...]

Options:
    -c                  Produce stub only, do not compile
    -o out              Specifies output filename
    -oo obj             Specifies output filename for helper object file
    -L path             Adds `path' to the search path for assemblies
    --nodeps            Turns off automatic dependency embedding (default)
    --deps              Turns on automatic dependency embedding
    --keeptemp          Keeps the temporary files
    --config F          Bundle system config file `F'
    --config-dir D      Set MONO_CFG_DIR to `D'
    --machine-config F  Use the given file as the machine.config for the application.
    --static            Statically link to mono libs
    --nomain            Don't include a main() function, for libraries
    -z                  Compress the assemblies before embedding.
    --skip-scan         Skip scanning assemblies that could not be loaded (but still embed them).
    --static-ctor ctor  Add a constructor call to the supplied function.
                        You need zlib development headers and libraries.



They need to use the --config option.

Bundling the system config file should be enough. It's located in: /Library/Frameworks/Mono.framework/Versions/Current/etc/mono/config