I'm trying to create a makefile for my SDL2 project. But the linker can't find "-lSDL2". I'm using GCC 4.9.2.
Here is the makefile:
# Files to be compiled
OBJS = main.c
# Compiler
CC = gcc
# Include paths
INCLUDE_PATHS = -ID:\George\SDL2-2.0.3\i686-w64-mingw32\include\SDL2
# Library paths
LIBRARY_PATHS = -LD:\George\SDL2-2.0.3\i686-w64-mingw32\lib
# Compiler flags
COMPILER_FLAGS = -Wall
# Linker flags
LINKER_FLAGS = -lmingw32 -lSDL2main -lSDL2
# Executable file
OBJ_NAME = main
# Compile command
all: $(OBJS)
$(CC) $(OBJS) $(INCLUDE_PATHS) $(LIBRARY_PATHS) $(COMPILER_FLAGS) $(LINKER_FLAGS) -o $(OBJ_NAME)
And here are the errors I get when I run the "make" command:
D:\George\Projects>make
gcc main.c -ID:\George\SDL2-2.0.3\i686-w64-mingw32\include\SDL2 -LD:\George\SDL2
-2.0.3\i686-w64-mingw32\lib -Wall -lmingw32 -lSDL2main -lSDL2 -o main
D:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible D:\George\SDL2-2.0.3\i686-w64-mingw32\lib/libS
DL2main.a when searching for -lSDL2main
D:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible D:\George\SDL2-2.0.3\i686-w64-mingw32\lib\libS
DL2main.a when searching for -lSDL2main
D:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible D:\George\SDL2-2.0.3\i686-w64-mingw32\lib/libS
DL2main.a when searching for -lSDL2main
D:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/../../../../x86_64-w64-mingw32/
bin/ld.exe: cannot find -lSDL2main
D:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible D:\George\SDL2-2.0.3\i686-w64-mingw32\lib/libS
DL2.dll.a when searching for -lSDL2
D:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible D:\George\SDL2-2.0.3\i686-w64-mingw32\lib/libS
DL2.a when searching for -lSDL2
D:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible D:\George\SDL2-2.0.3\i686-w64-mingw32\lib\libS
DL2.a when searching for -lSDL2
D:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible D:\George\SDL2-2.0.3\i686-w64-mingw32\lib/libS
DL2.dll.a when searching for -lSDL2
D:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/../../../../x86_64-w64-mingw32/
bin/ld.exe: skipping incompatible D:\George\SDL2-2.0.3\i686-w64-mingw32\lib/libS
DL2.a when searching for -lSDL2
D:/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/../../../../x86_64-w64-mingw32/
bin/ld.exe: cannot find -lSDL2
collect2.exe: error: ld returned 1 exit status
makefile:24: recipe for target 'all' failed
make: *** [all] Error 1
D:\George\Projects>
If anyone can help me I would be really grateful.
Related
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.
i am trying to compile Xash3d from https://github.com/FWGS/xash3d (an open source hl1 engine), i am using ubuntu 16 64 bits and when running the makefile i get this error:
/usr/bin/ld: skipping incompatible /usr/local/lib/gcc/x86_64-pc-linux-gnu/6.3.0/../../../libSDL2.so when searching for -lSDL2
/usr/bin/ld: skipping incompatible /usr/local/lib/gcc/x86_64-pc-linux-gnu/6.3.0/../../../libSDL2.a when searching for -lSDL2
/usr/bin/ld: skipping incompatible //usr/local/lib/libSDL2.so when searching for -lSDL2
/usr/bin/ld: skipping incompatible //usr/local/lib/libSDL2.a when searching for -lSDL2
/usr/bin/ld: cannot find -lSDL2
/usr/bin/ld: skipping incompatible /usr/local/lib/gcc/x86_64-pc-linux-gnu/6.3.0/libgcc.a when searching for -lgcc
/usr/bin/ld: cannot find -lgcc
/usr/bin/ld: cannot find -lgcc_s
collect2: error: ld returned 1 exit status
Makefile.linux:107: recipe for target 'xash' failed
make: *** [xash] Error 1
I have installed the libsdl2-dev package for both, 32 and 64 bits.
This is the makefile out:
gcc -g -o xash -fvisibility=hidden -m32 ... -lm -lSDL2 -pthread -lX11 -ldl
I have also try to compile other projects with the flag -lSDL2 and they compile just fine.
Any clue?
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.
I am trying to install "TAUCS" (http://www.tau.ac.il/~stoledo/taucs/) library. However, I am getting following error:
/usr/bin/ld: cannot find -lmetis
/usr/bin/ld: cannot find -lg2c
collect2: error: ld returned 1 exit status
make: [build/linux/taucs_config_tests.h] Error 1 (ignored)
obj/linux/taucs_c99_complex_test build/linux/taucs_config_tests.h
make: obj/linux/taucs_c99_complex_test: Command not found
and more errors follow.
I guess that the main error is not being able to find lg2c.
I guess I use already gcc which uses gfortran instead of g77. Where can I find g2c.a?
Searching in software manager returns me with no result. Searching in google gives me everything else other than what I am looking for.
UPDATE:
I could install g77 as described.
However, that still leaves an error:
/usr/bin/ld: skipping incompatible external/lib/linux/liblapack.a when searching for -llapack
/usr/bin/ld: skipping incompatible external/lib/linux/liblapack.a when searching for -llapack
/usr/bin/ld: skipping incompatible external/lib/linux/liblapack.a when searching for -llapack
/usr/bin/ld: skipping incompatible external/lib/linux/libf77blas.a when searching for -lf77blas
/usr/bin/ld: skipping incompatible external/lib/linux/libf77blas.a when searching for -lf77blas
/usr/bin/ld: skipping incompatible external/lib/linux/libf77blas.a when searching for -lf77blas
/usr/bin/ld: skipping incompatible external/lib/linux/libcblas.a when searching for -lcblas
/usr/bin/ld: skipping incompatible external/lib/linux/libcblas.a when searching for -lcblas
/usr/bin/ld: skipping incompatible external/lib/linux/libcblas.a when searching for -lcblas
/usr/bin/ld: skipping incompatible external/lib/linux/libatlas.a when searching for -latlas
/usr/bin/ld: skipping incompatible external/lib/linux/libatlas.a when searching for -latlas
/usr/bin/ld: skipping incompatible external/lib/linux/libatlas.a when searching for -latlas
/usr/bin/ld: skipping incompatible external/lib/linux/libmetis.a when searching for -lmetis
/usr/bin/ld: skipping incompatible external/lib/linux/libmetis.a when searching for -lmetis
/usr/bin/ld: skipping incompatible external/lib/linux/libmetis.a when searching for -lmetis
obj/linux/taucs_c99_complex_test build/linux/taucs_config_tests.h
C99 complex numbers seem to be supported, 1+sqrt(-1)=-1.000000+1.000000i
cc -c -O3 -Wall -Werror -std=c99 -DMACHTYPE_ -I src/ -I build/linux/ -I external/src/ \
progs/taucs_cilk_test.c \
-oobj/linux/taucs_cilk_test.o
progs/taucs_cilk_test.c:8:19: fatal error: cilk.h: No such file or directory
#include <cilk.h>
^
compilation terminated.
make: [build/linux/taucs_config_tests.h] Error 1 (ignored)
cc \
-oobj/linux/taucs_cilk_test \
obj/linux/taucs_cilk_test.o -L external/lib/linux -llapack -L external/lib/linux -lf77blas -lcblas -latlas -L external/lib/linux -lmetis -lg2c -lm
cc: error: obj/linux/taucs_cilk_test.o: No such file or directory
make: [build/linux/taucs_config_tests.h] Error 1 (ignored)
obj/linux/taucs_cilk_test build/linux/taucs_config_tests.h
make: obj/linux/taucs_cilk_test: Command not found
make: [build/linux/taucs_config_tests.h] Error 127 (ignored)
cc -c -O3 -Wall -Werror -std=c99 -DMACHTYPE_ -I src/ -I build/linux/ -I external/src/ \
-DTAUCS_CORE_GENERAL \
src/taucs_sn_llt.c \
-oobj/linux/taucs_sn_llt.o
src/taucs_sn_llt.c:1339:1: error: ‘tree_first_descendant’ defined but not used [-Werror=unused-function]
tree_first_descendant(int j,
^
cc1: all warnings being treated as errors
make: *** [obj/linux/taucs_sn_llt.o] Error 1
Here is what I did to install TAUCS library
1) Download the Version 2.2 of the code, with external libraries, tgz format
wget http://www.tau.ac.il/~stoledo/taucs/2.2/taucs_full.tgz
2) Unpack it in your chosen location
mkdir taucs_full
tar xvf taucs_full.tgz -C taucs_full
cd taucs_full
3)If you didn't already do so, install libf2c2-dev (for libf2c)
sudo apt-get install libf2c2-dev
4) Remove the -Werror flag from the global compiler options file (there are going to be warnings, so it will never build if we treat them as errors)
sed -i 's/-Werror//g' config/linux.mk
5)Now run the configure script
./configure
6) Finally we need to do some command and library wrangling for the actual make
make "CC=gcc" "FC=gfortran" "LIBF77=-Wl,-Bstatic -lf2c -Wl,-Bdynamic -lgfortran"
You should get a binary executable in ./bin/linux - If you just try to run, it will give this message:
$ bin/linux/taucs_run
taucs_run: there is no matrix!
The credit for this answer must go to #steeldriver from askubuntu.com
Try installing g77.
I did the following:
1) Downloaded g77 for 64 bits from here
http://www.ziddu.com/download/16792814/g77_x64_debian_and_ubuntu.tar.gz.html
You can choose 32 bits accordingly.
2) Then did the following:
tar -xzvf g77_x64_debian_and_ubuntu.tar.gz
cd g77_x64_debian_and_ubuntu
chmod +x ./install.sh
./install.sh
(answer adapted from askubuntu)
I'm trying to compile a C code which need SDL libraries(v1.2), SDL_draw and a library imposed by my teacher. the .c and makefile code works on an other computer.
I use a makefile and when I 'make' I get severals errors :
- first SDL_draw cannot be find although I paste it in /usr/include/2011/lib/libSDL_draw.a
- all other libraire are 'skipping incompatible' (I hope that those are just warnings)
- I though that it was compiled in static and the .so wouldn't be needed.
And I wondered what is the mysterious variable LFLMAC.
/outup given by terminal/
gcc -o demo1 demo1.o -g -L/usr/include/2011/lib -L/usr/local/lib -lSDLmain -lSDL -lSDL_ttf -lSDL_image -lSDL_draw -lSDL_phelma
/usr/bin/ld: skipping incompatible /usr/include/2011/lib/libSDLmain.a when searching for -lSDLmain
/usr/bin/ld: skipping incompatible /usr/include/2011/lib/libSDL.so when searching for -lSDL
/usr/bin/ld: skipping incompatible /usr/include/2011/lib/libSDL.a when searching for -lSDL
/usr/bin/ld: skipping incompatible /usr/include/2011/lib/libSDL_ttf.so when searching for -lSDL_ttf
/usr/bin/ld: skipping incompatible /usr/include/2011/lib/libSDL_ttf.a when searching for -lSDL_ttf
/usr/bin/ld: skipping incompatible /usr/include/2011/lib/libSDL_image.so when searching for -lSDL_image
/usr/bin/ld: skipping incompatible /usr/include/2011/lib/libSDL_image.a when searching for -lSDL_image
/usr/bin/ld: skipping incompatible /usr/include/2011/lib/libSDL_draw.so when searching for -lSDL_draw
/usr/bin/ld: skipping incompatible /usr/include/2011/lib/libSDL_draw.a when searching for -lSDL_draw
/usr/bin/ld: cannot find -lSDL_draw
collect2: ld returned 1 exit status
make: *** [demo1] Erreur 1
/makefile/
`
DIRSDL=/usr/include/2011
CFLAGS=-g -O2 -I$(DIRSDL)/include
LDFLAGS=$(LFLMAC) -g -L$(DIRSDL)/lib -L/usr/local/lib -lSDLmain -lSDL -lSDL_ttf -lSDL_image -lSDL_draw -lSDL_phelma
demo1: demo1.o
gcc -o demo1 demo1.o $(LDFLAGS)
demo1.o : demo1.c
gcc -c $(CFLAGS) demo1.c
`
skipping incompatible linker message means that the library is incompatible with the binary currently being linked. E.g. you are linking a 64-bit binary with 32-bit libraries, or vice versa.
Try invoking:
file demo1.o
file /usr/include/2011/lib/libSDLmain.a
from the shell to see what architectures these files are for.