"hello" example problems


18 posts
by Method » Sun Jun 24, 2012 2:31 pm
I'm having trouble compiling the examples that came with the system. For example, hello font, when I compile it using geany, it returns:
Code: Select all
main.c29:22 fatal error: bcm_host.h: No much file or directory

It's having a paddy over the
Code: Select all
#include "bcm_host.h"


Any help at all?
User avatar
Posts: 30
Joined: Tue Nov 08, 2011 4:58 pm
by RichardUK » Sun Jun 24, 2012 3:18 pm
Which distro you using?
Are you building on the RPi?
User avatar
Posts: 131
Joined: Fri Jun 01, 2012 5:12 pm
by dom » Sun Jun 24, 2012 3:36 pm
You need to compile it using the makefile.
E.g type in make in the directory.
I'd imagine it is possible to configure Geany to execute the make command, but I've never tried.
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 4042
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge
by gregeric » Sun Jun 24, 2012 3:40 pm
I've found that if I load the makefile into geany then I can invoke make, or make custom, from the geany menus.
Posts: 127
Joined: Mon Nov 28, 2011 10:08 am
by RichardUK » Sun Jun 24, 2012 3:47 pm
I've just tried it and there is an error in the make file. The path to the libfreetype.so is wrong, remove "arm-linux-gnueabi" from the path. After that it built and ran ok from the terminal.
User avatar
Posts: 131
Joined: Fri Jun 01, 2012 5:12 pm
by Method » Sun Jun 24, 2012 3:51 pm
RichardUK wrote:I've just tried it and there is an error in the make file. The path to the libfreetype.so is wrong, remove "arm-linux-gnueabi" from the path. After that it built and ran ok from the terminal.

I don't quite understand, how do I build and then run it from the terminal?
User avatar
Posts: 30
Joined: Tue Nov 08, 2011 4:58 pm
by RichardUK » Sun Jun 24, 2012 4:18 pm
When the system had booted and you have logged on you need to cd to the folder.

Code: Select all
cd /opt/vc/src/hello_pi/hello_font


Then you need to edit the make file.

Code: Select all
sudo nano ./Makefile


delete the line "arm-linux-gnueabi" Should look like the following

Code: Select all
OBJS=main.o
BIN=hello_font.bin

LDFLAGS+=../libs/vgfont/libvgfont.a -L$(SDKSTAGE)/usr/lib $(SDKSTAGE)/usr/lib/libfreetype.so -lz

include ../Makefile.include


Then just type make

After that run it with ./hello_font.bin

:)

Hopefully I have explained that ok.
User avatar
Posts: 131
Joined: Fri Jun 01, 2012 5:12 pm
by Method » Sun Jun 24, 2012 4:31 pm
Make didn't work.
Code: Select all
cc: error: /usr/lib/libfreetype.so: No such file or directory
make: *** [hello_font.bin] Error 1
rm main.o
User avatar
Posts: 30
Joined: Tue Nov 08, 2011 4:58 pm
by dom » Sun Jun 24, 2012 4:41 pm
Possibly:
sudo apt-get install libfreetype-dev
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 4042
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge
by Method » Sun Jun 24, 2012 4:48 pm
Doesn't like that, I'm afraid.
Code: Select all
E: Invalid operation libfreetype-dev
User avatar
Posts: 30
Joined: Tue Nov 08, 2011 4:58 pm
by dom » Sun Jun 24, 2012 4:55 pm
Actually I think it is:
sudo apt-get install libfreetype6-dev

although your error message didn't look right. Are you sure you typed it correctly?
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 4042
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge
by RichardUK » Sun Jun 24, 2012 5:29 pm
I had that error, sorry, forgot to say I had installed libfreetype6-dev. Doh! I knew I had forgotten something, too busy writing my texture code. :)
User avatar
Posts: 131
Joined: Fri Jun 01, 2012 5:12 pm
by Method » Mon Jun 25, 2012 10:47 am
Most odd. When I tried to install libfreetype6 nothing updated or changed.
Code: Select all
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded

I tried making again and it came up with the same error, no such file or directory. I checked in that directory and libfreetype.so doesn't exist in /usr/lib/
Heh, what now.
User avatar
Posts: 30
Joined: Tue Nov 08, 2011 4:58 pm
by dom » Mon Jun 25, 2012 11:06 am
Are you on Squeeze or Wheezy ? On Wheezy the file is here:
/usr/lib/arm-linux-gnueabi/libfreetype.so
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 4042
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge
by jmacey » Mon Jun 25, 2012 12:20 pm
if you are in the /opt/vc/src/hello_pi directory it is owned by root, so you either need to do a sudo make or preferably copy the directory to you home and edit the make files to the correct place.
Posts: 135
Joined: Thu May 31, 2012 1:05 pm
by RichardUK » Mon Jun 25, 2012 8:17 pm
Which distro you using?
User avatar
Posts: 131
Joined: Fri Jun 01, 2012 5:12 pm
by Method » Wed Jun 27, 2012 3:27 pm
RichardUK wrote:Which distro you using?

Squeeze, and I changed the directory as per:

dom wrote:Are you on Squeeze or Wheezy ? On Wheezy the file is here:
/usr/lib/arm-linux-gnueabi/libfreetype.so


In the make file; so that's nice, and that worked. It still has a problem over the line:
Code: Select all
#include "bcm_host.h"

I feel like a proper twerp for going on, and I bet it's just me that's managed to do something silly.
User avatar
Posts: 30
Joined: Tue Nov 08, 2011 4:58 pm
by RichardUK » Sat Jun 30, 2012 5:52 pm
Sorry didn't get back to you sooner, been working away with some very expensive robots.

So, lets recap. You have created a bootable Debian Squeeze sd card. Booted it and changed directory to this example project. Typed make and you get this error?


I'll do the same and see if I can recreate the issue, my Squeeze has got the driver update and a few other installs so may not be a good system for me to try to help you with.
User avatar
Posts: 131
Joined: Fri Jun 01, 2012 5:12 pm