How to compile SDLPoP

Open-source port of PoP that runs natively on Windows, Linux, etc.

Moderator: English Moderator Team

Nick2017
Sheikh
Sheikh
Posts: 30
Joined: January 7th, 2017, 10:45 pm

How to compile SDLPoP

Postby Nick2017 » March 5th, 2017, 4:00 pm

I'm trying to compile SDPoP on Windows 7 but I'm having lots of errors.
This is what I've installed:

    Dev-Cpp 5.11 TDM-GCC 4.9.2 Setup
    MinGW 4.8.1
    SDL2-devel-2.0.5-mingw
    SDL2_image-devel-2.0.1-mingw
    SDL2_mixer-devel-2.0.1-mingw

I extracted SDL2 into C:\MinGW32 folder because I guess thats all you have to do.
Then in Dec-Cpp under "Compiler options" I added each directory for binaries, libraries and headers.
What am I missing or doing wrong?

David
The Prince of Persia
The Prince of Persia
Posts: 1327
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: How to compile SDLPoP

Postby David » March 5th, 2017, 6:09 pm

Nick2017 wrote:I'm trying to compile SDPoP on Windows 7 but I'm having lots of errors.

What kind of errors do you get?

Nick2017
Sheikh
Sheikh
Posts: 30
Joined: January 7th, 2017, 10:45 pm

Re: How to compile SDLPoP

Postby Nick2017 » March 6th, 2017, 12:13 am

I get this messages and then a window pops up that says "cc1.exe stopped working".

Code: Select all

Compiling project changes...
--------
- Project Filename: C:\Users\Nicolas\Documents\SDLPoP-1.17\src\port_release.dev
- Compiler Name: TDM-GCC 4.9.2 32-bit Release

Building makefile...
--------
- Filename: C:\Users\Nicolas\Documents\SDLPoP-1.17\src\Makefile.win
- Resource File: C:\Users\Nicolas\Documents\SDLPoP-1.17\src\port_release_private.res

Processing makefile...
--------
- Makefile Processor: C:\MinGW32\bin\mingw32-make.exe
- Command: mingw32-make.exe -f "C:\Users\Nicolas\Documents\SDLPoP-1.17\src\Makefile.win" all

gcc.exe -c main.c -o main.o -I"C:/MinGW32/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/x86_64-w64-mingw32/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include" -m32 -Wall -std=gnu99 -O2In file included from C:/Program Files (x86)/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/x86intrin.h:27:0,
                 from C:/Program Files (x86)/Dev-Cpp/MinGW64/x86_64-w64-mingw32/include/intrin.h:73,
                 from C:/Program Files (x86)/Dev-Cpp/MinGW64/include/SDL2/SDL_cpuinfo.h:44,
                 from C:/Program Files (x86)/Dev-Cpp/MinGW64/include/SDL2/SDL.h:38,
                 from types.h:24,
                 from common.h:43,
                 from main.c:21:
C:/Program Files (x86)/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/ia32intrin.h:54:9: internal compiler error: in c_builtin_function_ext_scope, at c/c-decl.c:3633
 #pragma GCC target("sse4.2")
         ^
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

C:/Program Files (x86)/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/ia32intrin.h:54:9: internal compiler error: Aborted

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

Nick2017
Sheikh
Sheikh
Posts: 30
Joined: January 7th, 2017, 10:45 pm

Re: How to compile SDLPoP

Postby Nick2017 » March 6th, 2017, 3:11 pm

I removed the MinGW64 directories from binaries, lib and header. I only left C:\MinGW32 and now its trying to compile but it fails...

Code: Select all

Compiling project changes...
--------
- Project Filename: C:\Users\Nicolas\Documents\SDLPoP-1.17\src\port_release.dev
- Compiler Name: TDM-GCC 4.9.2 32-bit Release

Building makefile...
--------
- Filename: C:\Users\Nicolas\Documents\SDLPoP-1.17\src\Makefile.win
- Resource File: C:\Users\Nicolas\Documents\SDLPoP-1.17\src\port_release_private.res

Processing makefile...
--------
- Makefile Processor: C:\MinGW32\bin\mingw32-make.exe
- Command: mingw32-make.exe -f "C:\Users\Nicolas\Documents\SDLPoP-1.17\src\Makefile.win" all

