can't build hello_pi examples in Raspbian


18 posts
by robotfunk » Tue Jun 19, 2012 3:13 pm
Since moving to raspbian, a simple 'make' doesn't work anymore for compiling the hello_pi examples in opt/vc/src

Code: Select all
root@raspbian:/opt/vc/src/hello_pi/hello_video# make
cc -DSTANDALONE -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -DTARGET_POSIX -D_LINUX -fPIC -DPIC -D_REENTRANT -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -U_FORTIFY_SOURCE -Wall -g -DHAVE_LIBOPENMAX=2 -DOMX -DOMX_SKIP64BIT -ftree-vectorize -pipe -DUSE_EXTERNAL_OMX -DHAVE_LIBBCM_HOST -DUSE_EXTERNAL_LIBBCM_HOST -DUSE_VCHIQ_ARM -Wno-psabi -I/opt/vc/include/ -I/opt/vc/include/interface/vcos/pthreads -I./ -I../libs/ilclient -I../libs/vgfont -g -c video.c -o video.o -Wno-deprecated-declarations
cc -o hello_video.bin -Wl,--whole-archive video.o -L/opt/vc/lib/ -lGLESv2 -lEGL -lopenmaxil -lbcm_host -lvcos -lvchiq_arm ../libs/ilclient/libilclient.a -Wl,--no-whole-archive -rdynamic
/usr/bin/ld: error: ../libs/ilclient/libilclient.a(ilclient.o) uses VFP register arguments, output does not
/usr/bin/ld: error: ../libs/ilclient/libilclient.a(ilcore.o) uses VFP register arguments, output does not
/opt/bcm-rootfs/opt/vc/include/interface/vcos/pthreads/vcos_platform.h:242: error: undefined reference to 'sem_wait'
/opt/bcm-rootfs/opt/vc/include/interface/vcos/pthreads/vcos_platform.h:302: error: undefined reference to 'sem_init'
/opt/bcm-rootfs/opt/vc/include/interface/vcos/pthreads/vcos_platform.h:310: error: undefined reference to 'sem_destroy'
/opt/bcm-rootfs/opt/vc/include/interface/vcos/pthreads/vcos_platform.h:317: error: undefined reference to 'sem_post'
collect2: ld returned 1 exit status
make: *** [hello_video.bin] Error 1


are there any parameters to add or changes to the Makefile to make it work?
Posts: 45
Joined: Wed May 30, 2012 7:28 pm
by dom » Tue Jun 19, 2012 3:55 pm
@robotfunk
You will have to make clean and make in libs/ilclient (and libs/vgfont) on raspbian.
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 4060
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge
by robotfunk » Tue Jun 19, 2012 5:28 pm
@dom:

thanks, I did remake both but I'm presented with the next error

Code: Select all
root@raspbian:/opt/vc/src/hello_pi/hello_video# make
cc -DSTANDALONE -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -DTARGET_POSIX -D_LINUX -fPIC -DPIC -D_REENTRANT -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -U_FORTIFY_SOURCE -Wall -g -DHAVE_LIBOPENMAX=2 -DOMX -DOMX_SKIP64BIT -ftree-vectorize -pipe -DUSE_EXTERNAL_OMX -DHAVE_LIBBCM_HOST -DUSE_EXTERNAL_LIBBCM_HOST -DUSE_VCHIQ_ARM -Wno-psabi -I/opt/vc/include/ -I/opt/vc/include/interface/vcos/pthreads -I./ -I../libs/ilclient -I../libs/vgfont -g -c video.c -o video.o -Wno-deprecated-declarations
cc -o hello_video.bin -Wl,--whole-archive video.o -L/opt/vc/lib/ -lGLESv2 -lEGL -lopenmaxil -lbcm_host -lvcos -lvchiq_arm ../libs/ilclient/libilclient.a -Wl,--no-whole-archive -rdynamic
/opt/vc/include/interface/vcos/pthreads/vcos_platform.h:242: error: undefined reference to 'sem_wait'
/opt/vc/include/interface/vcos/pthreads/vcos_platform.h:302: error: undefined reference to 'sem_init'
/opt/vc/include/interface/vcos/pthreads/vcos_platform.h:310: error: undefined reference to 'sem_destroy'
/opt/vc/include/interface/vcos/pthreads/vcos_platform.h:317: error: undefined reference to 'sem_post'
collect2: ld returned 1 exit status
make: *** [hello_video.bin] Error 1
rm video.o
Posts: 45
Joined: Wed May 30, 2012 7:28 pm
by plugwash » Tue Jun 19, 2012 5:37 pm
looks like you need to add -lpthread to the list of libraries to link with
Forum Moderator
Forum Moderator
Posts: 2392
Joined: Wed Dec 28, 2011 11:45 pm
by robotfunk » Tue Jun 19, 2012 5:50 pm
Thanks plugwash, where do I do that? In vc/src/Makefile.include perhaps?

