How to Cross Compile Alsa library for Windows Eclipse - linux

I would like to know how could it be possible to cross compile the Alsa library in Windows for my linux host.
I am using an iMX8X with a Linux image, made by Yocto, and I need to implement the Alsa library in my Eclipse to be able to use the functions it gives. I have tried to,
CC=aarch64-linux-gnu-gcc(in my case) ./configure host=arm-linux
It goes by properly but when I do make with cygwin it fails and I cannot figure it out.
Anyone know how to approach the cross-compilation of a library for Windows Eclipse?
Thanks in advance!

There is no point on compiling Alsa on Windows, this library works with Linux Core in order to work. There is no actual way, for what I found, to compile it on Windows. Best approach has been to make a Virtual Box machine with Ubuntu 20.04, install Eclipse and compile and add Alsa library in the Ubuntu machine. For more information, just ask me about it, glad to help.

Related

Cross-compilation targeting Cygwin with Linux host

Is it possible to cross-compile a program targeting a Cygwin environment from a Linux/Unix host? I'm mostly trying to avoid using a Windows WM for building a collection of programs.
From the website:
Cygwin is not:
a way to run native Linux apps on Windows. You must rebuild your application from source if you want it to run on Windows.
mingw-w64 is not enough, I need a full POSIX platform. I'm also wondering if it's possible to target MSYS2.
Perhaps I'm not understanding correctly, and one doesn't need to compile in Cygwin but only mingw-w64 is necessary.
Thanks!
It is possible to compile for Cygwin from Linux.
The cygwin1.dll itself is built in such way.
Packages/libraries are available at:
https://copr.fedorainfracloud.org/coprs/yselkowitz/cygwin/
Of course only a minimal set of tools/libraries is available

how to build a linux-based program for window?

I want to build a inux-based program fully standalone for windows.
And I try to use mingw64 on ubuntu with the command
./configure --host=x86_64-w64-mingw32 --disable-shared --enable-static LDFLAGS="-L /usr/local/lib/"
make
But it failed with
src/libcork/posix/subprocess.c:14:24: fatal error: sys/select.h: No such file or directory
#include <sys/select.h>
^
compilation terminated.
Here is the source code in github:
https://github.com/shadowsocks/simple-obfs
So how can I build the program fully standalone for windows?
May I try the cygwin or msys2?
update:
I find another source code which has been ported.
But when I compiled it with
./configure --host=x86_64-w64-mingw32 CFLAGS="-static" LDFLAGS="-static"
I get an executable file which still needs the libssp-0.dll.
So how can I make the libssp be static linked?
Here is the new source code: https://github.com/Windendless/simple-obfs
I don't think that the functionality in select.h is available on the MinGW version of gcc, because it is not available in the Windows platform. If you're building something that was intended to be built on Windows, then you might find that there are options you can pass to configure that enable a different, Windows-friendly way of achieving the same thing. If you're building something that was only really intended to be used on Linux, then you might be out of luck. In that case, your choices really amount to:
Modify the code so it doesn't require select.h. Some of that functionality might already exist in the Windows Sockets API, with a somewhat different implementation. However, it might equally well not, in which case you'll have to do some work.
Use a Windows compatibility layer that is more feature-rich than MinGW. Cygwin might well work, as might the Windows Subsystem for Linux in Windows 10. However, none of these approaches amounts to building a "standalone" application, because they require some supporting infrastructure.

Beaglebone cross compilation

