MSYS2: is a windows or unix environment? - msys2

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.

Related

What is the way to run c program's .exe file compiled on Windows OS to IMX8M Yocto Linux Board

I want to run hello.exe file generated on Windows OS platfrom for simpe hello.c file on IMX8M yocto linux board. I am very new to use this board and I am not finding any helping material on the same. Can anyone guide me is it possible or not and where can I find related documents.
If it's not possible, what are the other ways to run .exe generated from any HOST OS to Yocto Linux board.
I think there is some misunderstanding.
As the host and the device are not the same architecture (x64/ARM) and the same OS (Windows/Linux), you need to cross-compile your code. This is done by using a specific compiler, able to run on your host machine, to generate your binary for your device machine.
If you want to compile an application for your iMX8M from your Windows computer, you will need to find a cross-compiler toolchain able to run on Windows, generating binaries for Linux ARM architecture.
If you use Yocto, you can generate a SDK, which contains a cross-compiler toolchain by using bitbake <image> -c populate_sdk or bitbake <image> -c do_populate_sdk (depending on your Yocto version).
By default Yocto generates a SDK for a Linux host, so you will need to develop on a Linux OS.
There is aslo a specific meta that helps to generate a SDK for Windows: meta-mingw

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.

Cross-platform Debian package testing

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.

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.

MonoDevelop command line compile a solution

The problem is as follows: I have a MonoDevelop project (ASP.NET) on my development workstation.
I'm currently at a customer site, without my regular development environment on my laptop (Regulatory Burden). I have SSH access to my development workstation, but the network is too laggy to handle X11 comfortably.
I need to make a minor adjustment and recompile. I tried using xbuild, with no effect:
qdot#trigati ~/svn/proj/trunk/proj $ xbuild proj.csproj
XBuild Engine Version 2.6.4.0
Mono, Version 2.6.4.0
Copyright (C) Marek Sieradzki 2005-2008, Novell 2008-2009.
MSBUILD: error MSBUILD0000: /home/qdot/svn/proj/trunk/proj/proj.csproj: Imported project:
"/usr/lib/mono/xbuild/Microsoft/VisualStudio/v8.0/WebApplications/Microsoft.WebApplication.targets" does not exist.
Is there some utility that can trigger a rebuild of the monodevelop sourcecode? Obviously the code builds through the GUI.
mdtool build proj.csproj
If you want to use xbuild, create a symlink:
cd /usr/lib/mono/xbuild/Microsoft/VisualStudio/v9.0
ln -s v9.0 v10.0
I have the same exact ubuntu 12.04 distro on two different computers and could not figure out why mono would compile on one computer and not the other. But oh well, symlink solved the problem.