mkbundle System.ComponentModel.Win32Exception error - linux

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.

Related

How to build libXrender

I get an error when configuring the libXrender package
checking for RENDER... configure: error: Package requirements (x11 renderproto >= 0.9) were not met:
No package 'x11' found
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables RENDER_CFLAGS
and RENDER_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
my configure is
./configure --prefix=/tmp/instigate-software/gnu_system/3.2/x86_64/
but when I write echo $PKG_CONFIG_PATH I get
/tmp/instigate-software/gnu_system/3.2/x86_64/lib/pkgconfig
this is what is contained in the pkgconfig folder
ls /tmp/instigate-software/gnu_system/3.2/x86_64/lib/pkgconfig/
bigreqsproto.pc freetype2.pc libpng16.pc mpfr.pc recordproto.pc videoproto.pc xcb-proto.pc xcb-sync.pc xcb-xv.pc
binutils.pc gettext.pc libpng.pc ncurses.pc renderproto.pc xau.pc xcb-randr.pc xcb-xevie.pc xcmiscproto.pc
bison.pc glproto.pc libtiff-4.pc pciaccess.pc resourceproto.pc xcb-composite.pc xcb-record.pc xcb-xf86dri.pc xdmcp.pc
compositeproto.pc gmp.pc libxcb.pc pixman-1.pc scrnsaverproto.pc xcb-damage.pc xcb-render.pc xcb-xfixes.pc xextproto.pc
damageproto.pc ice.pc libXdmcp.pc pthread-stubs.pc sigc++-2.0.pc xcb-dpms.pc xcb-res.pc xcb-xinerama.pc xf86driproto.pc
expat.pc inputproto.pc libxml-2.0.pc python-2.7.pc sm.pc xcb-dri2.pc xcb-screensaver.pc xcb-xprint.pc xineramaproto.pc
fixesproto.pc kbproto.pc libxslt.pc python.pc stdc++.pc xcb-glx.pc xcb-shape.pc xcb-xtest.pc xproto.pc
fontsproto.pc libexslt.pc m4.pc randrproto.pc tiff.pc xcb.pc xcb-shm.pc xcb-xvmc.pc zlib.pc
and this is what is contained in the renderproto.pc file
prefix=/tmp/instigate-software/gnu_system/3.2/x86_64
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
Name: RenderProto
Description: Render extension headers
Version: 0.11
Cflags: -I${includedir}
from what can it be ?

Add wilc3000 driver to Yocto raspberry pi

I want to build my own yocto image for a raspberry (cm3). I use the meta-raspberry (dunfell) layer and poky dunfell-23.0.0.
For installing the microchip wilc3000 module I have to modify the kernel following this guide. In that way, I change the kernel conf (Kconfig) to add the mchp driver in the menu and later selecting it.
I have generated a patch to the kernel using this guide (Patch-based workflow). After generating the patch, I have modified and generated a new kernel config (defconfig). All the changes are applied in my own layer with this recipe (linux-raspberrypi_%.bbappend):
FILESEXTRAPATHS_prepend := "${THISDIR}/patchs:"
SRC_URI += "file://0001-Add-wilc3000-driver.patch \
file://defconfig_my \
"
PACKAGE_ARCH = "${MACHINE_ARCH}"
# PR="r2"
INTREE_DEFCONFIG_pn-linux-ti = "defconfig_my"
kmoddir = "/lib/modules/${KERNEL_VERSION}/kernel/drivers/net/wireless/mchp"
# do_configure_append() {
# cat ${WORKDIR}/*.cfg >> ${B}/.config
# }
do_install_append() {
install -d ${D}${kmoddir}
install -m 0755 ${WORKDIR}/wilc-spi.ko ${D}${kmoddir}
}
FILES_${PN}_append += " \
${kmoddir}/wilc-spi.ko \
"
The patchs folder contains the patch for the kernel and the new kernel configuration generated
When I generate the image:
bitbake -v core-image-base
The generation fails in do_install task when it tries to copy wilc-spi.ko, which is not generated.
Which is the way to compile and deploy the kernel with my own configuration? if I download and compile the kernel in a separate folder, it successfully generates the wilc-spi.ko, but inside build folder in yocto there is no trace of the file generation.
Please, help me to add this driver to the kernel, Thanks a lot.
As #qschulz pointed out, the solution was to change defconfig_my to defconfig and remove all the extra code. Finally, the code looks like this:
FILESEXTRAPATHS_prepend := "${THISDIR}/patchs:"
SRC_URI += "file://0001-Add-wilc3000-driver.patch \
file://defconfig \
"
PACKAGE_ARCH = "${MACHINE_ARCH}"
PR="r3"
FILES_${PN}_append += " \
${kmoddir}/wilc-spi.ko \
"
KERNEL_MODULE_AUTOLOAD += "wilc-spi.ko"
And add in the layer.conf the instruction to load the module:
MACHINE_EXTRA_RDEPENDS += " kernel-module-wilc-spi "