I am a freshman for the beaglebone. I need your help. I have installed the cross compiler toolchain arm-linux-gnueabi on my 64 bit xubuntu in eclipse as well as codeblocks environment. I have made a hello world program, cross compiled it in 3 ways using eclipse , using terminal,using Codeblocks. But when i run my executable file in Beaglebone i get the error saying cant load shared file libstdc++6.so.6:file not found.
Though i have already installed latest libstdc++6,ia32-libs and configured it. I am using ssh for logging into my Beaglebone. My all projects are pending because of this. Please suggest solution. I will be grateful to you. I have worked according to derek molloy c,c++ video but still got the error. I think it is because of difference between 32 bit and 64 bit in beaglebone and laptop respectively.
Have you really installed libstdc++6,ia32-libs on your BB? It looks like x86 lib. Take a look at Buildroot. It already provides BB target, so you can get your basic rootfs quite quickly. Then just add needed packages and you are done. The main benefit, when using such distro like BR, that you have all needed dependencies in your rootfs, that you burn on your microSD card. BR also provides Eclipse plugin.
I thought abi used was arm-linux-gnueabi but when i got the details of abi version running on my beagleboard i found it was arm-linux-gnueabihf. So i just replaced the compiler and then it was able to find all the files.

Cross-platform build under Windows targeting Linux using CMake

I am developing a software in C++ on windows 32-bit (using MSVC++), but since I want to be able to use my software on every platform, I have decided to use CMake as my build generator.
Therefore, I am still just a beginner in CMake. From the CMake tutorials, I understand that in order to cross compile codes, first a toolchain simulating the target platform should be installed on the host platform. Then using the appropriate target-platform C and C++ compilers provided by this toolchain, CMake would be able to generate makefiles etc.
Now, I want to build my code for Linux platform(GNU/Linux) on a Win32 platform. I tried doing the above procedure using CMake combined with Cygwin and using gcc and g++ as compilers. It built fine, created makefiles, and when I issued "make" in Cygwin terminal, the generated makefiles were "made". Now I have got an executable which I was hoping would run on Linux platform. But on Linux I get the error: bash cannot execute binary file.
Using command file executablename, I realized the executable which is made by the above procedure is of type PE32 which is only for Windows.
Now my question is: Is my understanding of cross-platform build procedure using cmake correct?Or should I just use another Linux toolchain under windows to get a Linux ELF executable? What toolchains come to your mind which would give me what I want?
Many thanks
Setareh
You will want to look here: cmake-toolchains(7) if you do cross compiling. However, I would suggest that you install a Linux VM like virtual box on your windows machine and build naively on Linux. It will compile much faster and you will not have to worry about cross compiling. You can mount the windows disk from the linux VM so you can share the same source tree. The linux VM will compile much faster than gcc running under windows.
Your understanding of CMake is correct... it will determine how to create the build system you request (or is default for the platform you are currently on) based on rules in your CMakeLists.txt file. However, this won't necessarily help you compile for linux on a windows machine if you don't have something installed that can target linux.
To compile targeting linux, you will need to use a linux compiler. The link posted by #stjin tells you how to install one on cygwin. Then, to set up your CMake build, do this in the terminal:
CC=gcc-linux CXX=g++-linux cmake . [options]
This will tell CMake to locate the special linux targeted compilers. Hopefuly, after compiling with these compilers you will be able to run on linux.

How can I cross compile my Linux application to get a Windows executable in Linux?

I need to cross compile my QT application in Linux. I compiled my application from the QT SDK in Linux and it is working properly.
How do I create an .exe for the same application in Linux. I have installed Mingw in Linux and qmake, but I dont know how to proceed with cross compiling.
How do I link my QT with a cross compiler like MinGW and Qmake. I am using SuSE Linux. I have also gone through http://Silmore/29 but I am not getting a clear picture of how to proceed futher.
I'm not familiar with SuSE, but Ubuntu has the mingw32 packages which is a windows targetted cross compiler, along with the open source win32api:
(source: liranuna.com)
After a small search, turns out there are RPMs for it here, while it should probably be in your repositories.
Basically, you use your cross-toolchain for the Make process rather than the host toolchain. I assume there is no autotools configure script. If there is you can run configure with --host specified and have it all figured out for you.
So what you'll need to do is set CC, LD, CFLAGs, LDFLAGS (probably also CXX and CXXFLAGS) and modify the Makefile to use the right QT libraries - which will need to be mingw, not your Linux libraries. So you may also need to obtain the MinGW/Windows QT SDK and store it separately so your paths cam be specified properly.
Hope this helps!
You could run the Visual C++ Express Edition 2008 cl.exe through wine to compile your project.

Resources