User avatar
cpcbegin
Posts: 211
Joined: Sun Mar 08, 2015 3:48 pm
Location: Costa del Sol, Spain
Contact: Website

[solved] Trying to compile a game used on other linux

Sun Mar 27, 2016 6:33 pm

I'm trying to compile Vorton game on raspberry (a funny remake of Highway Encounter)
The problem was on makefile.linux:

Code: Select all

TARGET	=	vorton


CC =		gcc
STRIP=		strip


CFLAGS =	-Wall -Wno-switch -march=pentium -mcpu=pentium -DDEBUG \
		-DDATA_PREFIX=\"data/\" -DFILE_SEPARATOR=\"/\" -DARGS \
		-Isrc -Isrc/SDL_flic -Isrc/SFont `sdl-config --cflags` \
		-ffast-math -fno-common -ffreestanding -fno-builtin \
		-fno-exceptions -fstrict-aliasing -O3 \
		-Isrc/filmat -Isrc/phase2 -Isrc/ML_Lib \


#CFLAGS+=-DUSE_FIXED_POINT


LDFLAGS =	`sdl-config --libs` -lSDL_mixer -lSDL_image \


.CFILES	=	src/vorton.c \
		src/video.c \
		src/intro.c \
		src/audio.c \
		src/menu.c \
		src/exit.c \
		src/language.c \
		src/records.c \
		src/error.c \
		src/rand.c \
		src/filmat/laser.c \
		src/filmat/process.c \
		src/filmat/hero.c \
		src/filmat/bloq.c \
		src/filmat/brick.c \
		src/filmat/fire.c \
		src/filmat/robot.c \
		src/filmat/movable.c \
		src/filmat/parse.c \
		src/filmat/pyramid.c \
		src/filmat/dummy.c \
		src/filmat/filmat.c \
		src/filmat/video.c \
		src/phase2/video.c \
		src/phase2/process.c \
		src/phase2/mode7.c \
		src/phase2/stretch.c \
		src/SDL_flic/SDL_flic.c \
		src/SDL_flic/SDL_playflic.c \
		src/SDL_flic/node_text.c \
		src/SDL_flic/font-arial-12.c \
		src/SFont/SFont.c \
		src/ML_Lib/ML_Attribute.c \
		src/ML_Lib/ML_Comment.c \
		src/ML_Lib/ML_common_func.c \
		src/ML_Lib/ML_COM_Sim.c \
		src/ML_Lib/ML_Document.c \
		src/ML_Lib/ML_Element.c \
		src/ML_Lib/ML_leng_process.c \
		src/ML_Lib/ML_Node.c \
		src/ML_Lib/ML_Process.c \
		src/ML_Lib/ML_Text.c \


all: $(TARGET)


OBJS =		$(.CFILES:.c=.o)


$(TARGET):	$(OBJS)
	$(CC) $(CFLAGS) -o [email protected] $(OBJS) $(LDFLAGS)
	$(STRIP) $(TARGET)


run:		$(TARGET)

#	./$(TARGET) -nosound
#	./$(TARGET) -nosound -8bits
	./$(TARGET) -windowscreen -nosound -8bits
#	./$(TARGET) -windowscreen -8bits

clean:
	rm -f $(OBJS) $(TARGET)
And it doesnt' work because flag section is defined for pentium and we haven't SFont.h:

I change some thing in CFLAGS definition:

Code: Select all

CFLAGS =        -Wall -Wno-switch -march=armv7ve -mcpu=cortex-a7 -DDEBUG \
                -DDATA_PREFIX=\"data/\" -DFILE_SEPARATOR=\"/\" -DARGS \
                -Isrc -Isrc/SDL_flic  `sdl-config --cflags` \
                -ffast-math -fno-common -ffreestanding -fno-builtin \
                -fno-exceptions -fstrict-aliasing -O3 \
                -Isrc/filmat -Isrc/phase2 -Isrc/ML_Lib \
                -DFREETYPE_INCLUDE_DIRS=/usr/include/freetype2/ \
But stills show this error:

Code: Select all

In file included from src/error.c:1:0:
src/vorton.h:42:19: fatal error: SFont.h: No existe el fichero o el directorio
 #include "SFont.h"
