PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Linux example Makefile?

CHRISGNICHOLAS · 16 Jul 2008, 17:57 UTC
Hi - I am wondering if there are any examples of how to build under Linux, and which additional libraries to link with...

I am just trying to build the 'FileDemo' with the following line:

g++ -I../../../include/ -o filedemo filedemo.cpp -L/usr/X11R6/lib -L../../../lib/linux-x86 -ledge -ledgerender -lGL

and am getting lots of undefined references in libedge.a to things like "inflate", "deflate", "__stack_chk_fail", etc.

thanks!
Chris
Hi Chris,

You're only missing the zlib library, that's why you get the deflate/inflate linker errors. Change your command to this:

Code:

g++ -I../../../include/ -o filedemo filedemo.cpp -L/usr/X11R6/lib -L../../../lib/linux-x86 -ledge -ledgerender -lGL -lz
CHRISGNICHOLAS · 17 Jul 2008, 09:56 UTC
much better; linking in libz makes all the inflate/deflate msgs go away, but still getting unresolved references to: "__stack_chk_fail" from deep in the 2D surface routines: esurf_2drgba

hmmm....

Chris
-------------------------------------------

g++ -I../../../include/ filedemo.cpp -L/usr/X11R6/lib -L../../../lib/linux-x86 -ledge -ledgerender -lGL -lz
../../../lib/linux-x86/libedge.a(esurf_2d.o)(.text+0x104c7): In function `E2DSurface::LoadImage(unsigned short*, unsigned char, unsigned long)':
esurf_2d.cpp: undefined reference to `__stack_chk_fail'
../../../lib/linux-x86/libedge.a(esurf_2d.o)(.text+0x156c5): In function `E2DSurface::WritePNG(unsigned short*, tagRECT*)':
esurf_2d.cpp: undefined reference to `__stack_chk_fail'
../../../lib/linux-x86/libedge.a(esurf_2d.o)(.text+0x15a4e): In function `E2DSurface::WriteBMP(unsigned short*, tagRECT*)':
esurf_2d.cpp: undefined reference to `__stack_chk_fail'
../../../lib/linux-x86/libedge.a(esurf_2d.o)(.text+0x16db1): In function `E2DSurface::DrawFont(long, long, E2DSurfaceRGBA*, long, long, unsigned long)':
esurf_2d.cpp: undefined reference to `__stack_chk_fail'
../../../lib/linux-x86/libedge.a(esurf_2d.o)(.text+0x18881): In function `E2DSurface::DrawFont(long, long, E2DSurface*, long, long, unsigned long)':
esurf_2d.cpp: undefined reference to `__stack_chk_fail'
../../../lib/linux-x86/libedge.a(esurf_2drgba.o)(.text+0x9a6):esurf_2drgba.cpp: more undefined references to `__stack_chk_fail' follow
collect2: ld returned 1 exit status
make: *** [test] Error 1
CHRISGNICHOLAS · 17 Jul 2008, 10:28 UTC
hmmm - now, this does indeed link on a new Ubuntu install; the previous issues are a slightly older Fedora Core install...hmmm.

it would be good, regardless, to know where that symbol reference is coming from...

Chris
Hi Chris,

The __stack_chk_fail function is not directly defined in EDGELIB, it could have been added by the compiler to check for stack overflow errors.