Portable Linux environment for applications - c

Is there any application (maybe a VM) that run Linux compatible compiled programs (like a web service) on other platforms (like windows) like an native application?
for example executive a C coded web service that is compiled by that application like a native linux programming but with an extra layer.
I think it have to be an x86 VM like QEMU but that is so heavy and complicated.
my problem is that I coded an application in C for linux but not I want to run it on others platforms without rebuilding that or using Cygwin.

You could look into Docker. As far as I know, it is possible to run Docker images that were built on Linux on Windows.

I found an incomplete but best match solution to my problem:
flinix
I hope more contribution to this awesome project.

Softwares like wine have been made for linux to run Windows applications. You can try http://www.andlinux.org/ to run linux apps in Windows.
You can uses VirtualBox or VMWare and run a Linux VM or use Cygwin or MinGW (similar to cygwin). Maybe try with Babun which is really easy but I'm not sure this would run a linux app...

Related

Can you compile C for other operating systems?

I was just wondering, if there is a way, to compile my code, from my windows machine to other os, or do I have to setup everything for the compilation on VMs.
I have already changed up the code, so that it is possible to compile it on diffrent platforms, I'm just wondering if there is a way, to compile it for other operating systems in mingw, or in GNU. (If there is a way to do it in GNU, I'm fine with moving to linux, and compiling everything there)
This is exactly what is done when programming for Arduino, so yes it is possible.
But if you want to do it from Windows you may find it easier with LLVM/Clang than GCC, as it's not so easy to find cross compilers for many platforms that actually run on Windows.
It's a lot easier from Linux.
Or you can use CI tools like GitHub actions to build in the cloud.
I created an example project at https://github.com/brechtsanders/ci-test which uses GitHub actions (https://github.com/brechtsanders/ci-test/actions) to build on Ubuntu Linux, macOS and Windows.
You can use this project as the basis for a new cross-platform project.

C Modules On Windows Need Linux System Inclusion

I am new to C programming (proficient in Java) trying to compile some old (~1999) C modules on my windows machine. I'm using Eclipse CDT with Cygwin installed on my computer. I have resolved all of my issues except one: the modules have include statements for things like sys/io.h, sys/stat.h etc. After doing some research I found that these are unix system calls. Is it possible to use Cygwin to get these inclusions resolved on my windows machine through eclipse? Or do I need to run on a unix environment? Please correct me if any of this information is wrong... I'm at my wits end trying to compile these modules. Thank you.
Even if you use Cygwin, Mingw or other GCC-like compilers on Windows (with or without Eclipse) - it still is Windows and does not provide 100% compatible Linux system services. So YMMV.
Windows 10 with WSL provides much more compatible Linux environment and also a real Linux C compiler, with all its include files. If you need to just run some Linux program without spending much effort to Windows adaptation, this is the way.

Where should I put a DLL that is cross-compiled from source?

I really want to use the libpostal library as part of my Java application via the jpostal binding. While I can work around the fact that jpostal uses Gradle instead of Maven, I'm not sure where to proceed after I've cross compiled a libpostal DLL using a Linux machine.
According the answer to this question, the process of installing a DLL on Windows is very convoluted.
If anyone has good idea as to where I can put the DLL so that my Java application using jpostal can find it, please tell me.
P.S: My Java application will run on a CentOS machine in production but for development, testing, and demoing I'm using my laptop and desktop which run Windows. Of course if I can't get libpostal to work on Windows, then I can always go the virtual machine route.

Learning Linux Kernel programming on a virtual machine on Ubuntu?

I am just learning linux kernel programming with the LINUX KERNEL DEVELOPMENT book(I am beginner linux kernel programming but not on linux programming). It is possible to test programs in a kernel machine with VMware viritual on Ubuntu without damage my system ?
Yes you can safely test kernel modules on a virtual machine!
I'll give you some links that may help:
watch this site
http://free-electrons.com/
in particular this book:
http://free-electrons.com/doc/books/ldd3.pdf
Also this guide:
http://www.tldp.org/HOWTO/Module-HOWTO/
An embedded distro is even better
An Ubuntu guest is fine, but I prefer to keep things minimal and use an embedded distro, as this will make things:
simpler and easier to understand and control
faster
In particular, I recommend using:
Buildroot, which is highly configurable, documented and maintained, also builds host QEMU so easy to patch it up (e.g. to add your own devices since out-of-tree devices are not possible yet ?)
QEMU emulator: small comprehensible source, ARM support, official Android emulator, kernel GDB support
Embedded distros can generate rootfs images smaller than 10MiB, and it becomes possible to understand the entire userland setup, which will make it easier to focus on the kernel.
I have made a setup to make everything as automated as possible: https://github.com/cirosantilli/linux-kernel-module-cheat
I've been using a VM for a long time for Linux kernel programming and I've never had any problem. Actually, if you manage to violate the protections of a VM then you will probably be hired by Oracle or VMWare :D
However, I recommend you to read this post: https://security.stackexchange.com/questions/23452/is-it-safe-to-use-virtual-machines-when-examining-malware

Compiling a GTK+ application for windows from linux

I'm new to linux and have been learning gtk+ the past couple of days, and was wondering how you would go about compiling an application to run on windows instead of linux (ubuntu). I found this while doing a quick search but my knowledge of linux is non-existent at the moment so not sure how to proceed with the tutorial. Are there any alternative methods to do this?.
I've only compiled on Windows and used Cygwin to test 'nix versions (before going right into a 'nix OS and compiling), but looks like this might get you started.
Compiling in other OS does not make sense while you can't disribute your binary without testing it on the target platform.
Then why not to compile on the same platform?

Resources