Re: [hatari-devel] Windows cross compile build inconsistencies with SDL2

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


This is what I encountered during my first attempt at building Hatari on windows via msys/mingw (in addition to the pkg-config behavior i noted in a separate post). I added the SDL2_LIBRARY to the link dependencies to all the executables that failed (starting with build68k.exe) to resolve the missing symbols.

Since the additional SDL2 other cflags is added in cmake via add_definitions, it’s applied to every file compilation. If the SDL2 additional cflags is required for a specific target, rather than all files, perhaps we can use cmake's target_compile_definitions to make it explicit in the cmake code and build rules to apply these additional cflags to specific named targets.

Chang


> On Apr 2, 2021, at 7:03 AM, Jens Guenther <dbotw@xxxxxxx> wrote:
> 
> On Fri, 2 Apr 2021 13:17:14 +0200 Thomas Huth <th.huth@xxxxxxxxx> wrote:
> 
>> What failure do you exactly get?
> 
> [  0%] Building C object src/cpu/CMakeFiles/build68k.dir/build68k.c.obj
> <command-line>: warning: no previous prototype for 'SDL_main' [-Wmissing-prototypes]
> C:/msys64/home/jens/hatari/src/cpu/build68k.c:59:5: note: in expansion of macro 'main'
>   59 | int main(int argc, char **argv)
>      |     ^~~~
> [  1%] Building C object src/cpu/CMakeFiles/build68k.dir/writelog.c.obj
> [  1%] Linking C executable build68k.exe
> C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libmingw32.a(lib64_libmingw32_a-crt0_c.o): in function `main':
> C:/_/M/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/crt/crt0_c.c:18: undefined reference to `WinMain'
> collect2.exe: error: ld returned 1 exit status
> make[2]: *** [src/cpu/CMakeFiles/build68k.dir/build.make:118: src/cpu/build68k.exe] Error 1
> make[1]: *** [CMakeFiles/Makefile2:533: src/cpu/CMakeFiles/build68k.dir/all] Error 2
> make: *** [Makefile:146: all] Error 2
> 
>> Hmm, that can't be the solution either. IIRC I once added the whole
>> stuff with the "other cflags" to fix compilation problems on Windows...
> 
> Sorry, I wasn't sure if SDL2_OTHER_CFLAGS is required on other platforms.
> 
>> ... maybe we could simply drop this completely now?
> 
> Probably the best solution ... :-)
> 
> Jens
> 
> 




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/