I was trying to build sdl2 with tcc and hit the following error
tcc: error: cannot specify output file with -c many files
The full command being executed is
echo " CC " build/SDL.lo;/bin/sh ./libtool --quiet --tag=CC --mode=compile tcc -g -DUSING_GENERATED_CONFIG_H -Iinclude -I/tmp/sdl2/include /tmp/sdl2/src/video/khronos -DSDL_BUILD_MAJOR_VERSION=2 -DSDL_BUILD_MINOR_VERSION=30 -DSDL_BUILD_MICRO_VERSION=10 -Wall -Wno-unused-local-typedefs -fno-strict-aliasing -Wdeclaration-after-statement -Werror=declaration-after-statement -I/usr/include/libdrm -D_REENTRANT -DHAVE_LINUX_VERSION_H -c /tmp/sdl2/src/SDL.c -o build/SDL.lo
The suspicious part is coming EXTRA_CFLAGS. Looking at the Make file
EXTRA_CFLAGS = -Iinclude -I/tmp/sdl2/include /tmp/sdl2/src/video/khronos ...
I think it should be
EXTRA_CFLAGS = -Iinclude -I/tmp/sdl2/include -I /tmp/sdl2/src/video/khronos ...
I would just edit the Makefile if it wasn’t auto created. I’m not familiar with CMake so thought it would be faster to just post here so someone could make the trivial fix.
Note that gcc doesn’t complain about this
Note that tcc still won’t compile with this fix. It’ll complain about NULL be redfined due to ./include/begin_code.h and also about lack of spin locks. These seem like separate issues but don’t want to give the impression that tcc could be used if just this was fixed.