在mkbundle

时间:2018-02-13 02:14:21

标签: c# mono arm cross-compiling mkbundle

在此发布作为最后的手段。欢迎所有支持。

我正在尝试交叉编译armv5tejl目标设备的独立单声道应用程序,我无法修改操作系统或系统文件夹。从mkbundle执行输出(可执行应用程序)时的目标设备响应看起来好像正在运行单声道命令而不是应用程序(见下文)。

我在谷歌和这里搜索并发布到单一邮件列表但尚未回复。我尝试了很多mkbundle和switch迭代。

在其他链接中,我发现了这个Mono return error: mono mscorlib.dll was not found,但它没有帮助,因为我无法修改目标机器,我正在尝试将单一运行时与应用程序捆绑在一起,因此它是自包含的。

我读了这个http://www.mono-project.com/archived/guiderunning_mono_applications/,我注意到的一件事是,此页面上mkbundle的输出列出了嵌入的字样,而我只看到尝试加载程序集'

我有一个简单的Hello World项目

使用System;

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

我使用Ubuntu 64位VM中的MonoDevelop编译.Net 4.6.1以提供和et2.exe和et2.mdb文件。

然后我运行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

运行'文件应用'给出

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

当我将文件应用程序复制到目标设备并尝试执行时,我得到以下响应,看起来好像我正在执行单声道,但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#

如果我尝试&#39; ./ app app&#39;在目标设备上我得到了

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#

运行&#39; ldd app&#39;在目标设备上给出

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#

跑步&#39; uname -a&#39;在目标设备上给出

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

一些注释

    1. 我搜索并搜索了
    1. 我读过有关mkbundle和&#34; man mkbundle&#34;并阅读单声道网站上的许多文件
    1. 我只能修改目标设备上的一个文件夹
    1. 无法安装单声道或更新目标设备。
    1. 我不知道为什么./app app在mscbundle看起来嵌入应用程序时正在寻找mscorlib.dll,(可能是错误的 版本?)
    1. 使用单声道版
    2. user @ ubuntu:〜/ dev / tmp $ mono --version Mono JIT编译器版本5.8.0.108(tarball Fri Jan 19 18:15:21 UTC 2018) 版权所有(C)2002-2014 Novell,Inc,Xamarin Inc和Contributors。 www.mono-project.com     TLS:__thread     SIGSEGV:altstack     通知:epoll     架构:amd64     禁用:无     杂项:softdebug     LLVM:支持,未启用。     GC:sgen(默认并发)

      1. 用于开发信息的VM user @ ubuntu:〜/ dev / tmp $ uname -a Linux ubuntu 4.13.0-32-generic#35~16.04.1-Ubuntu SMP Thu 1月25日10:13:43 UTC 2018 x86_64 x86_64 x86_64 GNU / Linux

感谢任何阅读此内容并提出建议或可以提供帮助的人。

twgcim1

编辑,更新

如果我将mscorlib.dll从/usr/lib/mono/4.5/mscorlib.dll复制到与目标设备中的应用相同的文件夹,并设置MONO_PATH=. 然后在尝试执行./app app时,我得到以下回复

Cannot open assembly 'app': File does not contain a valid CIL image.

0 个答案:

没有答案