[Mono-list] Fwd: mscorlib.dll was not found on target when using --static option in mkbundle

TWG CIM twgcim1 at gmail.com
Tue Feb 6 21:06:14 UTC 2018


Hello,

Posting here after as a last resort.  Welcome all support.

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

I have a simple Hello World project

using System;

namespace et3
{
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 at 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 at device:/cust#

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

root at 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 at device:/cust#

running ldd app on the target device gives

root at 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 at device:/cust#

running uname -a on the target device gives

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

runing mono --version in build vm gives

user at 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)
user at ubuntu:~/dev/tmp$



Some notes
1.  I have searched and searched
2.  I have read about mkbundle and "man mkbundle"
3.  I only have access to modify one folder on the target device
4.  Installing mono or updating the target device is not an option.
5.  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?)
6.  I am using the latest updates from Ubuntu 16.04 and mono using apt-get
and updated mono repository




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

twgcim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.dot.net/pipermail/mono-list/attachments/20180206/9a8ee89d/attachment-0001.html>


More information about the Mono-list mailing list