Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wrong header location for pthreads-headers (while building quake3) #34

Closed
MarshallBanana0815 opened this Issue Jun 7, 2012 · 16 comments

Comments

Projects
None yet
@MarshallBanana0815
Copy link

MarshallBanana0815 commented Jun 7, 2012

while compiling quake3 on the raspbian distrib i encountered build errors due to a missing vcos_platform_types.h / vcos_platform.h

first fix was in opt/vc/include/interface/vcos/vcos_types.h:

  • - #include "vcos_platform_types.h"
  • + #include "pthreads/vcos_platform_types.h"

second fix would be in all the opt/vc/include/interface/vcos/vcos*.h:

  • - #include "vcos_platform.h"
  • + #include "pthreads/vcos_platform.h"

but being the lazy fool that i am i just copied the files from the pthreads subfolder there, after noticing that grep gave me to many files to fix that in :-P

i guess this would be just a very dirty fix because noone else reported it yet, and so might even be fixed by some makefile magic or the like in the quake3 repository? i can't imagine this problem to be a global one, probably also just tied to quake3+raspbian?
(i use the raspbian-r3.img from hexxeh)

anyways, with the above mentioned actions quake3 builds again...

@popcornmix

This comment has been minimized.

Copy link
Contributor

popcornmix commented Jun 17, 2012

Quake include path in build file has been updated.

@SamuelDebruyn

This comment has been minimized.

Copy link

SamuelDebruyn commented Jul 29, 2012

I got similar issues while compiling Hexxeh's despotify for RPi. vcos_platform_types.h: file not found

@hexameron

This comment has been minimized.

Copy link

hexameron commented Aug 23, 2012

This is an issue with the paths in the firmware includes, not in Quake3. Please fix it.

Since "pthreads/vcos_platform.h" demands to be included from vcos.h, you should have the correct path IN vcos.h

QUOTE: "Do not include this file directly - instead include it via vcos.h"

@popcornmix

This comment has been minimized.

Copy link
Contributor

popcornmix commented Aug 23, 2012

QUOTE: "Do not include this file directly - instead include it via vcos.h"
Yes, as you should, but with pthreads on your include path.

@agherzan

This comment has been minimized.

Copy link

agherzan commented Aug 26, 2012

Why isn't vcos/vcos_types.h changed with the correct path to vcos_platform_types.h. Obviously there is always the option of adding additional include paths but why not fix it in vcos_types.h?

ah

@popcornmix

This comment has been minimized.

Copy link
Contributor

popcornmix commented Aug 26, 2012

Because this software comes from a common tree that supports other OS targets that are not pthreads.
These headers are used by the GPU with an include path that uses a different OS.
Hard coding the paths woud make future updates more difficult.

@agherzan

This comment has been minimized.

Copy link

agherzan commented Aug 26, 2012

Thank you. I understand.

@jethrogb

This comment has been minimized.

Copy link

jethrogb commented Oct 2, 2012

You are advocating the use of a non-standard include path. This is very bad practice. Instead, the number of include paths should be minimized and the paths should be hardcoded. If you want to use different headers on different platforms, #ifdefs should be used to point to the right file.

@hugopl

This comment has been minimized.

Copy link

hugopl commented Mar 20, 2013

The SDK is broken and the bug still valid IMO. No matter where the sources comes from, it's broken as you can't just include egl.h without adding a "magic directory" in your include path.

@mattekenpis

This comment has been minimized.

Copy link

mattekenpis commented Jun 11, 2013

You can use a "sed" to find and replace:

sudo sed -i 's/vcos_platform.h/pthreads\/vcos_platform_types.h/g' *.h
http://www.cyberciti.biz/faq/unix-linux-replace-string-words-in-many-files/

Maybe you will need to do it recursively like this: http://stackoverflow.com/questions/1583219/awk-sed-how-to-do-a-recursive-find-replace-of-a-string

@paul-betafive

This comment has been minimized.

Copy link

paul-betafive commented Jun 19, 2013

I have the following packages in OpenEmbedded failing to build due to this issue:

mesa-demos 0.8.1
weston 1.1.0
gstreamer1.0-plugins-bad 1.0.7

They just include "EGL/egl.h" which is found ok so they have the correct include paths for this header. Therefore the header should work. It shouldn't rely on an extra include path being added just for raspberrypi in software which is written to support many platforms.

The argument

