2

在这里张贴作为最后的手段。欢迎大家支持。

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

我已经在谷歌和这里搜索并发布到单声道邮件列表,但还没有回复。我已经尝试过多次迭代 mkbundle 和 switch。

在其他链接中,我发现此Mono 返回错误:未找到 mono mscorlib.dll但它没有帮助,因为我无法修改目标机器,并且我正在尝试将 mono 运行时与应用程序捆绑在一起,因此它是自包含的。

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

我有一个简单的 Hello World 项目

使用系统;

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

我在 .Net 4.6.1 的 Ubuntu 64 位 VM 中使用 MonoDevelop 编译以提供 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

当我将文件应用程序复制到目标设备并尝试执行时,我得到以下响应,看起来好像我正在执行单声道,但应用程序应该是捆绑的应用程序。

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#

如果我在目标设备上尝试“./app app”,我会得到

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#

在目标设备上运行“ldd app”给出

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#

在目标设备上运行“uname -a”会给出

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 和“man mkbundle”的信息,并阅读了 mono 网站上的许多文档
    1. 我只能修改目标设备上的一个文件夹
    1. 安装单声道或更新目标设备不是一种选择。
    1. 我不确定为什么 ./app 应用程序在看起来被 mkbundle 嵌入到应用程序中时正在寻找 mscorlib.dll,(可能是错误的版本?)
    1. 使用的单声道版本

    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 和贡献者。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 Jan 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.
4

0 回答 0