gcc.exe -c main.c -o main.o -I"C:/MinGW32/include" -m32 -Wall -std=gnu99 -O2gcc.exe -c seg008.c -o seg008.o -I"C:/MinGW32/include" -m32 -Wall -std=gnu99 -O2gcc.exe -c seg007.c -o seg007.o -I"C:/MinGW32/include" -m32 -Wall -std=gnu99 -O2gcc.exe -c seg009.c -o seg009.o -I"C:/MinGW32/include" -m32 -Wall -std=gnu99 -O2gcc.exe -c seg000.c -o seg000.o -I"C:/MinGW32/include" -m32 -Wall -std=gnu99 -O2seg000.c: In function 'process_key':seg000.c:747:22: warning: 'answer_text' may be used uninitialized in this function [-Wmaybe-uninitialized]
   display_text_bottom(answer_text);
                      ^gcc.exe -c seg003.c -o seg003.o -I"C:/MinGW32/include" -m32 -Wall -std=gnu99 -O2gcc.exe -c seg006.c -o seg006.o -I"C:/MinGW32/include" -m32 -Wall -std=gnu99 -O2gcc.exe -c data.c -o data.o -I"C:/MinGW32/include" -m32 -Wall -std=gnu99 -O2gcc.exe -c seg001.c -o seg001.o -I"C:/MinGW32/include" -m32 -Wall -std=gnu99 -O2gcc.exe -c seg002.c -o seg002.o -I"C:/MinGW32/include" -m32 -Wall -std=gnu99 -O2gcc.exe -c seg004.c -o seg004.o -I"C:/MinGW32/include" -m32 -Wall -std=gnu99 -O2gcc.exe -c seg005.c -o seg005.o -I"C:/MinGW32/include" -m32 -Wall -std=gnu99 -O2gcc.exe -c seqtbl.c -o seqtbl.o -I"C:/MinGW32/include" -m32 -Wall -std=gnu99 -O2gcc.exe -c replay.c -o replay.o -I"C:/MinGW32/include" -m32 -Wall -std=gnu99 -O2replay.c: In function 'save_recorded_replay':replay.c:740:3: warning: implicit declaration of function 'strnlen' [-Wimplicit-function-declaration]
   putc(strnlen(levelset_name, UINT8_MAX), replay_fp); // length of the levelset name (is zero for original levels)
   ^gcc.exe -c options.c -o options.o -I"C:/MinGW32/include" -m32 -Wall -std=gnu99 -O2windres.exe -i port_release_private.rc -F pe-i386 --input-format=rc -o port_release_private.res -O coff gcc.exe main.o seg008.o seg007.o seg009.o seg000.o seg003.o seg006.o data.o seg001.o seg002.o seg004.o seg005.o seqtbl.o replay.o options.o port_release_private.res -o ../prince.exe -L"C:/MinGW32/lib" -static-libgcc -mwindows -l"mingw32" -l"SDL2main" -l"SDL2.dll" -l"SDL2_image" -l"SDL2_mixer" -m32 -sseg008.o:seg008.c:(.text+0x916): undefined reference to `SDL_ConvertSurface'
seg008.o:seg008.c:(.text+0x92e): undefined reference to `SDL_SetSurfacePalette'
seg008.o:seg008.c:(.text+0x949): undefined reference to `SDL_SetSurfaceBlendMode'
seg008.o:seg008.c:(.text+0x961): undefined reference to `SDL_SetColorKey'
seg008.o:seg008.c:(.text+0x97d): undefined reference to `SDL_SetColorKey'
seg008.o:seg008.c:(.text+0x98d): undefined reference to `SDL_SetSurfaceAlphaMod'
seg008.o:seg008.c:(.text+0xa07): undefined reference to `SDL_UpperBlit'
seg008.o:seg008.c:(.text+0x1d1f): undefined reference to `SDL_FreeSurface'
c:/mingw32/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: seg008.o: bad reloc address 0x0 in section `.data'
c:/mingw32/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: final link failed: Invalid operation
collect2.exe: error: ld returned 1 exit statusC:\Users\Nicolas Florio\Documents\SDLPoP-1.17\src\Makefile.win:26: recipe for target '../prince.exe' failedmingw32-make.exe: *** [../prince.exe] Error 1
Compilation results...
--------
- Errors: 1
- Warnings: 2
- Compilation Time: 12,96s


Any ideas?

David
The Prince of Persia
The Prince of Persia
Posts: 1327
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: How to compile SDLPoP

Postby David » March 11th, 2017, 11:11 am

Nick2017 wrote:I get this messages and then a window pops up that says "cc1.exe stopped working".

Code: Select all

C:/Program Files (x86)/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/ia32intrin.h:54:9: internal compiler error: in c_builtin_function_ext_scope, at c/c-decl.c:3633
 #pragma GCC target("sse4.2")
         ^
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.



This looks like a bug in the compiler.

Nick2017 wrote:I removed the MinGW64 directories from binaries, lib and header. I only left C:\MinGW32 and now its trying to compile but it fails...

Code: Select all

seg008.o:seg008.c:(.text+0x916): undefined reference to `SDL_ConvertSurface'
seg008.o:seg008.c:(.text+0x92e): undefined reference to `SDL_SetSurfacePalette'
seg008.o:seg008.c:(.text+0x949): undefined reference to `SDL_SetSurfaceBlendMode'
seg008.o:seg008.c:(.text+0x961): undefined reference to `SDL_SetColorKey'
seg008.o:seg008.c:(.text+0x97d): undefined reference to `SDL_SetColorKey'
seg008.o:seg008.c:(.text+0x98d): undefined reference to `SDL_SetSurfaceAlphaMod'
seg008.o:seg008.c:(.text+0xa07): undefined reference to `SDL_UpperBlit'
seg008.o:seg008.c:(.text+0x1d1f): undefined reference to `SDL_FreeSurface'


This case is somewhat easier.
The linker can't find the libSDL2.dll.a file.
Find where it is and add that folder to Library Directories.

Nick2017 wrote:

Code: Select all

replay.c:740:3: warning: implicit declaration of function 'strnlen' [-Wimplicit-function-declaration]


That's odd: replay.c includes common.h, and common.h includes string.h, which contains the declaration of strnlen.
At least on my system.

Nick2017 wrote:

Code: Select all

seg000.c:747:22: warning: 'answer_text' may be used uninitialized in this function [-Wmaybe-uninitialized]


Well, then your GCC is smarter than mine...
This should not really be a problem, but you can initialize answer_text to NULL to fix this.

Nick2017
Sheikh
Sheikh
Posts: 30
Joined: January 7th, 2017, 10:45 pm

Re: How to compile SDLPoP

Postby Nick2017 » March 11th, 2017, 4:48 pm

I have the file libSDL2.dll.a in C:\MinGW32\lib which is in the linker's library directory. But I can't find any of these functions:

SDL_ConvertSurface, SDL_SetSurfacePalette, SDL_SetSurfaceBlendMode.

Where are they located? because I can't find them anywhere.

David
The Prince of Persia
The Prince of Persia
Posts: 1327
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: How to compile SDLPoP

Postby David » March 12th, 2017, 6:59 pm

Nick2017 wrote:I have the file libSDL2.dll.a in C:\MinGW32\lib which is in the linker's library directory.

And the linker can't find it there? That's odd.
(I see the gcc command line contains both -L"C:/MinGW32/lib" and -l"SDL2.dll".)

Did you extract the 32-bit or the 64-bit version of SDL2? It should be the 32-bit.
Although, if it was the 64-bit, then there would be some more error messages about that.
(skipping incompatible C:/MinGW32/lib/###.a when searching for -l###)

Code: Select all

seg008.o: bad reloc address 0x0 in section `.data'

