mscorlib.dll was not found on target when using --static option in mkbundle

Posting here as a last resort. Welcome all support.

I am attempting to cross compile a standalone mono app for armv5tejl target device that I cannot modify the OS or system folders. The target device response when executing the output (executable app) from mkbundle looks as if the mono command is being run and not the app (see below).

I have searched on google and here and posted to mono mail-list with no response yet. I have tried many iterations of mkbundle and switches.

Among other links I found this Mono return error: mono mscorlib.dll was not found but it doesn't help as I cannot modify the target machine and I am trying to bundle mono runtime with the app so it is self contained.

I read this http://www.mono-project.com/archived/guiderunning_mono_applications/ and one thing I noticed is that the output from mkbundle on this page lists the words embedding whereas I see only 'attempting to load assembly'

I have a simple Hello World project

using System;

namespace et2 { class MainClass { public static void Main (string[] args) { Console.WriteLine ("Hello World!"); } } }

That I compile with MonoDevelop in Ubuntu 64-bit VM for .Net 4.6.1 to give and et2.exe and et2.mdb file.

I then run mkbundle

sudo mkbundle --static --cross mono-5.8.0-debian-8-armel $2 -o /tmp/app -v --deps --config /etc/mono/config --machine-config /etc/mono/2.0/machine.config

and get the following results

WARNING:
  Check that the machine.config file you are bundling
  doesn't contain sensitive information specific to this machine.
From: /home/user/.mono/targets/mono-5.8.0-debian-7-armel
OS is: Linux
Sources: 1 Auto-dependencies: True
Attempting to load assembly: et2.exe
Assembly et2.exe loaded successfully.
Attempting to load assembly from: ./I18N.West.dll
Attempting to load assembly from: /home/user/.mono/targets/mono-5.8.0-debian-7-armel/lib/mono/4.5/I18N.West.dll
Attempting to load assembly from: ./I18N.dll
Attempting to load assembly from: /home/user/.mono/targets/mono-5.8.0-debian-7-armel/lib/mono/4.5/I18N.dll
Attempting to load assembly from: ./mscorlib
Attempting to load assembly from: /home/user/.mono/targets/mono-5.8.0-debian-7-armel/lib/mono/4.5/mscorlib
Attempting to load assembly from: ./mscorlib
Attempting to load assembly from: /home/user/.mono/targets/mono-5.8.0-debian-7-armel/lib/mono/4.5/mscorlib
Attempting to load assembly from: ./I18N
Attempting to load assembly from: /home/user/.mono/targets/mono-5.8.0-debian-7-armel/lib/mono/4.5/I18N
Attempting to load assembly from: ./mscorlib
Attempting to load assembly from: /home/user/.mono/targets/mono-5.8.0-debian-7-armel/lib/mono/4.5/mscorlib
Using runtime: /home/user/.mono/targets/mono-5.8.0-debian-7-armel/bin/mono
At 0 with input 3308440
At 328000 with input 4608
     Assembly: /home/user/dev/et2/et2.exe
At 32a000 with input 3891712
     Assembly: /home/user/.mono/targets/mono-5.8.0-debian-7-armel/lib/mono/4.5/mscorlib.dll
At 6e1000 with input 72192
     Assembly: /home/user/.mono/targets/mono-5.8.0-debian-7-armel/lib/mono/4.5/I18N.West.dll
At 6f3000 with input 38912
     Assembly: /home/user/.mono/targets/mono-5.8.0-debian-7-armel/lib/mono/4.5/I18N.dll
At 6fd000 with input 2797
systemconfig: /etc/mono/config
At 6fe000 with input 34053
machineconfig: /etc/mono/4.5/machine.config
assembly:et2.exe at (3309568, 4608)
assembly:mscorlib.dll at (3317760, 3891712)
assembly:I18N.West.dll at (7213056, 72192)
assembly:I18N.dll at (7286784, 38912)
systemconfig: at (7327744, 2797)
machineconfig: at (7331840, 34053)
Generated /home/user/dev/tmp/app

running 'file app' gives

app: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.3, for GNU/Linux 2.6.26, BuildID[sha1]=2a2d299a01c95dc50ff7c3db65c390234c0cd8bd, stripped

When I copy the file app to the target device and try to execute I get the following response that looks as if I am executing mono but app should be the bundled app.

root@device:/cust# ./app
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)
    --handlers             Install custom handlers, use --help-handlers for details.
    --aot-path=PATH        List of additional directories to search for AOT images.
root@device:/cust#

If I try './app app' on the target device I get

root@device:/cust# ./app app
The assembly mscorlib.dll was not found or could not be loaded.
It should have been installed in the `/usr/lib/mono/4.5/mscorlib.dll' directory.
root@device:/cust#

running 'ldd app' on the target device gives

root@device:/cust# ldd app
        libm.so.6 => /lib/libm.so.6 (0x4014a000)
        librt.so.1 => /lib/librt.so.1 (0x4008f000)
        libdl.so.2 => /lib/libdl.so.2 (0x4011c000)
        libpthread.so.0 => /lib/libpthread.so.0 (0x400ba000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x4002f000)
        libc.so.6 => /lib/libc.so.6 (0x401fb000)
        /lib/ld-linux.so.3 (0x4005e000)
root@device:/cust#

running 'uname -a' on the target device gives

root@device:/cust# uname -a
Linux device 2.6.39.4 #2 PREEMPT Tue Jan 24 16:46:54 UTC 2017 armv5tejl GNU/Linux

Some notes

    1. I have searched and searched
    1. I have read about mkbundle and "man mkbundle" and read many documents on mono website
    1. I only have access to modify one folder on the target device
    1. Installing mono or updating the target device is not an option.
    1. I am not sure why ./app app is looking for mscorlib.dll when it looks to be embedded in the app by mkbundle, (possible wrong version?)
    1. Mono version used

    user@ubuntu:~/dev/tmp$ mono --version Mono JIT compiler version 5.8.0.108 (tarball Fri Jan 19 18:15:21 UTC 2018) Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com TLS: __thread SIGSEGV: altstack Notifications: epoll Architecture: amd64 Disabled: none Misc: softdebug LLVM: supported, not enabled. GC: sgen (concurrent by default)

    1. VM used for development info user@ubuntu:~/dev/tmp$ uname -a Linux ubuntu 4.13.0-32-generic #35~16.04.1-Ubuntu SMP Thu Jan 25 10:13:43 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

Thanks to anyone who reads this and has suggestions or can help.

twgcim1