How to compiling C GTK3+ program in Linux mint for windows? - c

I am using Linux mint and gcc-7 and mingw-w64.I want to compile a c gtk3+ program in Linux using mingw so that it will produce .exe file which can be run in windows.I am able to Compile normal c programs using mingw,But I can't compile gtk programs.I can compile gtk programs with gcc but not with mingw.
I had installed mingw as told here :- How to compile executable for Windows with GCC with Linux Subsystem?
Now I want to compile window program which I got from https://developer.gnome.org/gtk3/stable/gtk-getting-started.html#id-1.2.3.5
smit#smit-Aspire-5742:~/programs/c programs/test$ x86_64-w64-mingw32-gcc test.c `pkg-config --cflags gtk+-3.0 --libs`
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /opt/gtk3-dos/lib/libgtk-3.dll.a when searching for -lgtk-3
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /opt/gtk3-dos/lib/libgtk-3.dll.a when searching for -lgtk-3
/usr/bin/x86_64-w64-mingw32-ld: cannot find -lgtk-3
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /opt/gtk3-dos/li /libgdk-3.dll.a when searching for -lgdk-3
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /opt/gtk3-dos/lib/libgdk-3.dll.a when searching for -lgdk-3
/usr/bin/x86_64-w64-mingw32-ld: cannot find -lgdk-3
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /opt/gtk3-dos/lib/libpangocairo-1.0.dll.a when searching for -lpangocairo-1.0
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /opt/gtk3-dos/lib/pangocairo-1.0.lib when searching for -lpangocairo-1.0
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /opt/gtk3-dos/lib/libpangocairo-1.0.dll.a when searching for -lpangocairo-1.0
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /opt/gtk3-dos/lib/pangocairo-1.0.lib when searching for -lpangocairo-1.0
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /opt/gtk3-dos/lib/pangocairo-1.0.lib when searching for -lpangocairo-1.0
/usr/bin/x86_64-w64-mingw32-ld: cannot find -lpangocairo-1.0
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /opt/gtk3-dos/lib/libpangoft2-1.0.dll.a when searching for -lpangoft2-1.0
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /opt/gtk3-dos/lib/pangoft2-1.0.lib when searching for -lpangoft2-1.0
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /opt/gtk3-dos/lib/libpangoft2-1.0.dll.a when searching for -lpangoft2-1.0
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /opt/gtk3-dos/lib/pangoft2-1.0.lib when searching for -lpangoft2-1.0
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /opt/gtk3-dos/lib/pangoft2-1.0.lib when searching for -lpangoft2-1.0
/usr/bin/x86_64-w64-mingw32-ld: cannot find -lpangoft2-1.0
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /opt/gtk3-dos/lib/libfreetype.dll.a when searching for -lfreetype
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /opt/gtk3-dos/lib/libfreetype.dll.a when searching for -lfreetype
/usr/bin/x86_64-w64-mingw32-ld: cannot find -lfreetype
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /opt/gtk3-dos/lib/libfontconfig.dll.a when searching for -lfontconfig
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /opt/gtk3-dos/lib/fontconfig.lib when searching for -lfontconfig
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /opt/gtk3-dos/lib/libfontconfig.dll.a when searching for -lfontconfig
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /opt/gtk3-dos/lib/fontconfig.lib when searching for -lfontconfig
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /opt/gtk3-dos/lib/fontconfig.lib when searching for -lfontconfig
/usr/bin/x86_64-w64-mingw32-ld: cannot find -lfontconfig
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /opt/gtk3-dos/lib/libpangowin32-1.0.dll.a when searching for -lpangowin32-1.0
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /opt/gtk3-dos/lib/pangowin32-1.0.lib when searching for -lpangowin32-1.0
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /opt/gtk3-dos/lib/libpangowin32-1.0.dll.a when searching for -lpangowin32-1.0
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /opt/gtk3-dos/lib/pangowin32-1.0.lib when searching for -lpangowin32-1.0
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /opt/gtk3-dos/lib/pangowin32-1.0.lib when searching for -lpangowin32-1.0
/usr/bin/x86_64-w64-mingw32-ld: cannot find -lpangowin32-1.0
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /opt/gtk3-dos/lib/libpango-1.0.dll.a when searching for -lpango-1.0
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /opt/gtk3-dos/lib/pango-1.0.lib when searching for -lpango-1.0
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /opt/gtk3-dos/lib/libpango-1.0.dll.a when searching for -lpango-1.0
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /opt/gtk3-dos/lib/pango-1.0.lib when searching for -lpango-1.0
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /opt/gtk3-dos/lib/pango-1.0.lib when searching for -lpango-1.0
/usr/bin/x86_64-w64-mingw32-ld: cannot find -lpango-1.0
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /opt/gtk3-dos/lib/libatk-1.0.dll.a when searching for -latk-1.0
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /opt/gtk3-dos/lib/atk-1.0.lib when searching for -latk-1.0
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /opt/gtk3-dos/lib/libatk-1.0.dll.a when searching for -latk-1.0
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /opt/gtk3-dos/lib/atk-1.0.lib when searching for -latk-1.0
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /opt/gtk3-dos/lib/atk-1.0.lib when searching for -latk-1.0
/usr/bin/x86_64-w64-mingw32-ld: cannot find -latk-1.0
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /opt/gtk3-dos/lib/libcairo-gobject.dll.a when searching for -lcairo-gobject
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /opt/gtk3-dos/lib/libcairo-gobject.dll.a when searching for -lcairo-gobject
/usr/bin/x86_64-w64-mingw32-ld: cannot find -lcairo-gobject
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /opt/gtk3-dos/lib/libcairo.dll.a when searching for -lcairo
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /opt/gtk3-dos/lib/cairo.lib when searching for -lcairo
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /opt/gtk3-dos/lib/libcairo.dll.a when searching for -lcairo
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /opt/gtk3-dos/lib
and so .......( I am pasting the last line as this output is way more big)
collect2: error: ld returned 1 exit status
I already went via this tutorial :-http://www.tarnyko.net/en/?q=node/45
Now vis this tutorail again but this time I had downloaded gtk+-bundle_3.6.4-20131201_win64.zip and now I am getting this output:-
smit#smit-Aspire-5742:~/programs/c programs/test$ x86_64-w64-mingw32-gcc test.c `pkg-config --cflags gtk+-3.0 --libs`
In file included from /usr/lib/x86_64-linux-gnu/glib-2.0/include/glibconfig.h:9:0,
from /usr/include/glib-2.0/glib/gtypes.h:32,
from /usr/include/glib-2.0/glib/galloca.h:32,
from /usr/include/glib-2.0/glib.h:30,
from /usr/include/gtk-3.0/gdk/gdkconfig.h:13,
from /usr/include/gtk-3.0/gdk/gdk.h:30,
from /usr/include/gtk-3.0/gtk/gtk.h:30,
from test.c:1:
/usr/include/glib-2.0/glib/gtypes.h: In function ‘_GLIB_CHECKED_ADD_U64’:
/usr/include/glib-2.0/glib/gmacros.h:232:53: error: size of array ‘_GStaticAssertCompileTimeAssertion_0’ is negative
#define G_STATIC_ASSERT(expr) typedef char G_PASTE (_GStaticAssertCompileTimeAssertion_, __COUNTER__)[(expr) ? 1 : -1] G_GNUC_UNUSED
^
/usr/include/glib-2.0/glib/gmacros.h:229:47: note: in definition of macro ‘G_PASTE_ARGS’
#define G_PASTE_ARGS(identifier1,identifier2) identifier1 ## identifier2
^
/usr/include/glib-2.0/glib/gmacros.h:232:44: note: in expansion of macro ‘G_PASTE’
#define G_STATIC_ASSERT(expr) typedef char G_PASTE (_GStaticAssertCompileTimeAssertion_, __COUNTER__)[(expr) ? 1 : -1] G_GNUC_UNUSED
^
/usr/include/glib-2.0/glib/gtypes.h:422:3: note: in expansion of macro ‘G_STATIC_ASSERT’
G_STATIC_ASSERT(sizeof (unsigned long long) == sizeof (guint64));
^
In file included from /usr/include/glib-2.0/gio/gio.h:46:0,
from /usr/include/gtk-3.0/gdk/gdkapplaunchcontext.h:28,
from /usr/include/gtk-3.0/gdk/gdk.h:32,
from /usr/include/gtk-3.0/gtk/gtk.h:30,
from test.c:1:
/usr/include/glib-2.0/gio/gcredentials.h: At top level:
/usr/include/glib-2.0/gio/gcredentials.h:75:1: error: unknown type name ‘uid_t’
uid_t g_credentials_get_unix_user (GCredentials *credentials,
^
/usr/include/glib-2.0/gio/gcredentials.h:79:52: error: unknown type name ‘uid_t’
uid_t uid,
^

I've gone via this tutorial 5 or maybe more times and I found what was wrong.I was exacting commands from wrong directories and downloading wrong version of GTK+ 3 Windows binaries .
My version of mingw is mingw64 thus I needed to download win64 version.
and I was executing command export PKG_CONFIG_PATH=/opt/gtk3-win64/lib/pkgconfig from /opt/gtk3-win64,but I needed to execute this command via directory in which my test.c file was.
I'll make this tutorial easy for future readers.
Install mingw cross-compiler by command
sudo apt-get install mingw-w64
Then Download GTK+ 3 Windows binaries from here(Link in this tutorial is old,here is latest link):- http://win32builder.gnome.org/
Download appropriate version as I was downloading wrong version.don't make the same mistake as mine.
extract the zip file in /opt/gtkwin (recommended) by command
sudo mkdir /opt/gtkwin && sudo unzip <name of the zip file> -d /opt/gtkwin
then Go to directory in which you have extracted the zip file.In this case I have extracted in /opt/gtkwin/ like cd /opt/gtkwin and execute the following command
find -name '*.pc' | while read pc; do sed -e "s#^prefix=.*#prefix=$PWD#" -i "$pc"; done
Now go to you directory in which you have .c file which you which to compile.and execute this command
export PKG_CONFIG_PATH=/opt/gtkwin/lib/pkgconfig
now compile the program by
x86_64-w64-mingw32-gcc test.c `pkg-config --cflags gtk+-3.0 --libs`
(for 64-bit)
and for 32 bit
i586-mingw32msvc-gcc test.c `pkg-config --cflags --libs gtk+-3.0`
Also you should visit this tutorial as I had learn this from there :- http://www.tarnyko.net/en/?q=node/45
this will create .exe file which can't run in UNIX as it is targeted to run on DOS

Related

Gradle: Execution failed for task ':linkMainExecutable'

I am trying to build a very simple and small C project from following link building c executables, but build failed with following error message:
Execution failed for task ':linkMainExecutable'.
> A build operation failed.
Linker failed while linking main.exe.
See the complete log at: file:///D:/xxxxx/build/tmp/linkMainExecutable/output.txt
If i look into D:\xxxx\build\exe\main directory, it seems it doesn't generates any main.exe file.
But GCC compiler seems working fine. I tried I tried gcc -o main main.c command and that generates main.exe which outputs Hello, World.
Build environment looks ok, since it builds successfully when i run gradle wrapper or gradlew commands.
Below is the source code and you can also see the source code in above link.
main.c
#include <stdio.h>
#include "greeting.h"
int main(int argc, char** argv) {
printf( "%s\n", GREETING_STRING);
return 0;
}
greeting.h
#ifndef GRADLE_GUIDE_EXAMPLE_GREETING_H__
#define GRADLE_GUIDE_EXAMPLE_GREETING_H__
#define GREETING_STRING "Hello, World"
#endif
build.gradle
apply plugin : 'c'
model {
components {
main(NativeExecutableSpec)
}
}
Java versions:
java version "1.8.0_141"
Java(TM) SE Runtime Environment (build 1.8.0_141-b15)
Java HotSpot(TM) Client VM (build 25.141-b15, mixed mode)
Please see the complete log contents from output.txt which is generated by gradlew -s mainExecutable
See file:///D:/tutorials/c-executable/build/tmp/linkMainExecutable/output.txt for all output for linkMainExecutable.
linking main.exe failed.
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/libstdc++.dll.a when searching for -lstdc++
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/libstdc++.a when searching for -lstdc++
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0\libstdc++.a when searching for -lstdc++
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/libstdc++.dll.a when searching for -lstdc++
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/libstdc++.a when searching for -lstdc++
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lstdc++
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/lib/libmingw32.a when searching for -lmingw32
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/lib\libmingw32.a when searching for -lmingw32
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/lib/libmingw32.a when searching for -lmingw32
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lmingw32
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/lib/libgcc_s.a when searching for -lgcc_s
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/lib\libgcc_s.a when searching for -lgcc_s
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/lib/libgcc_s.a when searching for -lgcc_s
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lgcc_s
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/libgcc.a when searching for -lgcc
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0\libgcc.a when searching for -lgcc
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/libgcc.a when searching for -lgcc
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lgcc
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/lib/libmoldname.a when searching for -lmoldname
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/lib\libmoldname.a when searching for -lmoldname
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/lib/libmoldname.a when searching for -lmoldname
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lmoldname
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/lib/libmingwex.a when searching for -lmingwex
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/lib\libmingwex.a when searching for -lmingwex
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/lib/libmingwex.a when searching for -lmingwex
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lmingwex
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/lib/libmsvcrt.a when searching for -lmsvcrt
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/lib\libmsvcrt.a when searching for -lmsvcrt
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/lib/libmsvcrt.a when searching for -lmsvcrt
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lmsvcrt
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/lib/libpthread.dll.a when searching for -lpthread
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/lib/libpthread.a when searching for -lpthread
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/lib\libpthread.a when searching for -lpthread
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/lib/libpthread.dll.a when searching for -lpthread
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/lib/libpthread.a when searching for -lpthread
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lpthread
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/lib/libadvapi32.a when searching for -ladvapi32
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/lib\libadvapi32.a when searching for -ladvapi32
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/lib/libadvapi32.a when searching for -ladvapi32
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -ladvapi32
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/lib/libshell32.a when searching for -lshell32
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/lib\libshell32.a when searching for -lshell32
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/lib/libshell32.a when searching for -lshell32
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lshell32
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/lib/libuser32.a when searching for -luser32
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/lib\libuser32.a when searching for -luser32
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/lib/libuser32.a when searching for -luser32
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -luser32
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/lib/libkernel32.a when searching for -lkernel32
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/lib\libkernel32.a when searching for -lkernel32
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/lib/libkernel32.a when searching for -lkernel32
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lkernel32
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/lib/libiconv.a when searching for -liconv
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/lib\libiconv.a when searching for -liconv
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../libiconv.a when searching for -liconv
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../..\libiconv.a when searching for -liconv
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/lib/libiconv.a when searching for -liconv
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../libiconv.a when searching for -liconv
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -liconv
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/lib/libmingw32.a when searching for -lmingw32
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/lib\libmingw32.a when searching for -lmingw32
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/lib/libmingw32.a when searching for -lmingw32
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lmingw32
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/lib/libgcc_s.a when searching for -lgcc_s
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/lib\libgcc_s.a when searching for -lgcc_s
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/lib/libgcc_s.a when searching for -lgcc_s
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lgcc_s
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/libgcc.a when searching for -lgcc
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0\libgcc.a when searching for -lgcc
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/libgcc.a when searching for -lgcc
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lgcc
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/lib/libmoldname.a when searching for -lmoldname
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/lib\libmoldname.a when searching for -lmoldname
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/lib/libmoldname.a when searching for -lmoldname
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lmoldname
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/lib/libmingwex.a when searching for -lmingwex
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/lib\libmingwex.a when searching for -lmingwex
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/lib/libmingwex.a when searching for -lmingwex
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lmingwex
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/lib/libmsvcrt.a when searching for -lmsvcrt
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/lib\libmsvcrt.a when searching for -lmsvcrt
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/lib/libmsvcrt.a when searching for -lmsvcrt
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lmsvcrt
collect2.exe: error: ld returned 1 exit status
Finished linkMainExecutable, see full log file:///D:/tutorials/c-executable/build/tmp/linkMainExecutable/output.txt.
Mingw-w64 (as the log suggests) is not supported, not even by the latest Gradle 5.1.1.
you can build with:
GCC with Cygwin 32
GCC with Cygwin 64 (not officially supported)
GCC with MinGW
Visual C++
Visual Studio appears to be the best option for building with Gradle, on a Windows system.

Compiling error in NASM - Windows

I am trying to compile a simple hello world using C with NASM on Windows 10. I have NASM and gcc installed. The code looks like this:
global _main
extern _printf
section .text
_main:
push message
call _printf
add esp, 4
ret
message:
db 'Hello, World', 10, 0
To compile it i run the following commands:
nasm -f win32 helloworld.asm
gcc -m32 helloworld.obj -o helloworld.exe
And this is what i get as an output:
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/6.4.0//libgcc_s.dll.a when searching for -lgcc_s
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/6.4.0/libgcc_s.dll.a when searching for -lgcc_s
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/6.4.0//libgcc_s.dll.a when searching for -lgcc_s
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/6.4.0/libgcc_s.dll.a when searching for -lgcc_s
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lgcc_s
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/6.4.0//libgcc.a when searching for -lgcc
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/6.4.0//libgcc.a when searching for -lgcc
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/6.4.0/libgcc.a when searching for -lgcc
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/6.4.0/libgcc.a when searching for -lgcc
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/6.4.0//libgcc.a when searching for -lgcc
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/6.4.0/libgcc.a when searching for -lgcc
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lgcc
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../libcygwin.a when searching for -lcygwin
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../libcygwin.a when searching for -lcygwin
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../libcygwin.a when searching for -lcygwin
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lcygwin
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: cannot find -ladvapi32
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lshell32
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: cannot find -luser32
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lkernel32
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/6.4.0//libgcc_s.dll.a when searching for -lgcc_s
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/6.4.0/libgcc_s.dll.a when searching for -lgcc_s
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/6.4.0//libgcc_s.dll.a when searching for -lgcc_s
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/6.4.0/libgcc_s.dll.a when searching for -lgcc_s
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lgcc_s
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/6.4.0//libgcc.a when searching for -lgcc
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/6.4.0//libgcc.a when searching for -lgcc
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/6.4.0/libgcc.a when searching for -lgcc
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/6.4.0/libgcc.a when searching for -lgcc
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/6.4.0//libgcc.a when searching for -lgcc
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/6.4.0/libgcc.a when searching for -lgcc
/usr/lib/gcc/x86_64-pc-cygwin/6.4.0/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lgcc
collect2: error: ld returned 1 exit status
Does anyone have any idea what is going wrong here ?
Edit: After mentioned by Jester, i installed the 32 bit version of cygwin, but now a new issue appeared:
gcc.exe -m32 C:\Users\username\Desktop\helloworld.obj -o helloworld.exe
/cygdrive/c/cygwin64/bin/../lib/gcc/i686-pc-cygwin/6.4.0/../../../crt0.o: file not recognized: File format not recognized
collect2: error: ld returned 1 exit status
As #Jester said the 32 bit version of cygwin had to be installed, and that was the original issue. But, after installing the 32 bit version of cygwin new problems started to show up, which had to do with cygwin itself. After some digging i found that others had the same issue as well, since the installation of cygwin is buggy. Changing to the Mingw compiler (32 and 64 bit version) fixed the issue completely.

How to compile a 32bit hello world on alpine?

Given a simple hello world code:
#include <stdio.h>
int main(void){
puts("hello");
return 0;
}
On a 64bit alpine linux installation I tried to compile it as 64bit and as 32bit.
The first works fine, but the second is missing 32bit libraries:
~ # gcc -Wall hello.c
~ # gcc -Wall -m32 hello.c
/usr/lib/gcc/x86_64-alpine-linux-musl/5.3.0/../../../../x86_64-alpine-linux-musl/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-alpine-linux-musl/5.3.0/../../../libssp_nonshared.a when searching for -lssp_nonshared
/usr/lib/gcc/x86_64-alpine-linux-musl/5.3.0/../../../../x86_64-alpine-linux-musl/bin/ld: skipping incompatible //usr/lib/libssp_nonshared.a when searching for -lssp_nonshared
/usr/lib/gcc/x86_64-alpine-linux-musl/5.3.0/../../../../x86_64-alpine-linux-musl/bin/ld: cannot find -lssp_nonshared
/usr/lib/gcc/x86_64-alpine-linux-musl/5.3.0/../../../../x86_64-alpine-linux-musl/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-alpine-linux-musl/5.3.0/libgcc.a when searching for -lgcc
/usr/lib/gcc/x86_64-alpine-linux-musl/5.3.0/../../../../x86_64-alpine-linux-musl/bin/ld: cannot find -lgcc
/usr/lib/gcc/x86_64-alpine-linux-musl/5.3.0/../../../../x86_64-alpine-linux-musl/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-alpine-linux-musl/5.3.0/../../../libgcc_s.so when searching for -lgcc_s
/usr/lib/gcc/x86_64-alpine-linux-musl/5.3.0/../../../../x86_64-alpine-linux-musl/bin/ld: skipping incompatible //usr/lib/libgcc_s.so when searching for -lgcc_s
/usr/lib/gcc/x86_64-alpine-linux-musl/5.3.0/../../../../x86_64-alpine-linux-musl/bin/ld: cannot find -lgcc_s
/usr/lib/gcc/x86_64-alpine-linux-musl/5.3.0/../../../../x86_64-alpine-linux-musl/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-alpine-linux-musl/5.3.0/../../../libc.so when searching for -lc
/usr/lib/gcc/x86_64-alpine-linux-musl/5.3.0/../../../../x86_64-alpine-linux-musl/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-alpine-linux-musl/5.3.0/../../../libc.a when searching for -lc
/usr/lib/gcc/x86_64-alpine-linux-musl/5.3.0/../../../../x86_64-alpine-linux-musl/bin/ld: skipping incompatible //usr/lib/libc.so when searching for -lc
/usr/lib/gcc/x86_64-alpine-linux-musl/5.3.0/../../../../x86_64-alpine-linux-musl/bin/ld: skipping incompatible //usr/lib/libc.a when searching for -lc
/usr/lib/gcc/x86_64-alpine-linux-musl/5.3.0/../../../../x86_64-alpine-linux-musl/bin/ld: cannot find -lc
/usr/lib/gcc/x86_64-alpine-linux-musl/5.3.0/../../../../x86_64-alpine-linux-musl/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-alpine-linux-musl/5.3.0/libgcc.a when searching for -lgcc
/usr/lib/gcc/x86_64-alpine-linux-musl/5.3.0/../../../../x86_64-alpine-linux-musl/bin/ld: cannot find -lgcc
/usr/lib/gcc/x86_64-alpine-linux-musl/5.3.0/../../../../x86_64-alpine-linux-musl/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-alpine-linux-musl/5.3.0/../../../libgcc_s.so when searching for -lgcc_s
/usr/lib/gcc/x86_64-alpine-linux-musl/5.3.0/../../../../x86_64-alpine-linux-musl/bin/ld: skipping incompatible //usr/lib/libgcc_s.so when searching for -lgcc_s
/usr/lib/gcc/x86_64-alpine-linux-musl/5.3.0/../../../../x86_64-alpine-linux-musl/bin/ld: cannot find -lgcc_s
collect2: error: ld returned 1 exit status
Because I found no obvious way to fix this, I fetched the 32bit version of gcc, libgcc, and musl-dev extracted to a local directory and set LIBRARY_PATH:
~ # LIBRARY_PATH=usr/lib/gcc/i586-alpine-linux-musl/5.3.0:usr/lib gcc -Wall -m32 hello.c
/usr/lib/gcc/x86_64-alpine-linux-musl/5.3.0/../../../../x86_64-alpine-linux-musl/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-alpine-linux-musl/5.3.0/libgcc.a when searching for -lgcc
/usr/lib/gcc/x86_64-alpine-linux-musl/5.3.0/../../../../x86_64-alpine-linux-musl/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-alpine-linux-musl/5.3.0/libgcc.a when searching for -lgcc
/usr/lib/gcc/x86_64-alpine-linux-musl/5.3.0/../../../../x86_64-alpine-linux-musl/bin/ld: i386:x86-64 architecture of input file `/usr/lib/gcc/x86_64-alpine-linux-musl/5.3.0/crtbeginS.o' is incompatible with i386 output
/usr/lib/gcc/x86_64-alpine-linux-musl/5.3.0/../../../../x86_64-alpine-linux-musl/bin/ld: i386:x86-64 architecture of input file `/usr/lib/gcc/x86_64-alpine-linux-musl/5.3.0/crtendS.o' is incompatible with i386 output
collect2: error: ld returned 1 exit status
~ #
This partly fixed the issues, but gcc still tries the 64bit libraries first and finds tries to find the 64bit crt files.
So what is the correct way to compile a 32bit binary on alpine linux?
To make the last problem more clear, look at this:
~ # LIBRARY_PATH=/tmp gcc --verbose -Wall -m32 hello.c 2>&1|grep LIBRARY_PATH
LIBRARY_PATH=/usr/lib/gcc/x86_64-alpine-linux-musl/5.3.0/:/tmp/:/usr/lib/gcc/x86_64-alpine-linux-musl/5.3.0/../../../../x86_64-alpine-linux-musl/lib/:/usr/lib/gcc/x86_64-alpine-linux-musl/5.3.0/../../../:/lib/:/usr/lib/
If I only set some LIBRARY_PATH, the compiler internally adds other directories to it. Especially it also prepends the "wrong" system directory, which contains the 64bit libraries. Therefore it uses the wrong crt libs and therefore the last error above.
I either need the correct alpine package (and not care about how it works), or I need to understand how to change that first path added internally by gcc.
According to gcc -v on alpine gcc is compiled without multilib support:
--disable-multilib
While multilib is enabled on debian:
--with-multilib-list=m32,m64,mx32 --enable-multilib
Multilib support is required for the -m32 to work reliable. Therefore the default compiler on alpine is really not suited for compiling 32bit binaries.

Link two object files using gcc

I would like to link two object files, but when I use
gcc -m32 file1.o file2.s -o output_file (I read somewhere that assembly files do not have to be compile to objects)
it gets errors:
/usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.3//libgcc_s.dll.a when searching for
-lgcc_s /usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.3/libgcc_s.dll.a when searching for
-lgcc_s /usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.3//libgcc_s.dll.a when searching for
-lgcc_s /usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.3/libgcc_s.dll.a when searching for
-lgcc_s /usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../x86_64-pc-cygwin/bin/ld: cannotfind -lgcc_s /usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.3//libgcc.a when searching for -lgcc /usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.3//libgcc.a when searching for -lgcc /usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.3/libgcc.a when searching for -lgcc /usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.3/libgcc.a when searching for -lgcc /usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.3//libgcc.a when searching for -lgcc /usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.3/libgcc.a when searching for -lgcc /usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lgcc /usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../libcygwin.a when searching for -lcygwin /usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../libcygwin.a when searching for -lcygwin /usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../libcygwin.a when searching for -lcygwin /usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lcygwin /usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../x86_64-pc-cygwin/bin/ld: cannot find -ladvapi32 /usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lshell32 /usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../x86_64-pc-cygwin/bin/ld: cannot find -luser32 /usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lkernel32 /usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.3//libgcc_s.dll.a when searching for
-lgcc_s /usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.3/libgcc_s.dll.a when searching for
-lgcc_s /usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.3//libgcc_s.dll.a when searching for
-lgcc_s /usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.3/libgcc_s.dll.a when searching for
-lgcc_s /usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lgcc_s /usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.3//libgcc.a when searching for -lgcc /usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.3//libgcc.a when searching for -lgcc /usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.3/libgcc.a when searching for -lgcc /usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.3/libgcc.a when searching for -lgcc /usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.3//libgcc.a when searching for -lgcc /usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.3/libgcc.a when searching for - lgcc /usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lgcc collect2: error: ld returned 1 exit status
I know I am clearly missing something but no idea where to get those missing files. Can anyone help me?
Thanks a lot.
It seems you are using -m32 on a 64bit machine.-m32 is -m32 is for compiling 32 bit objects when the compiler is configured, by default, to compile 64 bits objects.
The error is occurring because you don't have the 32bit version of the standard library installed.
By removing -m32, to get gcc file1.o file2.s -o output_file, you stop asking the compile to link two 64bit objects as a 32bit executable, and the resultant executable is then 64bit (as configured by default).
However, if you really want 32bit, then you should compile your objects using -m32. You will also need to make sure that you have the relevant 32bit standard library

Linking with GCC and x86 ASM in x64 Environment

I am running Windows Ultimate x64 (Core i5), and using the x64 GCC compiler on Cygwin. I wanted to create a simple "Hello, world" program by linking against the GCC C library (installed via Cygwin). I am using NASM and trying both ELF32 and Win32 formats for the following code:
;;
;; hello.asm - use the C library to output hello world
;;
; In case I wanted to use the code for Windows later
%if 0
%define main _main
%define printf _printf
%endif
global main
extern printf
; we set up our string here
section .data
formatstr: db 'hello, world!', 10, 0
section .text
main:
sub esp, 4
lea eax, [formatstr]
mov [esp], eax
call printf
add esp, 4
mov eax, 0
ret
When using nasm -f elf32 hello.asm or nasm -f win32 hello.asm, along with gcc hello.o -o hello, GCC tells me:
/usr/lib/gcc/x86_64-pc-cygwin/4.8.3/../../../../x86_64-pc-cygwin/bin/ld: i386 architecture of input file `hello.o' is incompatible with i386:x86-64 output
collect2: error: ld returned 1 exit status
My Googling led me to install the cygwin32 package for Cygwin, so I've done that.
When I looked up how to run GCC in 32-bit mode, I added the m32 switch, but this resulted in more error output for both ELF and Win32:
/usr/lib/gcc/x86_64-pc-cygwin/4.8.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/ lib/gcc/x86_64-pc-cygwin/4.8.3//libgcc_s.dll.a when searching for -lgcc_s
/usr/lib/gcc/x86_64-pc-cygwin/4.8.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/ lib/gcc/x86_64-pc-cygwin/4.8.3/libgcc_s.dll.a when searching for -lgcc_s
/usr/lib/gcc/x86_64-pc-cygwin/4.8.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/ lib/gcc/x86_64-pc-cygwin/4.8.3//libgcc_s.dll.a when searching for -lgcc_s
/usr/lib/gcc/x86_64-pc-cygwin/4.8.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/ lib/gcc/x86_64-pc-cygwin/4.8.3/libgcc_s.dll.a when searching for -lgcc_s
/usr/lib/gcc/x86_64-pc-cygwin/4.8.3/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lgcc_s
/usr/lib/gcc/x86_64-pc-cygwin/4.8.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/ lib/gcc/x86_64-pc-cygwin/4.8.3//libgcc.a when searching for -lgcc
/usr/lib/gcc/x86_64-pc-cygwin/4.8.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/ lib/gcc/x86_64-pc-cygwin/4.8.3//libgcc.a when searching for -lgcc
/usr/lib/gcc/x86_64-pc-cygwin/4.8.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/ lib/gcc/x86_64-pc-cygwin/4.8.3/libgcc.a when searching for -lgcc
/usr/lib/gcc/x86_64-pc-cygwin/4.8.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/ lib/gcc/x86_64-pc-cygwin/4.8.3/libgcc.a when searching for -lgcc
/usr/lib/gcc/x86_64-pc-cygwin/4.8.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/ lib/gcc/x86_64-pc-cygwin/4.8.3//libgcc.a when searching for -lgcc
/usr/lib/gcc/x86_64-pc-cygwin/4.8.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/ lib/gcc/x86_64-pc-cygwin/4.8.3/libgcc.a when searching for -lgcc
/usr/lib/gcc/x86_64-pc-cygwin/4.8.3/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lgcc
/usr/lib/gcc/x86_64-pc-cygwin/4.8.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/ lib/gcc/x86_64-pc-cygwin/4.8.3/../../../libcygwin.a when searching for -lcygwin
/usr/lib/gcc/x86_64-pc-cygwin/4.8.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/ lib/gcc/x86_64-pc-cygwin/4.8.3/../../../libcygwin.a when searching for -lcygwin
/usr/lib/gcc/x86_64-pc-cygwin/4.8.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/ lib/gcc/x86_64-pc-cygwin/4.8.3/../../../libcygwin.a when searching for -lcygwin
/usr/lib/gcc/x86_64-pc-cygwin/4.8.3/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lcygwin
/usr/lib/gcc/x86_64-pc-cygwin/4.8.3/../../../../x86_64-pc-cygwin/bin/ld: cannot find -ladvapi32
/usr/lib/gcc/x86_64-pc-cygwin/4.8.3/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lshell32
/usr/lib/gcc/x86_64-pc-cygwin/4.8.3/../../../../x86_64-pc-cygwin/bin/ld: cannot find -luser32
/usr/lib/gcc/x86_64-pc-cygwin/4.8.3/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lkernel32
/usr/lib/gcc/x86_64-pc-cygwin/4.8.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/ lib/gcc/x86_64-pc-cygwin/4.8.3//libgcc_s.dll.a when searching for -lgcc_s
/usr/lib/gcc/x86_64-pc-cygwin/4.8.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/ lib/gcc/x86_64-pc-cygwin/4.8.3/libgcc_s.dll.a when searching for -lgcc_s
/usr/lib/gcc/x86_64-pc-cygwin/4.8.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/ lib/gcc/x86_64-pc-cygwin/4.8.3//libgcc_s.dll.a when searching for -lgcc_s
/usr/lib/gcc/x86_64-pc-cygwin/4.8.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/ lib/gcc/x86_64-pc-cygwin/4.8.3/libgcc_s.dll.a when searching for -lgcc_s
/usr/lib/gcc/x86_64-pc-cygwin/4.8.3/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lgcc_s
/usr/lib/gcc/x86_64-pc-cygwin/4.8.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/ lib/gcc/x86_64-pc-cygwin/4.8.3//libgcc.a when searching for -lgcc
/usr/lib/gcc/x86_64-pc-cygwin/4.8.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/ lib/gcc/x86_64-pc-cygwin/4.8.3//libgcc.a when searching for -lgcc
/usr/lib/gcc/x86_64-pc-cygwin/4.8.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/ lib/gcc/x86_64-pc-cygwin/4.8.3/libgcc.a when searching for -lgcc
/usr/lib/gcc/x86_64-pc-cygwin/4.8.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/ lib/gcc/x86_64-pc-cygwin/4.8.3/libgcc.a when searching for -lgcc
/usr/lib/gcc/x86_64-pc-cygwin/4.8.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/ lib/gcc/x86_64-pc-cygwin/4.8.3//libgcc.a when searching for -lgcc
/usr/lib/gcc/x86_64-pc-cygwin/4.8.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/ lib/gcc/x86_64-pc-cygwin/4.8.3/libgcc.a when searching for -lgcc
/usr/lib/gcc/x86_64-pc-cygwin/4.8.3/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lgcc
collect2: error: ld returned 1 exit status
I'm still quite new to assembler and digesting ABIs, so I'm not quite sure how to proceed here. I feel I'm missing something very simple, as I've successfully linked assembler code I've written for a C project in the past.
Thanks to Adam Rosenfield pointing out the Cygwin mailing list post, I went ahead and tried to rewrite my ASM with x64 support in mind. This did allow me to output a binary with GCC. I should note that my program causes a segmentation fault, but that's an issue of me not really knowing x64 assembler or the respective calling conventions well enough.

Resources