Cross-platform Debian package testing - cross-platform

I am trying to test Debian packages which are built on an x86 Linux system, but which will be executed on an ARM architecture. My {pre,post}{inst,rm} scripts are failing with a "exec format error" because the /bin/bash in the chroot'd environment, which is an image of a flash filesystem, are ARM binaries, not x86 binaries.
What I'm looking for, but cannot find, is an option to dpkg which is like --root, but which doesn't use chroot. I'd presumably need to know the name of some environmental variable (?) which contains the name of the parameter to --root.

It's probably easier to make the /bin/bash (and everything else) in the chroot executable.
Install qemu-user-static on the host. That will give you QEMU user space emulators for all architectures in static versions — so no complications with dynamic libraries in the chroot. It also configures binfmt support to execute ARM binaries with /usr/bin/qemu-arm-static.
Copy /usr/bin/qemu-arm-static into the /usr/bin of the chroot. Now you should be able to chroot and run programs normally. That way your Debian packages can be tested chrooted into their (emulated) native environment.

Alternatively to the good suggestion to use qemu, starting with dpkg 1.18.5 you could use --instdir in conjunction with --force-script-chrootless. Depending on the maintainer scripts you might need to adapt them to make use of the DPKG_ROOT environment variable. There's more information in the dpkg man page.

Related

MSYS2: is a windows or unix environment?

I'm confused about the environment. Using MSYS2 under Windows, I want to compile, say, the boost library:
http://www.boost.org/users/history/version_1_64_0.html
What file I have to download? The one for Windows or the one for unix?
MSYS2 is a not a Unix environment. It is a hybrid environment made up of these main components:
POSIX-emulation layer called msys-2.0.dll, which is a fork of cygwin.
Tools like GNU Make, Bash, and ls that depend on the msys-2.0.dll runtime.
pacman, another msys-2.0.dll program, that lets you install precompiled packages from the MSYS2 developers.
Native Windows software, which lives under the /mingw32 (for 32-bit) and /mingw64 (for 64-bit) directories.
Anyway, it seems like you are just getting started with MSYS2 and don't know much about it. If your goal is to write native Windows software that could some day be used outside of MSYS2, you should install the native Windows version of Boost provided by the MSYS2 developers. So run one of the commands below:
pacman -S mingw-w64-i686-boost
or
pacman -S mingw-w64-x86_64-boost
Then make sure you are using the right flavor of MSYS2 shell, and make sure you install the corresponding GCC toolchain. For 32-bit development, you must launch MSYS2 with the "MinGW-w64 32-bit Shell" shortcut and use pacman to install mingw-w64-i686-toolchain (pacman -S mingw-w64-i686-toolchain).
If you try to download binaries from boost's website, you will likely run into all sorts of compatibility issues. It's better to use software built using an MSYS2 GCC toolchain, especially if MSYS2 already has a package for that software.

Linux or Windows version of a library in Cygwin?

I have developed some codes in Linux which use boost::serialization library. Now I want to copy my files into Cygwin and compile them to produce executable for Windows. I know that I should use Mingw-64 g++ compiler. But how about boost library? Should I download the Windows version or the Linux version of this library?
In Cygwin, you install Boost libraries as per Unix/Linux. From the documentation
Getting Started on Windows
A note to Cygwin and MinGW users
If you plan to use your tools from the Windows command prompt, you're in the right place.
If you plan to build from the Cygwin bash shell, you're actually running on a POSIX
platform and should follow the instructions for getting started on Unix variants.
Other command shells, such as MinGW's MSYS, are not supported—they may or may not work.

Run linux distro of choice inside existing distro

Just wondering if it's possible and what the best route might be to run a full-on Linux distro within my existing distro? It would be great to for instance run Arch Linux within a chroot, jail, etc.. I believe people are doing this on Chromium for example.
I would require that whatever fs loaded, I can install packages using pacman and that my changes are kept intact.
I have tried the Virtualbox route by the way and there is a pretty nasty bug involving double mouse pointers on rotated host screens that I can't seem to get around.
I should mention that I'll be using this chroot environment for development, maybe running the odd X client to be exported remotely, etc..
I followed the chroot guide at https://wiki.archlinux.org/index.php/Change_Root and basically installed a whole Arch system within a nested chroot according to the Arch Linux installation guide and I'm now able to switch to the environment at will.
There is a tool https://github.com/fsquillace/junest that does everything automatically for you (downloads and unpacks ArchLinux distro inside some folder and chroots there).

How to install recent mono and monodevelop?

