How to setup autotools for glib-compile-resources? - gtk

How would I setup my Makefile.am file to run glib-compile-resources to compile resources.
This is how my Makefile.am currently looks like:
INTLTOOL_FILES = intltool-extract.in \
intltool-merge.in \
intltool-update.in
ACLOCAL_AMFLAGS = -I m4
SUBDIRS = src data po gnome pixmaps dicfiles
EXTRA_DIST = COPYING rpm/gjiten.spec scripts/make_debs scripts/make_release\
intltool-extract.in intltool-merge.in intltool-update.in
DISTCLEANFILES = ${INTLTOOL_FILES} \
po/.intltool-merge-cache
MAINTAINERCLEANFILES += configure config.sub config.guess aclocal.m4 compile \
depcomp install-sh \
${DISTCLEANFILES} intltool-extract intltool-merge intltool-update.in \
ltmain.sh missing mkinstalldirs config.h.in po/*stamp* *stamp*
Or do I have to setup the commands within autogen.h or configure.ac ?

How would I setup my Makefile.am file to run glib-compile-resources to compile resources.
There are lots of ways, but the one I would recommend to you is to add an all-local target. For example:
all-local:
glib-compile-resources
You would also want to be sure to provide for cleaning the generated files, which might be accomplished either by adding them to CLEANFILES or by adding a clean-local target with an appropriate recipe.

Related

How bitbake searches for recipe in build process?

I am trying to find out that how bitbake search for recipe in build process ?
For example,
I have a recipe something like below:
DESCRIPTION = "PetaLinux GSTREAMER supported packages"
inherit packagegroup
GSTREAMER_PACKAGES = " \
gstreamer1.0 \
gstreamer1.0-python \
gstreamer1.0-meta-base \
gstreamer1.0-plugins-base \
gstreamer1.0-plugins-good \
gstreamer1.0-plugins-bad \
gstreamer1.0-rtsp-server \
gst-shark \
gstd \
gst-perf \
gst-interpipes \
"
GSTREAMER_PACKAGES_append_zynqmp = " gstreamer1.0-omx"
RDEPENDS_${PN} = "${GSTREAMER_PACKAGES}"
When I searched gstreamer1.0 related recipe in yocto layers, I found two recipe, one of them is gstreamer1.0_1.16.1.bb in meta layer, and the other is gstreamer1.0_%.bbappend in meta-petalinux layer.
Both of these layers was added to the BBLAYERS in bblayers.conf file and the priorities that spesified with BBFILE_PRIORITY_* in related layer's layer.conf file is same.
So,
Which recipe will be used in build process in that case ?
What is the recipe lookup rules in yocto ?
I changed somethings to understand the behaviour:
For example,
I entered the invalid github URL that spesified in gstreamer1.0_%.bbappend recipe. When I tried to build the linux system, I encountered with an error. Thats fine.
Then I corrected the github URL in this recipe and entered invalid source code address that spesified in gstreamer1.0_1.16.1.bb recipe. When I tried to build linux system, process finished successfully.
Then I increased the priority of meta layer. I supposed to encounter with an error in this case but again build process finished successfully.
Could you please help me to understand this behaviour ?
Thanks.
You have two different files: a .bb and a .bbappend.
A .bb is the base recipe of one (or multiple) packages. It generally describe how to fetch, configure, compile, install files in a package for your target.
A .bbappend file is an 'append' file. It allows a meta (here meta-petalinux) to modify an existing recipe in another meta without copying it. A .bbappend can modify any steps of the bb file: source fetch, configure, compile, install...
You can for example create your own bbappend of Gstreamer, to enable pango (disbaled by default on my Yocto). The bbappend filename is gstreamer1.0-plugins-base_%.bbappend and only contains PACKAGECONFIG_append = "pango"
The Yocto Manual can give you more information on bbappend files here.

Create a recipe for a QT5 application

I have been struggling for too long, so I need help :)
I made a big QT5.8 application and usually when I want to compile it with my PC I just have to run the following command: qmake -qt=5.9 -spec linux-arm-gnueabihf-g++ -config configuration_name.
With this command, I can cross compile my source code for the armhf architecture using linux-arm-gnueabihf-g++ toolchain.
But now, as can easily create a yocto image for my target (Raspberry pi), I want to make a recipe in order to compile my qt software and put it into my image.
For now, I achieved to perform these following task in my recipe without errors:
do_fetch -> Yocto fetch the source from git repo (OK)
do_unpack -> OK
After that I want to perform a qmake command in order to generate my makefile, but here is my problem :/
First, I included the qmake5 class in my recipe using
require recipes-qt/qt5/qt5.inc
Then I tried a lot of things..
writing "qmake" into the do_configure task doesn't work. Last thing I tried was: '${OE_QMAKE_QMAKE} ${S}/my_software.pro -config my_config' but still the same error:
Could not find qmake spec 'linux-oe-g++'
I don't know what to do and I can't find any recipe exemple doing the things that I want to do.
If somebody already experienced this issue or have experience compiling qt5 software with a yocto recipe I would like your help :)
my recipe:
LICENSE = "CLOSED"
LIC_FILES_CHKSUM = " "
USERNAME = "****"
PASSWORD = "*****"
S = "${WORKDIR}/git"
require recipes-qt/qt5/qt5.inc
do_fetch(){
git clone http://${USERNAME}:${PASSWORD}#gitlab.....
}
do_configure () {
${OE_QMAKE_QMAKE} ${S}/my_software.pro -config my_config
}
Thanks
Short answer
Add "inherit qmake5" and let Yocto take care of it :)
Long answer
Here's an example of how I added a QT project. It is not using git, it is using local files. However for getting one step further I suggest:
Use my way as a test. Copy the QT project to /yocto/local_sources/Myproject/
and make this known to Yocto by using FILESEXTRAPATHS_prepend_ (as shown below).
If this works on your environment, adapt it to your needs (e.g. build from git instead of local_source, which is better off course.)
This way is tested and works also well for later remote-debugging with qt-creator and the yocto SDK by the way. Stick to Yocto, it's worth it in the end.
Here's my .bb file:
#
# Build QT xyz application
#
SUMMARY = "..."
SECTION = "Mysection"
LICENSE = "CLOSED"
#Add whatever you need here
DEPENDS += "qtbase qtmultimedia qtsvg"
#Add here your .pro and all other relevant files (if you use git later this step will be less tedious ...)
SRC_URI += "file://Myproject.pro"
SRC_URI += "file://*.h"
SRC_URI += "file://*.cpp"
SRC_URI += "file://subdir1/*.h"
SRC_URI += "file://subdir1/*.cpp"
SRC_URI += "file://subdir2/*.h"
SRC_URI += "file://subdir2/*.cpp"
SRC_URI += "file://subdir2/subdir3/*.h"
SRC_URI += "file://subdir2/subdir3/*.cpp"
#If you need autostart:
#SRC_URI += "file://myproject.service"
#Register for root file system aggregation
FILES_${PN} += "${bindir}/Myproject"
#RBE todo: both needed ?
FILESEXTRAPATHS_prepend_${PN} := "/yocto/local_sources/Myproject/Src:"
FILESEXTRAPATHS_prepend := "/yocto/local_sources/Myproject/Src:"
S = "${WORKDIR}"
#If you want to auto-start this add:
#SYSTEMD_SERVICE_${PN} = "Myproject.service"
FILES_${PN} = "${datadir} ${bindir} ${systemd_unitdir}"
FILES_${PN}-dbg = "${datadir}/${PN}/.debug"
FILES_${PN}-dev = "/usr/src"
#Check what's needed in your case ...
RDEPENDS_${PN} += "\
qtmultimedia-qmlplugins \
qtvirtualkeyboard \
qtquickcontrols2-qmlplugins \
gstreamer1.0-libav \
gstreamer1.0-plugins-base-audioconvert \
gstreamer1.0-plugins-base-audioresample \
gstreamer1.0-plugins-base-playback \
gstreamer1.0-plugins-base-typefindfunctions \
gstreamer1.0-plugins-base-videoconvert \
gstreamer1.0-plugins-base-videoscale \
gstreamer1.0-plugins-base-volume \
gstreamer1.0-plugins-base-vorbis \
gstreamer1.0-plugins-good-autodetect \
gstreamer1.0-plugins-good-matroska \
gstreamer1.0-plugins-good-ossaudio \
gstreamer1.0-plugins-good-videofilter \
"
do_install_append () {
# Install application
install -d ${D}${bindir}
install -m 0755 Myproject ${D}${bindir}/
# Uncomment if you want to autostart this application as a service
#install -Dm 0644 ${WORKDIR}/myproject.service ${D}${systemd_system_unitdir}/myproject.service
# Install resource files (example)
#install -d ${D}${datadir}/${PN}/Images
#for f in ${S}/Images/*; do \
# install -Dm 0644 $f ${D}${datadir}/${PN}/Images/
#done
}
#Also inherit "systemd" if you need autostart
inherit qmake5

Unable to use Maven Central Repository with bnd to resolve dependencies

With Eclipse Oxygen.2 Release (4.7.2), I'm trying to use bndtools to make some OSGi bundles.
By default (with the JPM repository) I am able to resolve dependencies fine. But I have no way of seeing what libraries are there. Because of this, I'd like to use Maven Central to handle my dependencies. I can browse the website, see what versions are there, and make choices on that information.
The default build.bnd file in the cnf project has the repositories setup like
# Configure Repositories
-plugin.1.Central: \
aQute.bnd.deployer.repository.wrapper.Plugin; \
location = "${build}/cache/wrapper"; \
reindex = true, \
aQute.bnd.jpm.Repository; \
includeStaged = true; \
name = Central; \
location = ~/.bnd/shacache; \
index = ${build}/central.json
-plugin.2.Local: \
aQute.bnd.deployer.repository.LocalIndexedRepo; \
name = Local; \
pretty = true; \
local = ${build}/local
-plugin.3.Templates: \
aQute.bnd.deployer.repository.LocalIndexedRepo; \
name = Templates; \
pretty = true; \
local = ${build}/templates
-plugin.4.Release: \
aQute.bnd.deployer.repository.LocalIndexedRepo; \
name = Release; \
pretty = true; \
local = ${build}/release
Following the instructions on the bnd website I added the following to my file; because there was already a Central repository, I named this one Maven but the rest is the same
-plugin.5.Maven = \
aQute.bnd.repository.maven.provider.MavenBndRepository; \
releaseUrl=https://repo.maven.apache.org/maven2/; \
index="${.}/central.maven"; \
name="Maven"
When I remove the JPM repository, suddenly everything is broken. This didn't come as too much of a surprise, because I did just remove a repository. However, I thought that after building and cleaning the workspace, it would resolve that we can access maven central, and it would pull from there. This was not the case.
I noticed that there was an index property on the Maven repository, so I thought that perhaps I had to add all of my dependency names to the file specified, but I haven't been able to find any documentation on what the file looks like, or how to create one, or anything of the sort.
The errors that I get in Eclipse are
Cannot find /error/org.apache.servicemix.bundles.junit;version=4.12 Not found in [bnd-cache [PATH\TO\WORKSPACE\cnf\cache\3.5.0\bnd-cache r/w=false], Local, Templates, Release, MavenBndRepository [localRepo=PATH\TO\USER\FOLDER.m2\repository, storage=Maven, inited=true]]
Is there something I'm missing in this whole process? Is there something obvious I've missed?
I found out (thanks to the OSGi enroute tutorial), what I was missing.
There needs to be an existing index file at the specified location, and that file is made up of maven coordinate entries. The jpm index only needed the artifact id and version, but the maven coordinates require group, artifact, and version.
I modified my cnf/build.bnd entry to look like
-plugin.5.Central = \
aQute.bnd.repository.maven.provider.MavenBndRepository; \
releaseUrl=https://repo.maven.apache.org/maven2/; \
name="Central"
I removed the index file specification, that way it would just use the default (cnf/<name>.mvn). However, I wasn't sure which name the documentation was talking about. I determined that it was the name specified inside the repository settings. name="<ThisValueHere>", not -plugin.5.<ThisValueHere>. Note that this value is not case-sensitive.
My central.mvn file ended up looking like
org.apache.felix:org.apache.felix.framework:5.4.0
org.apache.felix:org.apache.felix.gogo.command:1.0.2
org.apache.felix:org.apache.felix.gogo.runtime:1.0.10
org.apache.felix:org.apache.felix.gogo.shell:1.0.0
org.apache.felix:org.apache.felix.log:1.0.1
org.apache.felix:org.apache.felix.scr:2.0.14
org.apache.servicemix.bundles:org.apache.servicemix.bundles.junit:4.12_1
org.osgi:osgi.annotation:6.0.1
org.osgi:osgi.cmpn:6.0.0
org.osgi:osgi.core:6.0.0

How can I change the installation path of an autotools-based Bitbake recipe?

I have an autotools-based BitBake recipe which I would like to have binaries installed in /usr/local/bin and libraries installed in /usr/local/lib (instead of /usr/bin and /usr/lib, which are the default target directories).
Here's a part of the autotools.bbclass file which I found important.
CONFIGUREOPTS = " --build=${BUILD_SYS} \
--host=${HOST_SYS} \
--target=${TARGET_SYS} \
--prefix=${prefix} \
--exec_prefix=${exec_prefix} \
--bindir=${bindir} \
--sbindir=${sbindir} \
--libexecdir=${libexecdir} \
--datadir=${datadir} \
--sysconfdir=${sysconfdir} \
--sharedstatedir=${sharedstatedir} \
--localstatedir=${localstatedir} \
--libdir=${libdir} \
...
I thought that the easiest way to accomplish what I wanted to do would be to simply change ${bindir} and ${libdir}, or perhaps change ${prefix} to /usr/local, but I haven't had any success in this area. Is there a way to change these installation variables, or am I thinking about this in the wrong way?
Update:
Strategy 1
As per Ross Burton's suggestion, I've tried adding the following to my recipe:
prefix="/usr/local"
exec_prefix="/usr/local"
but this causes the build to fail during that recipe's do_configure() task, and returns the following:
| checking for GLIB... no
| configure: error: Package requirements (glib-2.0 >= 2.12.3) were not met:
|
| No package 'glib-2.0' found
This package can be found during a normal build without these modified variables. I thought that adding the following line might allow the system to find the package metadata for glib:
PKG_CONFIG_PATH = " ${STAGING_DIR_HOST}/usr/lib/pkgconfig "
but this seems to have made no difference.
Strategy 2
I've also tried Ross Burton's other suggestion to add these variable assignments into my distribution's configuration file, but this causes it to fail during meta/recipes-extended/tzdata's do_install() task. It returns that DEFAULT_TIMEZONE is set to an invalid value. Here's the source of the error from tzdata_2015g.bb
# Install default timezone
if [ -e ${D}${datadir}/zoneinfo/${DEFAULT_TIMEZONE} ]; then
install -d ${D}${sysconfdir}
echo ${DEFAULT_TIMEZONE} > ${D}${sysconfdir}/timezone
ln -s ${datadir}/zoneinfo/${DEFAULT_TIMEZONE} ${D}${sysconfdir}/localtime
else
bberror "DEFAULT_TIMEZONE is set to an invalid value."
exit 1
fi
I'm assuming that I've got a problem with ${datadir}, which references ${prefix}.
Do you want to change paths for everything or just one recipe? Not sure why you'd want to change just one recipe to /usr/local, but whatever.
If you want to change all of them, then the simple way is to set prefix in your local.conf or distro configuration (prefix = "/usr/local").
If you want to do it in a particular recipe, then just assigning prefix="/usr/local" and exec_prefix="/usr/local" in the recipe will work.
These variables are defined in meta/conf/bitbake.conf, where you can see that bindir is $exec_prefix/bin, which is probably why assigning prefix didn't work for you.
Your first strategy was on the right track, but you were clobbering more than you wanted by changing only "prefix". If you look in sources/poky/meta/conf/bitbake.conf you'll find everything you are clobbering when you set the variable "prefix" to something other than "/usr" (like it was in my case). In order to modify only the install path with what would manually be the "--prefix" option to configure, I needed to set all the variables listed here in that recipe:
prefix="/your/install/path/here"
datadir="/usr/share"
sharedstatedir="/usr/com"
exec_prefix="/usr"

How to disable debug optimization in eclipse cdt

I want to stop debug optimization in eclipse cdt and I read article about this
http://husks.wordpress.com/2012/03/29/hardware-debugging-the-arduino-using-eclipse-and-the-avr-dragon/
it supposed to see tool setting in eclipse indigo but I didn't see it.
what is the problem
see this for more info
https://sourceforge.net/projects/cmusphinx/forums/forum/5471/topic/5170910
this is my make file
TOP=../../..
DIRNAME=src/programs/init_gau
BUILD_DIRS =
ALL_DIRS= $(BUILD_DIRS)
SRCS = \
accum.c \
init_gau.c \
main.c \
parse_cmd_ln.c
H = \
accum.h \
init_gau.h \
mk_sseq.h \
parse_cmd_ln.h
FILES = Makefile $(SRCS) $(H)
TARGET = init_gau
ALL = $(BINDIR)/$(TARGET)
include $(TOP)/config/common_make_rules
I found this config file
# -*- makefile -*-
#
# This file is automatically generated by configure.
# Do not hand edit.
CC = gcc
CFLAGS = -g -O0 -Wall -fPIC -DPIC
CPPFLAGS = -I/media/sda5/sphinx/tutorial/SphinxTrain/../sphinxbase/include -I/media/sda5/sphinx/tutorial/SphinxTrain/../sphinxbase/include
DEFS = -DPACKAGE_NAME=\"SphinxTrain\" -DPACKAGE_TARNAME=\"sphinxtrain\" -DPACKAGE_VERSION=\"1.0.99\" -DPACKAGE_STRING=\"SphinxTrain\ 1.0.99\" -DPACKAGE_BUGREPORT=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_LIBM=1
LIBS = -lm -lsphinxbase
LDFLAGS = -L/media/sda5/sphinx/tutorial/SphinxTrain/../sphinxbase/src/libsphinxad -L/media/sda5/sphinx/tutorial/SphinxTrain/../sphinxbase/src/libsphinxbase -L/media/sda5/sphinx/tutorial/SphinxTrain/../sphinxbase/src/libsphinxbase/.libs
AR = ar
RANLIB = ranlib
FESTIVAL = /usr/bin/festival
PERL = /usr/bin/perl
The options are under project properties as explained in first tutorial. If you are trying to build a project with existing makefile, then you need to edit the makefile.
You dont typiclly need to change project properties. Debug configuration builds without optimization by default. You just need to make sure you jave it selected. This is done using the icon (sundial? - the one next to CDT's build (hammer)).