How can I compile tsschecker for Windows? - c

I'm trying to compile the C program tsschecker for Windows(on my Mac). I installed mingw-w64 with brew install mingw-w64, but I'm not sure how to use it to compile the program for Windows.
The Github repo for tsschecker includes instructions to compile for macOS and Linux(using make), but not Windows(but it includes Windows in the compatibility list).
I have access to a Windows machine if needed.
How can I compile tsschecker for Windows?

Related

How do you include external libraries when you cross-compile c programs using mingw?

I am building a simple command line game in C using the ncurses library on a Linux machine but I want to be able to run the compiled code on a Windows computer. To do this, I am using the MinGW-w64 cross compiler tool in Linux and compiling it to run in a 64 bit Windows environment. However, when I try to compile using this command:
x86_64-w64-mingw32-gcc -o game.exe barebones.c -lncurses
I get this error:
barebones.c:2:10: fatal error: ncurses.h: No such file or directory
2 | #include <ncurses.h>
| ^~~~~~~~~~~
compilation terminated.
I installed ncurses on my Ubuntu machine and can create and run the same simple program to run on Linux. I have been able to cross-compile and run simple programs that only use the default libraries. I think I must be listing the ncurses library incorrectly in the compliation command or that I am failing to understand other posts that show that this doesn't work.
I am using Windows 10 and Ubuntu 21.04.
Debian provides no cross-compiling packages for ncurses. (Ubuntu provides no additions or improvements to ncurses in any way, simply reusing packages from Debian). If you want to cross-compile ncurses, you'll have to build ncurses in cross-compiling form.
For development purposes, ncurses packages can be built using the scripts under the (sources) packages directory, e.g., after downloading the current source:
tar xf ncurses-whatever.tgz
cd ncurses-whatever
cp -var packages/debian-mingw64 ./debian
dpkg-buildpackage
That's a starting point. You'd have to do something about the email in the debian/control file to appease dpkg-buildpackage (tutorials are off-topic).

Creating a DLL file of C program on ubuntu [duplicate]

I have written some effects in C++ (g++) using freeglut on Linux, and I compile them with
g++ -Wall -lglut part8.cpp -o part8
So I was wondering if it is possible to have g++ make static compiled Windows executables that contains everything needed?
I don't have Windows, so it would be really cool, if I could do that on Linux :)
mingw32 exists as a package for Linux. You can cross-compile and -link Windows applications with it. There's a tutorial here at the Code::Blocks forum. Mind that the command changes to x86_64-w64-mingw32-gcc-win32, for example.
Ubuntu, for example, has MinGW in its repositories:
$ apt-cache search mingw
[...]
g++-mingw-w64 - GNU C++ compiler for MinGW-w64
gcc-mingw-w64 - GNU C compiler for MinGW-w64
mingw-w64 - Development environment targeting 32- and 64-bit Windows
[...]
Suggested method gave me error on Ubuntu 16.04: E: Unable to locate package mingw32
===========================================================================
To install this package on Ubuntu please use following:
sudo apt-get install mingw-w64
After install you can use it:
x86_64-w64-mingw32-g++
Please note!
For 64-bit use: x86_64-w64-mingw32-g++
For 32-bit use: i686-w64-mingw32-g++
One option of compiling for Windows in Linux is via mingw. I found a very helpful tutorial here.
To install mingw32 on Debian based systems, run the following command:
sudo apt-get install mingw32
To compile your code, you can use something like:
i586-mingw32msvc-g++ -o myApp.exe myApp.cpp
You'll sometimes want to test the new Windows application directly in Linux. You can use wine for that, although you should always keep in mind that wine could have bugs. This means that you might not be sure that a bug is in wine, your program, or both, so only use wine for general testing.
To install wine, run:
sudo apt-get install wine
Install a cross compiler, like mingw64 from your package manager.
Then compile in the following way: instead of simply calling gcc call i686-w64-mingw32-gcc for 32-bit Windows or x86_64-w64-mingw32-gcc" for 64-bit Windows. I would also use the --static option, as the target system may not have all the libraries.
If you want to compile other language, like Fortran, replace -gcc with -gfortran in the previous commands.
I've used mingw on Linux to make Windows executables in C, I suspect C++ would work as well.
I have a project, ELLCC, that packages clang and other things as a cross compiler tool chain. I use it to compile clang (C++), binutils, and GDB for Windows. Follow the download link at ellcc.org for pre-compiled binaries for several Linux hosts.
From: https://fedoraproject.org/wiki/MinGW/Tutorial
As of Fedora 17 it is possible to easily build (cross-compile) binaries for the win32 and win64 targets. This is realized using the mingw-w64 toolchain: http://mingw-w64.sf.net/. Using this toolchain allows you to build binaries for the following programming languages: C, C++, Objective-C, Objective-C++ and Fortran.
"Tips and tricks for using the Windows cross-compiler": https://fedoraproject.org/wiki/MinGW/Tips
For Fedora:
# Fedora 18 or greater
sudo dnf group install "MinGW cross-compiler"
# Or (not recommended, because of its deprecation)
sudo yum groupinstall -y "MinGW cross-compiler"

