[Mono-list] Pass arguments to executable generated by mkbundle

Miguel de Icaza miguel at microsoft.com
Thu Nov 3 02:52:04 UTC 2016


Hello Samuel,

This is a bug in the mkbundle support, I will look into it.

Miguel.

From: Mono-list <mono-list-bounces at lists.dot.net> on behalf of Samuel El-Borai <samuel.elborai at gmail.com>
Date: Sunday, October 30, 2016 at 9:19 AM
To: "mono-list at lists.dot.net" <mono-list at lists.dot.net>
Subject: [Mono-list] Pass arguments to executable generated by mkbundle


Hi the mailing list,

I’m trying to use mkbundle to generate a single file executable for my project. It works great so far but I cannot find a way to pass arguments to my program.

I’m using it like this:

1 - Compile my project via Xamarin studio

2 - Merge assemblies into a single assembly with ILRepack<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fgluck%2Fil-repack&data=02%7C01%7Cmiguel%40microsoft.com%7C0966830656764d37d78908d400c76131%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636134303711813038&sdata=NSaKb9Y4MuyiPoAqwSTYnMp4X88nlGBx6SFoNey4IAE%3D&reserved=0>

$ mono ~/.config/NuGet/packages/ILRepack.2.0.12/tools/ILRepack.exe /internalize /parallel /targetplatform:v4 /verbose /out:myapp MyApp.exe *.dll

3 - Create a bundle containing my assembly and the mono runtime

$ mkbundle --simple --cross 4.6.1-linux-libc2.12-amd64 -o myapp_out ./myapp

At this point I can run ./myapp_out and it works. But when I try to pass arguments I have an error:

# I run the app without arguments, it works as expected

$ ./myapp_out

c-Found: config:myapp 8f1000

ERROR: missing parameter '--keys'.

USAGE: myapp [--help] --keys [<KEYS>...]



OPTIONS:



    --keys [<KEYS>…]    Keys to process

    --help                display this list of options.



# I try to run it with an argument, it fails

$ ./myapp_out --keys test_key

c-Found: config:myapp 8f1000

Unknown command line option: '--keys'



# If I run it with `--help` I get the help from `mono`

$ ./myapp_out --help

Usage is: mono [options] program [program-options]



Development:

    --aot[=<options>]      Compiles the assembly to native code

    --debug[=<options>]    Enable debugging support, use --help-debug for details

    --debugger-agent=options Enable the debugger agent

    --profile[=profiler]   Runs in profiling mode with the specified profiler module

    --trace[=EXPR]         Enable tracing, use --help-trace for details

    --jitmap               Output a jit method map to /tmp/perf-PID.map

    --help-devel           Shows more options available to developers



Runtime:

    --config FILE          Loads FILE as the Mono config

    --verbose, -v          Increases the verbosity level

    --help, -h             Show usage information

    --version, -V          Show version information

    --runtime=VERSION      Use the VERSION runtime, instead of autodetecting

    --optimize=OPT         Turns on or off a specific optimization

                           Use --list-opt to get a list of optimizations

    --security[=mode]      Turns on the unsupported security manager (off by default)

                           mode is one of cas, core-clr, verifiable or validil

    --attach=OPTIONS       Pass OPTIONS to the attach agent in the runtime.

                           Currently the only supported option is 'disable'.

    --llvm, --nollvm       Controls whenever the runtime uses LLVM to compile code.

    --gc=[sgen,boehm]      Select SGen or Boehm GC (runs mono or mono-sgen)

    --arch=[32,64]         Select architecture (runs mono32 or mono64)

Any guidance would be appreciated.

Cheers,

Samuel El-Borai
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.dot.net/pipermail/mono-list/attachments/20161103/74f4f07e/attachment-0001.html>


More information about the Mono-list mailing list