How to put an extra file in the kernel image by yocto

I have a trouble of putting my initramfs.cpio in my kernel image by yocto.
I have two bb files, one is used to build an initramfs, and the other one is used to build a fitimage.
I successful to build the fitimage bundled with my initramfs image.
But it always failed to build a fitImage that has an initramfs.cpio.gz in the /usr directory in the fitImage.
( I mean, I want to see a file named initramfs.cpio in the /usr when I use my fitImage booting to console )
====================================================================
Here are my error message..
ERROR: linux-mine-1_4.9.27+gitAUTOINC+d87116e608-r0 do_package: QA Issue: linux-mine: Files/directories were installed but not shipped in any package:
/usr
/usr/initramfs-mine-qemu.cpio
Please set FILES such that these items are packaged. Alternatively if they are unneeded, avoid installing them or delete them within do_install.
linux-mine: 2 installed and not shipped files. [installed-vs-shipped]
ERROR: linux-mine-1_4.9.27+gitAUTOINC+d87116e608-r0 do_package: Fatal QA errors found, failing task.
ERROR: linux-mine-1_4.9.27+gitAUTOINC+d87116e608-r0 do_package: Function failed: do_package
ERROR: Logfile of failure stored in: /home/paul/projects/Test/yocto/build/tmp/work/mine-poky-linux-gnueabi/linux-mine/1_4.9.27+gitAUTOINC+d87116e608-r0/temp/log.do_package.26149
ERROR: Task (/home/paul/projects/Test/yocto/yocto-2.2/poky/../meta-mine/recipes-kernel/linux/linux-mine_4.9.bb:do_package) failed with exit code '1'
====================================================================
Here is my kernel image bb file
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}-${PV}:"
LINUX_VERSION ?= "4.9.27"
SRCREV = "d87116e608e94ad684b5e94d46c892e33b9e2d78"
SRC_URI = "git://local/kernel;protocol=ssh;branch=master"
#FILES_${PN} += "/usr /usr/initramfs-mine-${MACHINE_ARCH}.cpio"
#FILES_${PN}-${PV} += "/usr /usr/initramfs-mine-${MACHINE_ARCH}.cpio"
#IMAGE_INSTALL = "initramfs-mine"
do_install_append () {
echo "WangPaul : S=[${S}]"
echo "WangPaul : B=[${B}]"
echo "WangPaul : D=[${D}]"
install -d ${D}/usr/
install -m 0444 ${B}/usr/initramfs-mine-${MACHINE_ARCH}.cpio ${D}/usr/
}
====================================================================
Here is my initramfs bb file
LICENSE = "GPLv2"
PACKAGE_INSTALL = "initramfs-live-boot ${VIRTUAL-RUNTIME_base-utils} udev ${ROOTFS_BOOTSTRAP_INSTALL}"
IMAGE_FSTYPES = "${INITRAMFS_FSTYPES}"
inherit core-image
====================================================================
I have found similar questions:
Ship extra files in kernel module recipe and
An example of using FILES_${PN}
The way in aboves discussion are not work...
Any information would be appreciate !!
Thanks !!
The error seems to QA issues it means the source is compiled but not adding to rootfs. Add below line to yourkernel-image.bb. it will solve the issue.
FILES_${PN} += "${exec_prefix}/*"
Note: may be In your kernel.bb file you have given wrong format

How to install tsim-0.84 on Windows 10 with Cygwin?