I change SFont.h with freetype.h but show new errors:

Code: Select all

In file included from src/vorton.h:43:0,
                 from src/error.c:1:
/usr/include/freetype2/freetype.h:24:2: error: #error "`ft2build.h' hasn't been included yet!"
 #error "`ft2build.h' hasn't been included yet!"
  ^
/usr/include/freetype2/freetype.h:25:2: error: #error "Please always use macros to include FreeType header files."
 #error "Please always use macros to include FreeType header files."
  ^
/usr/include/freetype2/freetype.h:26:2: error: #error "Example:"
 #error "Example:"
  ^
/usr/include/freetype2/freetype.h:27:2: error: #error "  #include <ft2build.h>"
 #error "  #include <ft2build.h>"
  ^
/usr/include/freetype2/freetype.h:28:2: error: #error "  #include FT_FREETYPE_H"
 #error "  #include FT_FREETYPE_H"
  ^
/usr/include/freetype2/freetype.h:32:22: fatal error: ft2build.h: No existe el fichero o el directorio
 #include <ft2build.h>
                      ^
compilation terminated.
<builtin>: recipe for target 'src/error.o' failed
make: *** [src/error.o] Error 1
Last edited by cpcbegin on Fri Apr 01, 2016 9:07 am, edited 1 time in total.
Trucos y recetas para raspberry pi:
http://malagaoriginal.blogspot.com.es/search/label/raspberry%20pi

swampdog
Posts: 221
Joined: Fri Dec 04, 2015 11:22 am

Re: Trying to compile a game used on other linux

Wed Mar 30, 2016 11:05 pm

$ unzip vorton-src-beta2.zip

00.patch

Code: Select all

--- vorton/Makefile.linux.ORIGINAL	2016-03-30 22:45:18.075043520 +0000
+++ vorton/Makefile.linux	2016-03-30 22:49:14.582265492 +0000
@@ -5,7 +5,7 @@
 STRIP=		strip
 
 
-CFLAGS =	-Wall -Wno-switch -march=pentium -mcpu=pentium -DDEBUG \
+CFLAGS =	-Wall -Wno-switch -DDEBUG \
 		-DDATA_PREFIX=\"data/\" -DFILE_SEPARATOR=\"/\" -DARGS \
 		-Isrc -Isrc/SDL_flic -Isrc/SFont `sdl-config --cflags` \
 		-ffast-math -fno-common -ffreestanding -fno-builtin \
@@ -16,7 +16,7 @@
 #CFLAGS+=-DUSE_FIXED_POINT
 
 
-LDFLAGS =	`sdl-config --libs` -lSDL_mixer -lSDL_image \
+LDFLAGS =	`sdl-config --libs` -lSDL_mixer -lSDL_image -lm
 
 
 .CFILES	=	src/vorton.c \
01.patch

Code: Select all

--- vorton/src/error.c.ORIGINAL	2016-03-30 22:47:56.383183865 +0000
+++ vorton/src/error.c	2016-03-30 22:46:17.984339686 +0000
@@ -4,7 +4,9 @@
 
 static SDL_Surface *font_surface;
 
+#if 0
 static SFont_FontInfo font;
+#endif
 
 #define putstring(X,Y,Str) (SFont_PutStringInfo(screen,&font,X,Y,Str))
$ patch -p0 < 00.patch
$ patch -p0 < 01.patch
$ sudo apt-get install libsdl1.2-dev libsdl-mixer1.2-dev
$ cd vorton
$ make -f Makefile.linux
$ ./vorton

User avatar
cpcbegin
Posts: 211
Joined: Sun Mar 08, 2015 3:48 pm
Location: Costa del Sol, Spain
Contact: Website

Re: Trying to compile a game used on other linux

Thu Mar 31, 2016 9:48 pm

Thanks a lot, I compile the game sucessfully with your instructions, only I need install an adictional library

Code: Select all

sudo apt-get install libsdl-image1.2-dev
Image Image

If someone wants the compiled game, here you are:
- Rasberry pi 2
- PC with 64 bit Linux
- PC with 32 bit Linux
Trucos y recetas para raspberry pi:
http://malagaoriginal.blogspot.com.es/search/label/raspberry%20pi

Return to “C/C++”