How to cross compile Haxe/OpenFL generated source code using minGW? - linux

I have got a CPP source files generated by OpenFL/Haxe for Linux (Fedora 21 x86_64).
I would like to attempt to cross-compile this to Windows executable using mingw-64 but does not know how to generate the proper Makefile for this as there where alot of cpp files in the scr folder.
How do I create this make file?
or
If there is an approach to configure OpenFL/Haxe to do cross compile using mingw-64 that would also be appreciated.

Compiling Windows program from linux was not available from OpenFl during that time, I created several pull requests and code updates to enable it, however, the attempt was turned down. I think its due to manageability and market. But idea of coding in Linux for every OS makes Linux a powerful coding platform!
It took quite sometime to solve it on my end since some codes in its haxe component was needed to be updated. I continued my research and ended up contributing few codes to OpenFl and Haxe/Hxcpp.
New problems in compilation have arised that are far more difficult to solve, Ret-Mode have proposed a better solution that time. For those interested, check here: https://github.com/Ret-Mode/lime apply his fix to your Lime installation. The method for cross-compilation is as follows:
Installation on Linux for crosscompilation
1 Clone repository
git clone --recursive https://github.com/Ret-Mode/lime
2 Setup:
haxelib dev lime lime
2a Rebuild tools (from lime/${version}/tools folder):
haxe tools.hxml
3 First build for Your linux architecture:
haxelib run lime rebuild linux -DHXCPP_M32 -32
haxelib run lime rebuild linux -DHXCPP_M64 -64
3a Build lime for MinGW, also choose Your MinGW arch:
haxelib run lime rebuild windows -Dmingw -DHXCPP_M32 -32
haxelib run lime rebuild windows -Dmingw -DHXCPP_M64 -64
4 Build projects for Your arch:
haxelib run lime build windows -Dmingw -64
haxelib run lime build windows -Dmingw -32
5 If You have WINE installed, You should have Your app icon swapped. If not, app will have native icon, but will work

Related

Cross compile from Linux to Windows using mingw

I'm trying to compile a application developed under Linux Debian for Windows 10 using the mingw compiler and cmake.
I configured a toolchain file according to the tutorial from kitware . This works great as long as I have no dependencies to libraries. Following the tutorial I have to install the libraries in the second path of this line:
SET(CMAKE_FIND_ROOT_PATH /usr/i586-mingw32msvc /home/<USER>/mingw-install )
I tried to download the library sources (e.g. for Termcap) but I have not really an idea how to install the library under the path /home/<USER>/mingw-install using MinGW.
Could somebody give a example for Termcap what commands I have to invoke or a link to a tutorial?

Which IDE and toolchain on Windows to generate a program for an embedded arm linux?

I usually work on linux when i have a linux target but this time i must work from a Windows based computer and must keep all my work on Windows.
I tried with Code::blocks and GNUARM, the build has no problem but can't be runned on the target.
When using code sourcery G++ i can build with command a single .c file and it runs on my board.
When i try to put the sourcery g++ exécutables in a toolchain configuration in code::blocks the software seems to build with no error but is generating nothing...
Now i would like to go a step further an build a project, no more single files, and i don't seems to be able to find a solution to this problem.
Does anyone here has experience from this kind of situation ?
I finally got it to work, here is a little explanation on how i did it : first i installed the jdk and eclipse, the code sourcery g++ lite and finally the gnu arm Tools (not the gnu arm plugin). I then went into the toolchain configuration in eclipse and changed the Tools "cs-make" and "cs-rm" from code sourcery to the "make" and "rm" from the gnu arm Tools kit. I changed the format from c++11 to c++9 too and now i am generated a elf file which run on my board.

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.

OpenFL basic install on Windows doesn't work?

I went to http://www.openfl.org/archive/download/ and followed the steps for a really basic first test:
haxelib install lime
haxelib run lime setup
lime install openfl
lime create openfl:DisplayingABitmap
When I try to run it with:
cd DisplayingABitmap
lime test neko
I get:
Export/windows/neko/haxe/ApplicationMain.hx:1: characters 7-20 : Class not found : openfl.Assets
I haven't done anything before with Haxe or OpenFL so this is a fresh install. Anybody can guess what's going on? It doesn't seem to be seeing the contents of the openfl library, though it can perfectly generate the project.
(update: I tried the exact same on a Mac and it worked perfectly, so I think the problem has something to do with Windows)
Try to follow the steps at http://www.openfl.org/documentation/setup/install-haxe/ and reinstall the latest openfl, the contents under "archive" folder are mostly outdated.

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.

Resources