I'm trying to bundle an application I've made in monodevelop on archlinux.
Once I build the application in monodevelop I go to make a bundle with the following command:
mkbundle --deps file.exe --static
But the output is:
OS is: Linux
Note that statically linking the LGPL Mono runtime has more licensing restrictions than dynamically linking.
See http://www.mono-project.com/Licensing for details on licensing.
Sources: 1 Auto-dependencies: True
embedding: /home/test/Test/Test/bin/Release/file.exe
embedding: /usr/lib/mono/gac/gtk-sharp/2.12.0.0__35e10195dab3c99f/gtk-sharp.dll
config from: /usr/lib/mono/gac/gtk-sharp/2.12.0.0__35e10195dab3c99f/gtk-sharp.dll.config
embedding: /usr/lib/mono/4.5/mscorlib.dll
embedding: /usr/lib/mono/gac/gdk-sharp/2.12.0.0__35e10195dab3c99f/gdk-sharp.dll
config from: /usr/lib/mono/gac/gdk-sharp/2.12.0.0__35e10195dab3c99f/gdk-sharp.dll.config
embedding: /usr/lib/mono/gac/glib-sharp/2.12.0.0__35e10195dab3c99f/glib-sharp.dll
config from: /usr/lib/mono/gac/glib-sharp/2.12.0.0__35e10195dab3c99f/glib-sharp.dll.config
embedding: /usr/lib/mono/gac/System/4.0.0.0__b77a5c561934e089/System.dll
embedding: /usr/lib/mono/gac/Mono.Security/4.0.0.0__0738eb9f132ed756/Mono.Security.dll
embedding: /usr/lib/mono/gac/System.Configuration/4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
embedding: /usr/lib/mono/gac/System.Xml/4.0.0.0__b77a5c561934e089/System.Xml.dll
embedding: /usr/lib/mono/gac/System.Security/4.0.0.0__b03f5f7f11d50a3a/System.Security.dll
embedding: /usr/lib/mono/gac/Mono.Cairo/4.0.0.0__0738eb9f132ed756/Mono.Cairo.dll
embedding: /usr/lib/mono/gac/pango-sharp/2.12.0.0__35e10195dab3c99f/pango-sharp.dll
config from: /usr/lib/mono/gac/pango-sharp/2.12.0.0__35e10195dab3c99f/pango-sharp.dll.config
embedding: /usr/lib/mono/gac/atk-sharp/2.12.0.0__35e10195dab3c99f/atk-sharp.dll
config from: /usr/lib/mono/gac/atk-sharp/2.12.0.0__35e10195dab3c99f/atk-sharp.dll.config
embedding: /usr/lib/mono/gac/Mono.Posix/4.0.0.0__0738eb9f132ed756/Mono.Posix.dll
Compiling:
AS = as (default)
as -o temp.o temp.s
as -o temp.o temp.s
Unhandled Exception:
System.ComponentModel.Win32Exception: ApplicationName='cmd', CommandLine='/c "as -o temp.o temp.s "', CurrentDirectory='', Native error= Cannot find the specified file
at System.Diagnostics.Process.Start_noshell (System.Diagnostics.ProcessStartInfo startInfo, System.Diagnostics.Process process) <0x40c2f420 + 0x00637> in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.ComponentModel.Win32Exception: ApplicationName='cmd', CommandLine='/c "as -o temp.o temp.s "', CurrentDirectory='', Native error= Cannot find the specified file
at System.Diagnostics.Process.Start_noshell (System.Diagnostics.ProcessStartInfo startInfo, System.Diagnostics.Process process) <0x40c2f420 + 0x00637> in <filename unknown>:0
Being that I'm statically linking mono I had to install mono-git from the AUR to ensure I had the static libraries.
I'm also not sure why it has two as -o temp.o temp.s
listed.
Any help would be appreciated.
EDIT 23NOV:
I have just re-confirmed that as
and cc
have been installed. The version output is located at: http://pastebin.com/ka25tjWZ
EDIT 24NOV: As explained in the accepted answer; my mono wasn't compiled correctly. I rebuilt using abs with the following PKGBUILD and its now working as expected.
# $Id: PKGBUILD 246414 2015-09-16 21:25:15Z daniel $
# Maintainer: Daniel Isenmann <daniel@archlinux.org>
# Contributor: Brice Carpentier <brice@dlfp.org>
pkgname=mono
pkgver=4.0.4.1
_pkgver=4.0.4
pkgrel=1
pkgdesc="Free implementation of the .NET platform including runtime and compiler"
arch=(i686 x86_64)
license=('GPL' 'LGPL2.1' 'MPL' 'custom:MITX11')
url="http://www.mono-project.com/"
depends=('zlib' 'libgdiplus>=3.8' 'sh' 'python' 'ca-certificates')
options=('!makeflags' 'staticlibs')
provides=('monodoc')
conflicts=('monodoc')
source=(http://download.mono-project.com/sources/mono/${pkgname}-${pkgver}.tar.bz2
mono.binfmt.d
sgen_fix.patch
build_fix.patch
Microsoft.Portable.Common.targets
fix-zlib-helper.patch)
md5sums=('f598b60a664dfebb1a5eef3e66a9a178'
'b9ef8a65fea497acf176cca16c1e2402'
'8a700b94bff7a913f920e95890d2fb4c'
'30a5af1a4ff50b98f9e73cc2ae554115'
'acbffadb0ac233c494b40dd5e79209a5'
'62912ad289535bf841c140727e5c1165')
install="${pkgname}.install"
build() {
cd "${srcdir}"/${pkgname}-${_pkgver}
# build mono
./configure --prefix=/usr \
--sysconfdir=/etc \
--bindir=/usr/bin \
--sbindir=/usr/bin \
--disable-quiet-build \
--disable-system-aot \
--enable-static \
--with-static_mono=yes \
--with-mcs-docs=no
make
# build jay
cd "${srcdir}"/${pkgname}-${_pkgver}/mcs/jay
make
}
package() {
cd "${srcdir}"/${pkgname}-${_pkgver}
make DESTDIR="${pkgdir}" install
# install jay
pushd "${srcdir}"/${pkgname}-${_pkgver}/mcs/jay
make DESTDIR="${pkgdir}" prefix=/usr INSTALL=../../install-sh install
popd
# install binfmt conf file and pathes
install -D -m644 "${srcdir}"/mono.binfmt.d "${pkgdir}"/usr/lib/binfmt.d/mono.conf
#install license
mkdir -p "${pkgdir}"/usr/share/licenses/${pkgname}
install -m644 mcs/MIT.X11 "${pkgdir}"/usr/share/licenses/${pkgname}/
#fix .pc file to be able to request mono on what it depends, fixes #go-oo build
sed -i -e "s:#Requires:Requires:" "${pkgdir}"/usr/lib/pkgconfig/mono.pc
}
Update:
So I ssh'd a friend's ArchLinux and mkbundle
works fine there, so I went back to your error:
System.ComponentModel.Win32Exception: ApplicationName='cmd', CommandLine='/c "as -o temp.o temp.s "', CurrentDirectory='', Native error= Cannot find the specified file at System.Diagnostics.Process.Start_noshell
Originally I thought you were on Windows due to this error, but you said Linux so I disregarded it. I went to the source of mkbundle
and I can see that your ArchLinux box and/or the Mono install is not correctly reporting the 'IsUnix' as false
and thus it is not executing the AS cmd via a system
call but is trying to use the Windows' cmd
to execute it and thus is failing....
static bool IsUnix {
get {
int p = (int) Environment.OSVersion.Platform;
return ((p == 4) || (p == 128) || (p == 6));
}
}
static void Execute (string cmdLine)
{
if (IsUnix) {
Console.WriteLine (cmdLine);
int ret = system (cmdLine);
if (ret != 0)
{
Again, the ArchLinux 4.2.5-1 that I have access to has Mono 4.0.4.1 and works as expected.....
What is returned on your system for each of these lines?:
int p = (int) Environment.OSVersion.Platform;
var islinux = ((p == 4) || (p == 128) || (p == 6));
Original:
ENVIRONMENT VARIABLES
AS Assembler command. The default is "as". CC C compiler command. The default is "cc" under Linux and "gcc" under Windows.
Ref: man mkbundle
This is the same requirement as you would need if you were building mono itself, besides the temp.s
assembler code it will also create temp.c
file that needs a c compiler. This is the bootstrap code to load/execute your CIL-based code.
If you are missing an assembler on your system, there are a number of packages, such as binutils
that will satisfy the requirement.