* Newbie question: How to get dependencies into compile of custom recipe?
@ 2014-04-22 7:57 Neuer User
2014-04-22 8:42 ` Richard Purdie
2014-04-22 14:32 ` Robert Calhoun
0 siblings, 2 replies; 7+ messages in thread
From: Neuer User @ 2014-04-22 7:57 UTC (permalink / raw)
To: yocto
Hi
Sorry for this simple question. I've just started building my first
image with yocto and would now like to add a (very simple) own recipe.
I followed the Yocto Development guide, added my own layer and included
the "helloworld" example.
Now I would like to exchange the helloworld.c code with a simple
gstreamer-rtsp server code
(http://cgit.freedesktop.org/gstreamer/gst-rtsp-server/tree/examples/test-launch.c).
I changed the bb file as follows, adding expecially the DEPENDS:
#
# This file was derived from the 'Hello World!' example recipe in the
# Yocto Project Development Manual.
#
DESCRIPTION = "Simple helloworld application"
SECTION = "multimedia"
LICENSE = "MIT"
LIC_FILES_CHKSUM =
"file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
PR = "r0"
SRC_URI = "file://cameraserver.c"
DEPENDS = "gst-rtsp gstreamer"
S = "${WORKDIR}"
do_compile() {
${CC} cameraserver.c -o cameraserver
}
do_install() {
install -d ${D}${bindir}
install -m 0755 cameraserver ${D}${bindir}
}
The package "gst-rtsp" is correctly built (as
libgstrtspserver-0.10-0-0.10.8-r0@cortexa9hf_vfp_neon), but the
compilation process of the "cameraserver.c" does not find the necessary
header include files.
NOTE: recipe camera-server-0.1-r0: task do_compile: Started
Log data follows:
| DEBUG: Executing shell function do_compile
| cameraserver.c:20:21: fatal error: gst/gst.h: No such file or directory
| #include <gst/gst.h>
| ^
| compilation terminated.
| WARNING: exit code 1 from a shell command.
| ERROR: Function failed: do_compile (log file is located at
/home/ubuntu/yocto/build/tmp/work/cortexa9hf-vfp-neon-poky-linux-gnueabi/camera-server/0.1-r0/temp/log.do_compile.26393)
NOTE: recipe camera-server-0.1-r0: task do_compile: Failed
The debug of bitbake shows, however, that it correctly identifies the
dependent packages:
DEBUG: providers for gst-rtsp are: ['gst-rtsp']
DEBUG: sorted runtime providers for gst-rtsp are:
['/home/ubuntu/yocto/sources/meta-openembedded/meta-multimedia/recipes-multimedia/gstreamer/gst-rtsp_0.10.8.bb']
DEBUG: adding
'/home/ubuntu/yocto/sources/meta-openembedded/meta-multimedia/recipes-multimedia/gstreamer/gst-rtsp_0.10.8.bb'
to satisfy runtime 'gst-rtsp'
DEBUG: providers for gstreamer are: ['gstreamer']
DEBUG: sorted runtime providers for gstreamer are:
['/home/ubuntu/yocto/sources/poky/meta/recipes-multimedia/gstreamer/gstreamer_0.10.36.bb']
DEBUG: adding
'/home/ubuntu/yocto/sources/poky/meta/recipes-multimedia/gstreamer/gstreamer_0.10.36.bb'
to satisfy runtime 'gstreamer'
So, what am I doing wrong? Do I explicitly need to add the dependencies
to the compile environment somehow? If yes, where are the found
directories stored?
Or am I doing this all very wrong? I am really very new to Yocto.
Thanks for any help!
Michael
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: Newbie question: How to get dependencies into compile of custom recipe?
2014-04-22 7:57 Newbie question: How to get dependencies into compile of custom recipe? Neuer User
@ 2014-04-22 8:42 ` Richard Purdie
2014-04-22 12:56 ` Neuer User
2014-04-22 14:32 ` Robert Calhoun
1 sibling, 1 reply; 7+ messages in thread
From: Richard Purdie @ 2014-04-22 8:42 UTC (permalink / raw)
To: Neuer User; +Cc: yocto
On Tue, 2014-04-22 at 09:57 +0200, Neuer User wrote:
> Hi
>
> Sorry for this simple question. I've just started building my first
> image with yocto and would now like to add a (very simple) own recipe.
>
> I followed the Yocto Development guide, added my own layer and included
> the "helloworld" example.
>
> Now I would like to exchange the helloworld.c code with a simple
> gstreamer-rtsp server code
> (http://cgit.freedesktop.org/gstreamer/gst-rtsp-server/tree/examples/test-launch.c).
>
> I changed the bb file as follows, adding expecially the DEPENDS:
>
> #
> # This file was derived from the 'Hello World!' example recipe in the
> # Yocto Project Development Manual.
> #
>
> DESCRIPTION = "Simple helloworld application"
> SECTION = "multimedia"
> LICENSE = "MIT"
> LIC_FILES_CHKSUM =
> "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
> PR = "r0"
>
> SRC_URI = "file://cameraserver.c"
>
> DEPENDS = "gst-rtsp gstreamer"
>
> S = "${WORKDIR}"
>
> do_compile() {
> ${CC} cameraserver.c -o cameraserver
> }
>
> do_install() {
> install -d ${D}${bindir}
> install -m 0755 cameraserver ${D}${bindir}
> }
>
>
> The package "gst-rtsp" is correctly built (as
> libgstrtspserver-0.10-0-0.10.8-r0@cortexa9hf_vfp_neon), but the
> compilation process of the "cameraserver.c" does not find the necessary
> header include files.
>
> NOTE: recipe camera-server-0.1-r0: task do_compile: Started
> Log data follows:
> | DEBUG: Executing shell function do_compile
> | cameraserver.c:20:21: fatal error: gst/gst.h: No such file or directory
> | #include <gst/gst.h>
> | ^
> | compilation terminated.
> | WARNING: exit code 1 from a shell command.
> | ERROR: Function failed: do_compile (log file is located at
> /home/ubuntu/yocto/build/tmp/work/cortexa9hf-vfp-neon-poky-linux-gnueabi/camera-server/0.1-r0/temp/log.do_compile.26393)
> NOTE: recipe camera-server-0.1-r0: task do_compile: Failed
>
>
> The debug of bitbake shows, however, that it correctly identifies the
> dependent packages:
>
> DEBUG: providers for gst-rtsp are: ['gst-rtsp']
> DEBUG: sorted runtime providers for gst-rtsp are:
> ['/home/ubuntu/yocto/sources/meta-openembedded/meta-multimedia/recipes-multimedia/gstreamer/gst-rtsp_0.10.8.bb']
> DEBUG: adding
> '/home/ubuntu/yocto/sources/meta-openembedded/meta-multimedia/recipes-multimedia/gstreamer/gst-rtsp_0.10.8.bb'
> to satisfy runtime 'gst-rtsp'
> DEBUG: providers for gstreamer are: ['gstreamer']
> DEBUG: sorted runtime providers for gstreamer are:
> ['/home/ubuntu/yocto/sources/poky/meta/recipes-multimedia/gstreamer/gstreamer_0.10.36.bb']
> DEBUG: adding
> '/home/ubuntu/yocto/sources/poky/meta/recipes-multimedia/gstreamer/gstreamer_0.10.36.bb'
> to satisfy runtime 'gstreamer'
>
>
> So, what am I doing wrong? Do I explicitly need to add the dependencies
> to the compile environment somehow? If yes, where are the found
> directories stored?
>
> Or am I doing this all very wrong? I am really very new to Yocto.
Basically, you need to pass in the correct compiler and linker flags.
http://gstreamer.freedesktop.org/data/doc/gstreamer/head/faq/html/chapter-developing.html
Adding:
`pkg-config --cflags --libs gstreamer`
to your compiler line will probably help. The system will automatically
figure out things from there, the environment contains things that
pkg-config can use to generate the correct options.
Cheers,
Richard
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: Newbie question: How to get dependencies into compile of custom recipe?
2014-04-22 8:42 ` Richard Purdie
@ 2014-04-22 12:56 ` Neuer User
2014-04-22 14:41 ` Gary Thomas
0 siblings, 1 reply; 7+ messages in thread
From: Neuer User @ 2014-04-22 12:56 UTC (permalink / raw)
To: yocto
Am 22.04.2014 10:42, schrieb Richard Purdie:
>
> Basically, you need to pass in the correct compiler and linker flags.
>
> http://gstreamer.freedesktop.org/data/doc/gstreamer/head/faq/html/chapter-developing.html
>
> Adding:
>
> `pkg-config --cflags --libs gstreamer`
>
> to your compiler line will probably help. The system will automatically
> figure out things from there, the environment contains things that
> pkg-config can use to generate the correct options.
>
> Cheers,
>
> Richard
>
Thanks, that helped, but I'm still not through, I'm afraid.
My recipe look like this now:
DESCRIPTION = "Simple helloworld application"
SECTION = "multimedia"
LICENSE = "MIT"
LIC_FILES_CHKSUM =
"file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
PR = "r0"
SRC_URI = "file://cameraserver.c"
DEPENDS = "gst-rtsp gstreamer"
S = "${WORKDIR}"
do_compile() {
${CC} `pkg-config --cflags --libs gstreamer-0.10`
cameraserver.c -o cameraserver
}
do_install() {
install -d ${D}${bindir}
install -m 0755 cameraserver ${D}${bindir}
}
It only worked with "gstreamer-0.10". Now the compilation works, but
linking stops:
Log data follows:
| DEBUG: Executing shell function do_compile
| /tmp/cckmN8NC.o: In function `main':
| cameraserver.c:(.text+0x70): undefined reference to `gst_rtsp_server_new'
| cameraserver.c:(.text+0x7c): undefined reference to
`gst_rtsp_server_get_media_mapping'
| cameraserver.c:(.text+0x84): undefined reference to
`gst_rtsp_media_factory_new'
| cameraserver.c:(.text+0xa0): undefined reference to
`gst_rtsp_media_factory_set_launch'
| cameraserver.c:(.text+0xb4): undefined reference to
`gst_rtsp_media_mapping_add_factory'
| cameraserver.c:(.text+0xc8): undefined reference to
`gst_rtsp_server_attach'
| collect2: error: ld returned 1 exit status
As it seems only linking to gst-rtsp, not to gstreamer, if I see that
correctly.
I then tried to add "gst-rtsp" or "gst-rtsp-server" or "gst-rtsp-0.10"
or "gst-rtsp-server-0.10" to the pkg-config part, but none of them were
found.
I tell you, I feel extremely stupid. The solution is probably so simple,
yet I do not find a solution (even with using Google).
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: Newbie question: How to get dependencies into compile of custom recipe?
2014-04-22 12:56 ` Neuer User
@ 2014-04-22 14:41 ` Gary Thomas
0 siblings, 0 replies; 7+ messages in thread
From: Gary Thomas @ 2014-04-22 14:41 UTC (permalink / raw)
To: yocto
On 2014-04-22 06:56, Neuer User wrote:
> Am 22.04.2014 10:42, schrieb Richard Purdie:
>>
>> Basically, you need to pass in the correct compiler and linker flags.
>>
>> http://gstreamer.freedesktop.org/data/doc/gstreamer/head/faq/html/chapter-developing.html
>>
>> Adding:
>>
>> `pkg-config --cflags --libs gstreamer`
>>
>> to your compiler line will probably help. The system will automatically
>> figure out things from there, the environment contains things that
>> pkg-config can use to generate the correct options.
>>
>> Cheers,
>>
>> Richard
>>
>
> Thanks, that helped, but I'm still not through, I'm afraid.
>
> My recipe look like this now:
>
>
> DESCRIPTION = "Simple helloworld application"
> SECTION = "multimedia"
> LICENSE = "MIT"
> LIC_FILES_CHKSUM =
> "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
> PR = "r0"
>
> SRC_URI = "file://cameraserver.c"
>
> DEPENDS = "gst-rtsp gstreamer"
Try adding gst-plugins-good to DEPENDS - that's where the rtsp stuff lives.
>
> S = "${WORKDIR}"
>
> do_compile() {
> ${CC} `pkg-config --cflags --libs gstreamer-0.10`
> cameraserver.c -o cameraserver
> }
>
> do_install() {
> install -d ${D}${bindir}
> install -m 0755 cameraserver ${D}${bindir}
> }
>
> It only worked with "gstreamer-0.10". Now the compilation works, but
> linking stops:
>
> Log data follows:
> | DEBUG: Executing shell function do_compile
> | /tmp/cckmN8NC.o: In function `main':
> | cameraserver.c:(.text+0x70): undefined reference to `gst_rtsp_server_new'
> | cameraserver.c:(.text+0x7c): undefined reference to
> `gst_rtsp_server_get_media_mapping'
> | cameraserver.c:(.text+0x84): undefined reference to
> `gst_rtsp_media_factory_new'
> | cameraserver.c:(.text+0xa0): undefined reference to
> `gst_rtsp_media_factory_set_launch'
> | cameraserver.c:(.text+0xb4): undefined reference to
> `gst_rtsp_media_mapping_add_factory'
> | cameraserver.c:(.text+0xc8): undefined reference to
> `gst_rtsp_server_attach'
> | collect2: error: ld returned 1 exit status
>
> As it seems only linking to gst-rtsp, not to gstreamer, if I see that
> correctly.
>
> I then tried to add "gst-rtsp" or "gst-rtsp-server" or "gst-rtsp-0.10"
> or "gst-rtsp-server-0.10" to the pkg-config part, but none of them were
> found.
>
> I tell you, I feel extremely stupid. The solution is probably so simple,
> yet I do not find a solution (even with using Google).
>
>
--
------------------------------------------------------------
Gary Thomas | Consulting for the
MLB Associates | Embedded world
------------------------------------------------------------
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Newbie question: How to get dependencies into compile of custom recipe?
2014-04-22 7:57 Newbie question: How to get dependencies into compile of custom recipe? Neuer User
2014-04-22 8:42 ` Richard Purdie
@ 2014-04-22 14:32 ` Robert Calhoun
2014-04-22 14:48 ` Neuer User
1 sibling, 1 reply; 7+ messages in thread
From: Robert Calhoun @ 2014-04-22 14:32 UTC (permalink / raw)
To: Neuer User, yocto@yoctoproject.org
On 4/22/14 3:57 AM, "Neuer User" <auslands-kv@gmx.de> wrote:
>Sorry for this simple question. I've just started building my first
>image with yocto and would now like to add a (very simple) own recipe.
(I am not familiar with gstreamer, but it looks like a big project and
maybe not so simple!)
The yocto build system figures out dependencies and build order, sets the
environment, and generates shell scripts to do the actual tasks. The
actual "work" is done by these shell scripts, not by the python code.
Your recipe explicitly defines some steps like do_compile(). When you do
this, you are saying "Let me control the compilation, I know what I am
doing!". Your do_compile() step is going to generate a run.do_compile
script, and that has to work just as if you were running the script
yourself.
If something doesn't work, try "bitbake {pkg} -c devshell". That will
drop you into the environment the compiler is going to see. The shell
scripts are in ../temp. Each script is a single step (do_compile etc). All
of the substitutions that Richard described will already have been made;
and you will see all the environment variables being set and the calls
made to the compiler, linker etc. This directory also contains the log
files from recent executions.
You can run these manually, e.g. ../temp/run.do_compile. (The files
without PIDs are symlinks to the latest script.) You can edit this script
and re-run the compile and link step until it works. Once you've figured
out what needs to be set or run, modify the recipe to generate that
environment or command.
An important thing to understand is that each step lives in its own little
world; an environment variable set in the do_compile is not present in
do_install unless you put it there. Avoidance of global state allows the
build system to run multiple tasks in parallel.
-Rob Calhoun
(still figuring this stuff out myself)
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: Newbie question: How to get dependencies into compile of custom recipe?
2014-04-22 14:32 ` Robert Calhoun
@ 2014-04-22 14:48 ` Neuer User
2014-04-22 14:58 ` [solved] " Neuer User
0 siblings, 1 reply; 7+ messages in thread
From: Neuer User @ 2014-04-22 14:48 UTC (permalink / raw)
To: yocto
H Rob
Thanks for the information.
To clarify: My recipe is a very simple one. It is just one c file with
maybe 40 lines or so.
But it uses library functions from another recipe "gst-rtsp", which
again uses "gstreamer".
Both, "gstreamer" and "gst-rtsp" are compiled and working nicely, as far
as I can tell.
Now I have a simple c program file that needs to be compiled and linked
against "gst-rtsp". Hmmm.
I don't have a makefile. I don't use any autotools for this file. The bb
recipe is based on the example in the Yocto Development guide for a
simple c file.
I have to admit: I am extremely new to Yocto. I am also not a c
programmer. If I program, I typically use python or Qt5. :-)
I guess, I try the "devshell" and see what variables are set and what
pkg-config output is like.
In the end, it is probably very simple to do, but for a Newbie like
me... :-)
Am 22.04.2014 16:32, schrieb Robert Calhoun:
>
>
> On 4/22/14 3:57 AM, "Neuer User"
> <auslands-kv@gmx.de> wrote:
>> Sorry for this simple question. I've just started building my
>> first image with yocto and would now like to add a (very simple)
>> own recipe.
>
> (I am not familiar with gstreamer, but it looks like a big project
> and maybe not so simple!)
>
> The yocto build system figures out dependencies and build order, sets
> the environment, and generates shell scripts to do the actual tasks.
> The actual "work" is done by these shell scripts, not by the python
> code.
>
> Your recipe explicitly defines some steps like do_compile(). When you
> do this, you are saying "Let me control the compilation, I know what
> I am doing!". Your do_compile() step is going to generate a
> run.do_compile script, and that has to work just as if you were
> running the script yourself.
>
>
> If something doesn't work, try "bitbake {pkg} -c devshell". That
> will drop you into the environment the compiler is going to see. The
> shell scripts are in ../temp. Each script is a single step
> (do_compile etc). All of the substitutions that Richard described
> will already have been made; and you will see all the environment
> variables being set and the calls made to the compiler, linker etc.
> This directory also contains the log files from recent executions.
>
> You can run these manually, e.g. ../temp/run.do_compile. (The files
> without PIDs are symlinks to the latest script.) You can edit this
> script and re-run the compile and link step until it works. Once
> you've figured out what needs to be set or run, modify the recipe to
> generate that environment or command.
>
> An important thing to understand is that each step lives in its own
> little world; an environment variable set in the do_compile is not
> present in do_install unless you put it there. Avoidance of global
> state allows the build system to run multiple tasks in parallel.
>
> -Rob Calhoun (still figuring this stuff out myself)
>
^ permalink raw reply [flat|nested] 7+ messages in thread* [solved] Re: Newbie question: How to get dependencies into compile of custom recipe?
2014-04-22 14:48 ` Neuer User
@ 2014-04-22 14:58 ` Neuer User
0 siblings, 0 replies; 7+ messages in thread
From: Neuer User @ 2014-04-22 14:58 UTC (permalink / raw)
To: yocto
Got it working!
The hint with the "devshell" helped very much. I could try out
"pkg-config --list-all|grep rtsp" and found the name pkg-config was
expecting.
So, the line must be:
pkg-config --cflags --libs gstreamer-0.10 gst-rtsp-server-0.10
(Thought I had tried this, but maybe had a typo in the name.)
Now it compiled and build the package. Great!!
Hope, the package does work :-)
Thanks again. I learned a lot!
Michael
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2014-04-22 14:58 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-22 7:57 Newbie question: How to get dependencies into compile of custom recipe? Neuer User
2014-04-22 8:42 ` Richard Purdie
2014-04-22 12:56 ` Neuer User
2014-04-22 14:41 ` Gary Thomas
2014-04-22 14:32 ` Robert Calhoun
2014-04-22 14:48 ` Neuer User
2014-04-22 14:58 ` [solved] " Neuer User
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.