I tried to install mono and monodevelop on centOS 6.3.
After many hours I was able to install mono but failed with monodevelop.
I'm really astonished how difficult and time consuming it is, to get a recent mono/monodevelop version on linux installed.
Is there nobody willing to write and maintain an install/compile tutorial to get the most recent mono/monodevelop/monodata/ASP.NET MVC/... version on the major linux distributions (Centos, Ubuntu, Suse, Debian) installed?
I think many people developing on Windows (with limited linux knowledge) would like to start using mono, if the boarding hurdle would be somehow lower.
It may be the most important to make Mono more used and more visible.
Please, write a tested tutorial (script) for compiling mono/monodevelop.
Thank you!
I have created a project on Open Build Service, which produces builds of the latest MonoDevelop 4.0.10 for Debian, Ubuntu, CentOS, and Fedora.
see https://build.opensuse.org/project/show/home:tpokorra:mono
For installation instructions with apt-get or yum, see:
http://software.opensuse.org/download/package?project=home:tpokorra:mono&package=monodevelop-opt
I hope this will increase the usage of MonoDevelop on Linux Desktop environments.
Monodevelop 4.
If you use any *buntu. Check this.
"You can open up the terminal and install it via the following:
1. sudo add-apt-repository ppa:keks9n/monodevelop-latest
2. sudo apt-get update
3. sudo apt-get install monodevelop-latest"
http://mono-d.alexanderbothe.com/?p=101
Xamarin should be doing a better job at publishing the linux packages in a one-click manner. I don't care what linux distro (SuSE, RHEL, CentOS, Ubuntu etc) - just pick any one as the supported one and publish for it. It seemed that it used to be SuSE but even that has old packages as seen within Zypper/YaST.
Update Mono framework
Having said that, to update the Mono framework itself, without letting go of the package managers try this. This will work as long as the project dutifully publishes the RPMs. You don't want to build from source since it's a more fickle process and the setup distracts from your real objective (i.e. develop).
Obviously, please replace the URL below to what will be latest by the time you're reading this.
mkdir mono-rpms
cd mono-rpms
wget --reject "index.html*" -nd -r -e robots=off --no-parent http://download.mono-project.com/archive/3.2.3/linux/x64/
sudo zypper install *rpm
Update MonoDevelop (the IDE)
Timotheus Pokorra's answer indicates he's filling in some of the usability void left by Xamarin (Thanks Timotheus!!). You can install MonoDevelop via
http://software.opensuse.org/download/package?project=home:tpokorra:mono&package=monodevelop-opt
Note that on SuSE I get the error
Problem: nothing provides liberation-mono-fonts needed by mono-libgdiplus-opt-3.0.12-7.1.x86_64
Solution 1: do not install monodevelop-opt-4.0.12-5.2.x86_64
Solution 2: break mono-libgdiplus-opt-3.0.12-7.1.x86_64 by ignoring some of its dependencies
I (very reluctantly) selected to break the dependency. Note that I already had liberation-fonts (via sudo zypper install liberation-fonts). I don't know if its the same/different as liberation-mono-fonts. Anyway, hope Timotheus fixes it when he has a moment.
I'm not sure if you've already seen this, but this may help:
http://www.mono-project.com/Parallel_Mono_Environments
The most common problem that new developers have when coming to Linux from systems like Windows is not properly setting up their environment variables and so when they do the standard ./configure && make && make install routine, when it involves a number of source packages (like Mono does), any package that depends on the core package won't pick up the correct location for that base package.
Your question really doesn't explain what parts you found confusing or difficult so it's hard to address those issues.
For people unfamiliar with setting up Linux systems, it may be easier if you just go with a system like Ubuntu which has fairly recent pre-built packages (although not the latest - I don't think any Linux system keeps up with Mono releases) rather than wrestling with the learning curve of how to build everything yourself.
It is confirmed that in the near future Xamarin will support Linux and provide binaries (mono and mainline applications) for Debian and Centos derivatives, and their are already packages for Debian and Centos derivatives for technical preview. So cheers and no more pain of compiling and even parallel mono installaions.It can not get more easy than this. Check here

Ubuntu-compiled program to run on Unix webserver

I have compiled an Ada program on Ubuntu using GNAT.
Afterwards, I tried a few test runs with that program and it worked properly.
But when I uploaded this to my Apache (UNIX) webserver and tried to run the program, there was no output. Why is this so?
Could it be that programs which have been compiled on Ubuntu don't work on a UNIX server?
(Sorry for the stupid question!)
Linux version of the system I use for compiling (uname -a):
Linux ubuntu 3.0.0-12-generic #20-Ubuntu x86-64 GNU/Linux
Linux version of the system I want to run the program on later (uname -a):
Linux 2.6.37-he-xeon-64gb+1 i686 GNU/Linux
For compiling on the Ubuntu machine, I use:
gnatmake -O3 myprogram -bargs -static
When you build a GNAT program (gnatmake my_program), by default it links against dynamic libraries (libgnat.so, libgnarl.so). These libraries are part of the GNAT system and are very unlikely to be available on your web server.
If you say ldd my_program it will show you the shared libraries used.
You can force the build to use the static GNAT libraries by saying
gnatmake my_program -bargs -static
(the -bargs -static must come after regular flags like -O2).
Edit: more info on -bargs and friends.
You must make sure that the server has the libraries your app links against or link them statically like already suggested by others. Some other comments point out that you need to "cross compile" or that the server won't run 64 bit binaries. This is easily solved unless the app you're building is very complex.
gnatmake --GCC='gcc -m32'
Will make a binary that will run on a 32bit system. However the chief problem is that the servers (g)libc is very likely to be older than what's on your ubunu box. Programs compiled against newer glibc will not necessarily run on systems with an older glibc installed.
for more info and plenty more links, look here:
Linking against an old version of libc to provide greater application coverage
How can I link to a specific glibc version?
edit:
Besides, apache may not be configured to accept invocation of external binaries. Have you "tried to run the program" with something you know exists on the server? Try to run something trivial like /bin/ls to make sure your method of running the program works. Look at the logs if it doesn't work. Programs need to be executable, by the way: chmod 755 /path/to/webeserver/uploads/ada-app
Why don't you just compile it on your Webserver instead of your local machine ?
Aswell cat /etc/issue or cat /etc/release could give us some information about the distribution you're using.