Because this software comes from a common tree that supports other OS targets that are not pthreads.
These headers are used by the GPU with an include path that uses a different OS.
Hard coding the paths woud make future updates more difficult.

Can be applied to the software which includes "EGL/egl.h" as well.

Is there any way we can find a fix that works for everyone? Perhaps symlinking to the headers in the pthreads directory from the parent directory? Or adding some ifdefs into the vcos headers?

Thanks,

Paul Barker

@paul-betafive

This comment has been minimized.

Copy link

paul-betafive commented Jun 19, 2013

Or maybe solve this with a "platform" symlink that is set at build time depending on the host you're building for, so on ARM it is linked to "pthreads" and on the GPU it is linked to a different directory. Thus it's all handled during the build of the firmware and applications which reference "EGL/egl.h" don't have to worry about it.

ajlennon added a commit to DynamicDevices/meta-raspberrypi that referenced this issue Jun 8, 2014

gstreamer1.0-plugins-bad: Build eglglessink for Raspberry Pi
The eglglessink needs to be built to target the Raspberry Pi or it will seg-fault in use.

Autoconf attempts to detect whether to build for RPi but there are some include files needed, the search path to which must be specified.

ref: raspberrypi/firmware#34

ref: raspberrypi/firmware#99

This patch adds the needed include paths and forces the plugin to be built for Raspberry Pi.

Change-Id: Iffa79dfa9d9e852848ab1ab70a58c124567b7298
Signed-off-by: Alex J Lennon <ajlennon@dynamicdevices.co.uk>

agherzan pushed a commit to djwillis/meta-raspberrypi that referenced this issue Jun 12, 2014

gstreamer1.0-plugins-bad: Build eglglessink for Raspberry Pi
The eglglessink needs to be built to target the Raspberry Pi or it will
seg-fault in use.

Autoconf attempts to detect whether to build for RPi but there are some
include files needed, the search path to which must be specified.

ref: raspberrypi/firmware#34

ref: raspberrypi/firmware#99

This patch adds the needed include paths and forces the plugin to be
built for Raspberry Pi.

With this patch the following pipeline works on RPi,

  modprobe bcm2835-v4l2 gst_v4l2src_is_broken=1
  gst-launch-1.0 --gst-debug-no-color v4l2src \
  ! 'video/x-raw,format=RGB,width=1280,height=720,framerate=(fraction)30/1' \
  ! eglglessink max-lateness=-1

Change-Id: Iabd93c0601c2ab898de3352a7d30423ef9cfce43
Signed-off-by: Alex J Lennon <ajlennon@dynamicdevices.co.uk>

agherzan added a commit to djwillis/meta-raspberrypi that referenced this issue Aug 14, 2014

gstreamer1.0-plugins-bad: Build eglglessink for Raspberry Pi
The eglglessink needs to be built to target the Raspberry Pi or it will
seg-fault in use.

Autoconf attempts to detect whether to build for RPi but there are some
include files needed, the search path to which must be specified.

ref: raspberrypi/firmware#34

ref: raspberrypi/firmware#99

This patch adds the needed include paths and forces the plugin to be
built for Raspberry Pi.

With this patch the following pipeline works on RPi,

  modprobe bcm2835-v4l2 gst_v4l2src_is_broken=1
  gst-launch-1.0 --gst-debug-no-color v4l2src \
  ! 'video/x-raw,format=RGB,width=1280,height=720,framerate=(fraction)30/1' \
  ! eglglessink max-lateness=-1

Change-Id: Iabd93c0601c2ab898de3352a7d30423ef9cfce43
Signed-off-by: Alex J Lennon <ajlennon@dynamicdevices.co.uk>
@fscz

This comment has been minimized.

Copy link

fscz commented Mar 13, 2015

why is this closed? it's still an issue

@juj

This comment has been minimized.

Copy link

juj commented May 28, 2015

Please reopen. This is still a bug, here are simple steps to reproduce e.g. for attaching to raspberry pi unit test suites:

  1. Create a file a.c with the following one line of content:

    #include <EGL/egl.h>
    
  2. Compile with cc -I/opt/vc/include -c a.c.

Observed: The compilation fails with the error message