How to create .exe executable file in Linux Ubuntu by .c source file [duplicate]

I have written some effects in C++ (g++) using freeglut on Linux, and I compile them with
g++ -Wall -lglut part8.cpp -o part8
So I was wondering if it is possible to have g++ make static compiled Windows executables that contains everything needed?
I don't have Windows, so it would be really cool, if I could do that on Linux :)
mingw32 exists as a package for Linux. You can cross-compile and -link Windows applications with it. There's a tutorial here at the Code::Blocks forum. Mind that the command changes to x86_64-w64-mingw32-gcc-win32, for example.
Ubuntu, for example, has MinGW in its repositories:
$ apt-cache search mingw
[...]
g++-mingw-w64 - GNU C++ compiler for MinGW-w64
gcc-mingw-w64 - GNU C compiler for MinGW-w64
mingw-w64 - Development environment targeting 32- and 64-bit Windows
[...]
Suggested method gave me error on Ubuntu 16.04: E: Unable to locate package mingw32
===========================================================================
To install this package on Ubuntu please use following:
sudo apt-get install mingw-w64
After install you can use it:
x86_64-w64-mingw32-g++
Please note!
For 64-bit use: x86_64-w64-mingw32-g++
For 32-bit use: i686-w64-mingw32-g++
One option of compiling for Windows in Linux is via mingw. I found a very helpful tutorial here.
To install mingw32 on Debian based systems, run the following command:
sudo apt-get install mingw32
To compile your code, you can use something like:
i586-mingw32msvc-g++ -o myApp.exe myApp.cpp
You'll sometimes want to test the new Windows application directly in Linux. You can use wine for that, although you should always keep in mind that wine could have bugs. This means that you might not be sure that a bug is in wine, your program, or both, so only use wine for general testing.
To install wine, run:
sudo apt-get install wine
Install a cross compiler, like mingw64 from your package manager.
Then compile in the following way: instead of simply calling gcc call i686-w64-mingw32-gcc for 32-bit Windows or x86_64-w64-mingw32-gcc" for 64-bit Windows. I would also use the --static option, as the target system may not have all the libraries.
If you want to compile other language, like Fortran, replace -gcc with -gfortran in the previous commands.
I've used mingw on Linux to make Windows executables in C, I suspect C++ would work as well.
I have a project, ELLCC, that packages clang and other things as a cross compiler tool chain. I use it to compile clang (C++), binutils, and GDB for Windows. Follow the download link at ellcc.org for pre-compiled binaries for several Linux hosts.
From: https://fedoraproject.org/wiki/MinGW/Tutorial
As of Fedora 17 it is possible to easily build (cross-compile) binaries for the win32 and win64 targets. This is realized using the mingw-w64 toolchain: http://mingw-w64.sf.net/. Using this toolchain allows you to build binaries for the following programming languages: C, C++, Objective-C, Objective-C++ and Fortran.
"Tips and tricks for using the Windows cross-compiler": https://fedoraproject.org/wiki/MinGW/Tips
For Fedora:
# Fedora 18 or greater
sudo dnf group install "MinGW cross-compiler"
# Or (not recommended, because of its deprecation)
sudo yum groupinstall -y "MinGW cross-compiler"

How to get Cilk working with Cygwin?

I have downloaded both programs, but I see no instructions on google for getting Cilk to work on Cygwin. Is there a Cygwin package that would work? I'm programming in C and have gcc installed.
Build it from source.
That will link the cygwin32.dll with the binaries which are essential for it to work with cygwin.
Here is a guide: http://groups.csail.mit.edu/sct/wiki/index.php?title=Cilk_Plus_Installation_Guide to build it from source with gcc.

Problem creating an exe from C

I've made a small application in C with Netbeans.
I've ran the application in Netbeans and it created an exe.
I used that exe and it worked fine on my comp but when I move it to other comp it says:
"This application failed to start because cygwin1.dll was not found. Re-installing the application may fix this problem."
How can i create the exe so that it runs anywhere?
The problem is you're using Cygwin GCC to compile your code. Cygwin provides a unix-like environment
if you're not doing anything Unix-y you can recomplie -mno-cygwin - see Can you statically compile a cygwin application?
if you are using Unix calls you'll need to distribute cygwin1.dll along with your app
or you can recompile with a different compiler, e.g. a GCC that targets mingw32 not cygwin, or one of the free (as-in-beer) Microsoft compilers from the platform SDK or Visual Studio Express downloads.

Resources