I'm a lazy C++ programmer growing up with IDE and no experience of make files as you can see :oops:
Posts: 45
Joined: Wed May 30, 2012 7:28 pm
by plugwash » Tue Jun 19, 2012 6:05 pm
probablly somewhere like that. I haven't really played with the videocore related stuff myself, been spending too much time trying to keep the main repo in shape.
Forum Moderator
Forum Moderator
Posts: 2392
Joined: Wed Dec 28, 2011 11:45 pm
by jui-feng » Tue Jun 19, 2012 8:16 pm
That's interesting: using an up-to-date (packages & kernel/modules/firmware) pisces image, the build works for me after rebuilding libilclient.
Posts: 57
Joined: Sun Mar 04, 2012 11:02 am
by gregeric » Tue Jun 26, 2012 6:43 pm
I managed to build all the examples, but running them not so good.

First off, couldn't find libGLESv2.so, so:
LD_LIBRARY_PATH=/opt/vc/lib ./hello_world.bin

Hooray!

Next up I changed the memory split to 192/64 & tried hello_triangle. The desktop gets wiped, animation starts but soon freezes & locks the system. How can I provide useful debug info?
Posts: 147
Joined: Mon Nov 28, 2011 10:08 am
by dom » Tue Jun 26, 2012 10:26 pm
gregeric wrote:Next up I changed the memory split to 192/64 & tried hello_triangle. The desktop gets wiped, animation starts but soon freezes & locks the system. How can I provide useful debug info?


Sounds like a power supply issue. Turning on the 3D hardware does require more power.
Are you able to run xbmc?
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 4060
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge
by gregeric » Tue Jun 26, 2012 10:56 pm
XBMC is fine with my setup - I've never experienced such issues before. Will investigate other power sources all the same...
Posts: 147
Joined: Mon Nov 28, 2011 10:08 am
by dom » Tue Jun 26, 2012 11:02 pm
gregeric wrote:XBMC is fine with my setup - I've never experienced such issues before. Will investigate other power sources all the same...

Are you overclocking?
Does hello_triangle2 run?
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 4060
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge
by gregeric » Tue Jun 26, 2012 11:23 pm
Yes, I was on arm_freq=850 with no other tweaks. Dropped it to 700 & hello_triangle now runs without freezing.

I tried hello_triangle2 - I get a still mandlebrot image. No freeze, can exit with ctrl-c, but wonder should I be seeing some animation?

Tks Dom
Posts: 147
Joined: Mon Nov 28, 2011 10:08 am
by gregeric » Wed Jun 27, 2012 7:07 am
Looked at the source for triangle2 this morning & learnt that mouse wiggling has the GPU render new mandlebrot & julia sets. Cool. Onto the next.
Posts: 147
Joined: Mon Nov 28, 2011 10:08 am
by HUD Engineer » Wed Nov 21, 2012 10:06 am
I can't build hello_pi examples on recent builds, and despite trawling the web, I don't have any idea whether I am alone in having this problem, or what the solution might be. I use Win32 Disk Imager to create the image.