pi@raspberrypi ~/code/builds $ c++ -I/opt/vc/include a.c
In file included from /opt/vc/include/interface/vcos/vcos_assert.h:149:0,
                 from /opt/vc/include/interface/vcos/vcos.h:114,
                 from /opt/vc/include/interface/vmcs_host/vc_dispmanx.h:33,
                 from /opt/vc/include/EGL/eglplatform.h:110,
                 from /opt/vc/include/EGL/egl.h:36,
                 from a.c:1:
/opt/vc/include/interface/vcos/vcos_types.h:38:33: fatal error: vcos_platform_types.h: No such file or directory
compilation terminated.
pi@raspberrypi ~/code/builds $ 

Expected: As per the EGL spec, the above code should compile without an error.

@juj

This comment has been minimized.

Copy link

juj commented May 29, 2015

Running the following (blunt but functional) script on the command line fixes the headers for me:

sudo sed -i 's/include "vcos_platform.h"/include "pthreads\/vcos_platform.h"/g' /opt/vc/include/interface/vcos/vcos.h
sudo sed -i 's/include "vcos_platform_types.h"/include "pthreads\/vcos_platform_types.h"/g' /opt/vc/include/interface/vcos/vcos_types.h
sudo sed -i 's/include "vcos_platform.h"/include "pthreads\/vcos_platform.h"/g' /opt/vc/include/interface/vcos/vcos_init.h
sudo sed -i 's/include "vcos_platform.h"/include "pthreads\/vcos_platform.h"/g' /opt/vc/include/interface/vcos/vcos_thread.h
sudo sed -i 's/include "vcos_platform.h"/include "pthreads\/vcos_platform.h"/g' /opt/vc/include/interface/vcos/vcos_mutex.h
sudo sed -i 's/include "vcos_platform.h"/include "pthreads\/vcos_platform.h"/g' /opt/vc/include/interface/vcos/vcos_mem.h
sudo sed -i 's/include "vcos_platform.h"/include "pthreads\/vcos_platform.h"/g' /opt/vc/include/interface/vcos/vcos_logging.h
sudo sed -i 's/include "vcos_platform.h"/include "pthreads\/vcos_platform.h"/g' /opt/vc/include/interface/vcos/vcos_string.h
sudo sed -i 's/include "vcos_platform.h"/include "pthreads\/vcos_platform.h"/g' /opt/vc/include/interface/vcos/vcos_event.h
sudo sed -i 's/include "vcos_platform.h"/include "pthreads\/vcos_platform.h"/g' /opt/vc/include/interface/vcos/vcos_tls.h
sudo sed -i 's/include "vcos_platform.h"/include "pthreads\/vcos_platform.h"/g' /opt/vc/include/interface/vcos/vcos_reentrant_mutex.h
sudo sed -i 's/include "vcos_platform.h"/include "pthreads\/vcos_platform.h"/g' /opt/vc/include/interface/vcos/vcos_named_semaphore.h
sudo sed -i 's/include "vcos_platform.h"/include "pthreads\/vcos_platform.h"/g' /opt/vc/include/interface/vcos/vcos_quickslow_mutex.h
sudo sed -i 's/include "vcos_platform.h"/include "pthreads\/vcos_platform.h"/g' /opt/vc/include/interface/vcos/vcos_event_flags.h
sudo sed -i 's/include "vcos_platform.h"/include "pthreads\/vcos_platform.h"/g' /opt/vc/include/interface/vcos/vcos_atomic_flags.h
sudo sed -i 's/include "vcos_platform.h"/include "pthreads\/vcos_platform.h"/g' /opt/vc/include/interface/vcos/vcos_once.h
sudo sed -i 's/include "vcos_platform.h"/include "pthreads\/vcos_platform.h"/g' /opt/vc/include/interface/vcos/vcos_blockpool.h

There may be more, I just replaced the ones that the compiler complained about when including EGL/egl.h.

@fthiery

This comment has been minimized.

Copy link

fthiery commented Dec 1, 2015

I've been trying to compile gst-plugins-bad's OpenGL sink with EGL support as well, and had a really hard time making the ./configure checks pass.

So far i succeeded by linking to several folders manually (as below):
./configure CFLAGS=-I/opt/vc/include -I /opt/vc/include/interface/vcos/pthreads -I /opt/vc/include/interface/vmcs_host/linux/ LDFLAGS=-L/opt/vc/lib --disable-gtk-doc --disable-opengl --enable-gles2 --enable-egl --disable-glx --disable-x11 --disable-wayland --enable-dispmanx --no-create --no-recursion

The sed command above didn't do it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.