headers/libs for cross-compiling graphics programs


5 posts
by DrRob » Mon Jun 25, 2012 12:01 pm
Hi,

I see that a cross-compilation toolchain is available for the Raspberry Pi on github in https://github.com/raspberrypi/tools, and that this includes headers and libraries for the standard stuff like the C library, maths library, pthreads, etc...

Where can I find the headers and libraries to add to that for graphics libraries (OpenGLES, OpenVG, etc.)?

Thanks,
Rob.
Posts: 5
Joined: Mon Jun 25, 2012 11:57 am
by jmacey » Mon Jun 25, 2012 12:05 pm
they are all in /opt/vc

What I do is make a copy of this on my target machine and cross compile using a simple makefile like this one (see the hard coded paths etc just alter for your own system) For easy I also copy other libs I use (such as image magic to the same directory on the host machine as well)

Code: Select all
CC=arm-none-linux-gnueabi-g++
CFLAGS=-c -Wall -O3 -I/Volumes/home/jmacey/boost_1_49_0/ -I/opt/vc/include/interface/vcos/pthreads  -I/Volumes/home/jmacey/teaching/pi/opt/vc/includ
e -I/Volumes/home/jmacey/teaching/pi/opt/vc/include/ImageMagick -Iinclude/ngl -Isrc/ngl -Isrc/shaders -DNGL_DEBUG -DLARGEMODELS
LDFLAGS=-shared -L/Volumes/home/jmacey/teaching/pi/opt/vc/lib -lMagickCore -lMagick++
SOURCES=$(shell find ./ -name *.cpp)
OBJECTS=$(SOURCES:%.cpp=%.o)
EXECUTABLE=lib/libNGL.so

all: $(SOURCES) $(EXECUTABLE)

$(EXECUTABLE): $(OBJECTS)
   $(CC) $(LDFLAGS) $(OBJECTS) -o $@

.cpp.o:
   $(CC) $(CFLAGS) $< -o $@
Posts: 135
Joined: Thu May 31, 2012 1:05 pm
by DrRob » Mon Jun 25, 2012 12:32 pm
Hi,

Thanks jmacey. I guess you mean /opt/vc in the target filesystem? Will this contain the same files no matter which OS distribution I choose?

Thanks,
Rob.
Posts: 5
Joined: Mon Jun 25, 2012 11:57 am
by jmacey » Mon Jun 25, 2012 1:03 pm
yes from the target system. IIRC the /opt/vc is part if the main firmware / kernel so all "official" distros should have it (I think vc stands for Video Core) You can also download it from here https://github.com/raspberrypi/firmware/
Posts: 135
Joined: Thu May 31, 2012 1:05 pm
by DrRob » Tue Jun 26, 2012 8:53 am
Ah, I see now - thanks.

Rob.
Posts: 5
Joined: Mon Jun 25, 2012 11:57 am