Some time ago, it worked for me, using Wheezy 2012-07-15, which required to "make -C libs/ilclient"
and "make -C libs/vgfont". It worked on download 2012-08-16 also.

It doesn't work for me on download 2012-09-18-wheezy-raspbian.img (3.2.27+ #160 PREEMPT)
It doesn't work for me on download 2012-10-28-wheezy-raspbian.img, (with or without sudo apt-get update/upgrade)

In each case, the "make -C libs/vgfont" results in the response "vgft.h:35:22: fatal error: ft2build.h: No such file or directory".
Posts: 7
Joined: Wed Jul 18, 2012 10:25 pm
by PeterO » Wed Nov 21, 2012 10:27 am
gregeric wrote:Looked at the source for triangle2 this morning & learnt that mouse wiggling has the GPU render new mandlebrot & julia sets. Cool. Onto the next.

I think you will find the mandlebrot is only rendered once into a buffer that is just repositioned on the screen by mouse movements. I've spent some time looking at the triangle2 code myself.

It's an interesting example of doing clever stuff in openGLES shaders, but isn't a very good example of doing more conventional 3D stuff.

PeterO
User avatar
Posts: 1039
Joined: Sun Jul 22, 2012 4:14 pm
by dom » Wed Nov 21, 2012 3:18 pm
HUD Engineer wrote:I can't build hello_pi examples on recent builds, and despite trawling the web, I don't have any idea whether I am alone in having this problem, or what the solution might be. I use Win32 Disk Imager to create the image.

Some time ago, it worked for me, using Wheezy 2012-07-15, which required to "make -C libs/ilclient"
and "make -C libs/vgfont". It worked on download 2012-08-16 also.

It doesn't work for me on download 2012-09-18-wheezy-raspbian.img (3.2.27+ #160 PREEMPT)
It doesn't work for me on download 2012-10-28-wheezy-raspbian.img, (with or without sudo apt-get update/upgrade)

In each case, the "make -C libs/vgfont" results in the response "vgft.h:35:22: fatal error: ft2build.h: No such file or directory".


Can you try:
Code: Select all
sudo apt-get install libfreetype6-dev

(this should be preinstalled, I'll chceck with asb)
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 4060
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge
by HUD Engineer » Thu Nov 22, 2012 6:16 pm
Hi Dom,

Thanks for that instruction. It installed a new package. It does then allow the Pi to execute "make -C libs/vgfont", and I have tested a few examples with success. Therefore, it appears that it is not preinstalled on the recent images, but I think it must have been on earlier ones.

A Google search of using keywords: < debian repository list ft2build.h > resulted in
http://packages.debian.org/search?suite ... ft2build.h
which showed me that file /usr/include/ft2build.h was to be found in libfreetype6-dev, while looking at the file list for libfreetype6 (not -dev) at http://packages.debian.org/wheezy/armhf ... bfreetype6
shows it does not include the file. I could very easily be looking in the wrong place. I did try looking at the http://www.raspbian.org repository, but have not found how to navigate it usefully. I suspect I'm close with http://archive.raspbian.org/raspbian/dists/wheezy/...

But how to check which one is part of each Wheezy image, etc... I expect there are some good tutorials that I could follow, to steer me through that.

Thanks,

Andy
Posts: 7
Joined: Wed Jul 18, 2012 10:25 pm
by SteveHickson » Tue Mar 19, 2013 5:56 pm
Their is a script in the folder above called rebuild.sh (Probably with sudo)

You should just run that. It will build the required libs for you.

Don't move things around or worry about all of this other stuff.
Posts: 21
Joined: Tue Mar 19, 2013 5:53 pm
Location: me@stevenhickson.com