For a laboration in class we are using an old train simulator for Linux called tsim. I am trying to get this to run on my Windows 10 laptop with Cygwin but I get an error when running the "make" command.
AddToggleWidget.c:3:27: fatal error: X11/Intrinsic.h: No such file or directory
The thing is I think the simulator is so old that it wants to use this X11/Intrinsic.h from an old library called xorg-x11-devel. Because I already have it in a newer one called libXt-devel. This is based on this old cygwin thread.
I have looked everywhere for a way to get the xorg-x11-devel library but can't find it so any help would be greatly appreciated.
The laboration.
The Train Simulator, tsim(source code).
You need to install the libXt-devel package.
To verify if the libXt-devel is properly installed
$ cygcheck -c libXt-devel
Cygwin Package Information
Package Version Status
libXt-devel 1.1.5-1 OK
As it seems that instead your real problem is how to build tsim on cygwin and you are focusing on the wrong issue, I will also provide you the recipe I used.
The following patch is needed for proper build and link:
--- orig/tsim-0.84/src/Makefile.am 2008-09-10 12:45:17.000000000 +0200
+++ tsim-0.84/src/Makefile.am 2016-09-05 22:06:47.665318000 +0200
## -11,5 +11,6 ##
tsim_CFLAGS = -std=gnu99 -pedantic -Wall -Wextra -Wmissing-prototypes \
-DRESDIR=\"${datadir}/tsim\"
-tsim_LDFLAGS = -L/usr/X11R6/lib -lXaw -lXt -lXmu -lX11 -lXext
+tsim_LDFLAGS = -L/usr/lib
+tsim_LDADD = -largp
--- orig/tsim-0.84/src/bitmap.c 2008-09-08 13:14:16.000000000 +0200
+++ tsim-0.84/src/bitmap.c 2016-09-05 22:14:02.032117400 +0200
## -17,14 +17,14 ##
static void GetBitmapPath(
String name,
String full_name) {
- sprintf(full_name, "%s/%s/%s", app_dir(), bitmap_dir(), name);
+ sprintf(full_name, "%s%s/%s", app_dir(), bitmap_dir(), name);
}
void ReadCustomBitmaps(
Widget w) {
char custom_directory[BUFSIZE];
- sprintf(custom_directory, "%s/%s/customBitmaps", app_dir(), bitmap_dir());
+ sprintf(custom_directory, "%s%s/customBitmaps", app_dir(), bitmap_dir());
gBitmapDirectory = BDAddDirectory(w, custom_directory, NULL);
}
--- orig/tsim-0.84/src/pipe.c 2008-09-09 12:55:58.000000000 +0200
+++ tsim-0.84/src/pipe.c 2016-09-05 18:47:40.261754300 +0200
## -3,6 +3,7 ##
#include <stdlib.h> /* exit */
#include <unistd.h> /* read */
#include <sys/param.h> /* MIN, MAX */
+#include <sys/socket.h>
#if defined sun3 || defined sun4
#include <sys/filio.h>
Makefile.am is changed as /usr/X11R6/lib has been replace long time ago by /usr/lib and the libs should be put in LDADD not on LDFLAGS to avoid problem of order durink linking . -largp is missing from the requirement while the the other libs will be correctly added during configure
The changes in bitmap.c are needed to avoid wrongly loading default data. Cygwin have a dedicate meaning for path starting with "//" that are a side effect of current code.
Step by step instruction:
- install libargp-devel, libX11-devel, libXaw-devel, libXext-devel, libXmu-devel, libXt-devel
- unpack the tsim-0.84.tar.gz
- apply the patch
- run autoreconf , it will properly rebuilds the Makefile.in
- run ./configure it will properly rebuilds the Makefile
- run make
- run make install
- run tsim
As bonus, how the program looks:

How to list the packages installed in a target rootfs built using oe-core?

For documentary purpose,
I am looking for efficient ways to list the packages installed in a target rootfs built using oe-core.
The list of packages installed in your image is stored in the manifest file (besides of build history which is already mentioned).
Content of the manifest file looks like:
alsa-conf cortexa7hf-neon-vfpv4 1.1.2-r0.1
alsa-conf-base cortexa7hf-neon-vfpv4 1.1.2-r0.1
alsa-lib cortexa7hf-neon-vfpv4 1.1.2-r0.1
alsa-states cortexa7hf-neon-vfpv4 0.2.0-r5.1
alsa-utils-alsactl cortexa7hf-neon-vfpv4 1.1.2-r0.5
alsa-utils-alsamixer cortexa7hf-neon-vfpv4 1.1.2-r0.5
...
The list consists of the package name, architecture and a version.
That manifest is located in the deploy directory (i.e. deploy/images/${MACHINE}/). Here as an example of the directory listing (there are target images and the manifest file)
example-image-genericx86.ext3
example-image-genericx86.manifest
example-image-genericx86.tar.bz2
USER_CLASSES ?= "buildname image-mklibs image-prelink buildhistory"
ERROR: Error executing a python function in /opt/apps_proc/oe-core/meta/recipes-core/eglibc/eglibc_2.17.bb:
The stack trace of python calls that resulted in this exception/failure was:
File: 'buildhistory_emit_pkghistory', lineno: 216, function:
0212:
0213: write_pkghistory(pkginfo, d)
0214:
0215:
***0216:buildhistory_emit_pkghistory(d)
0217:
File: 'buildhistory_emit_pkghistory', lineno: 207, function: buildhistory_emit_pkghistory
0203: filelist = []
0204: pkginfo.size = 0
0205: for f in pkgfiles[pkg]:
0206: relpth = os.path.relpath(f, pkgdestpkg)
***0207: fstat = os.lstat(f)
0208: pkginfo.size += fstat.st_size
0209: filelist.append(os.sep + relpth)
0210: filelist.sort()
0211: pkginfo.filelist = " ".join(filelist)
Exception: OSError: [Errno 2] No such file or directory: '/opt/apps_proc/oe-core/build/tmp-eglibc/work/armv7a-vfp-neon-oe-linux-gnueabi/eglibc/2.17-r3/packages-split/eglibc-thread-db/lib/libthread_db-1.0.so'
ERROR: Function failed: buildhistory_emit_pkghistory
Add build history to your USER_CLASSES variable in local.conf
USER_CLASSES ?= "buildhistory"
After you rerun the build look in build/buildhistory for more info.
You may need to force rebuilds to properly populate the directory.

Resources