I found this: https://sourceware.org/bugzilla/show_bug.cgi?id=14688
This might be a bug in the linker? Maybe yours is different from mine?

What version of Dev-C++ do you have? (mine is: 5.11)
And what is the version of ld.exe? (Type ld --version to see that.) (mine is: GNU ld (GNU Binutils) 2.24.51.20140703)

Nick2017 wrote:But I can't find any of these functions:

SDL_ConvertSurface, SDL_SetSurfacePalette, SDL_SetSurfaceBlendMode.

Where are they located? because I can't find them anywhere.

What do you mean here?
* These functions are "defined" in libSDL2.dll.a. By "define" I mean they are defined as DLL imports from SDL2.dll.
* Their prototypes are in SDL_surface.h.
* And they are used in seg008.c, among others.

Nick2017
Sheikh
Sheikh
Posts: 30
Joined: January 7th, 2017, 10:45 pm

Re: How to compile SDLPoP

Postby Nick2017 » March 12th, 2017, 11:57 pm

My Dev-C++ is 5.11. I noticed that Dev-C++ it's trying to use the linker from this folder: C:\MinGW32\mingw32\bin\ld.exe and when I try to use the --version command it shows an error saying that the program cannot start because zlib1.dll is missing. But if I try to run "ld.exe --version" that is in this folder: C:\MinGW32\bin is says:

Code: Select all

GNU ld (GNU Binutils) 2.23.2
Copyright 2012 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later version.
This program has absolutely no warranty.


Maybe I should change it so that it uses linker from C:\MinGW32\bin but I can't find where you can change this.

David
The Prince of Persia
The Prince of Persia
Posts: 1327
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: How to compile SDLPoP

Postby David » March 15th, 2017, 5:51 pm

Nick2017 wrote:Maybe I should change it so that it uses linker from C:\MinGW32\bin but I can't find where you can change this.

You can do that at: Tools -> Compiler Options -> Programs.
These are handled separately for each compiler set you can select at the top of the window.

Why do you have two linkers? Or a MinGW32 folder?
I see you installed MinGW separately. Why? I didn't, I just use the compiler/linker that comes with Dev-C++.


Return to “SDLPoP”

Who is online

Users browsing this forum: No registered users and 1 guest