Update variables within makefile label - linux

I have C++ static libraries and executable that uses them, each one is in a seperate folder. Each such project can be built in Debug or Release configuration, when the files hierarchy is like the following:
Static_Lib1\Debug\staticlib1.a
Static_Lib1\Release\staticlib1.a
//same for all other static libraries
Executable\Debug\executable
Executable\Release\executable
All Debug and Release folders contain makefiles.
I'm trying to write an external makefile to call each one of the internal projects, using the selected configuration - debug or release.
So, I tried something like:
CFG= #empty declaration
PROJECTS=Static_Lib1 Static_Lib2 ... Executable
all:
release #default config is release
release:
CFG = Release
make build-all
debug:
CFG = Debug
make build-all
build-all:
make clean
$(foreach projectName, $(PROJECTS), cd $(projectName)/$(CFG) && make all;)
But I get this output when trying, for example, to run make debug:
CFG = Debug
make: CFG: Command not found
make: *** [debug] Error 127
How can I fix this?
My OS is SLED 11x64.
Thank you in advance!

Change it to:
...
release:
make CFG=Release build-all
debug:
make CFG=Debug build-all
...

Related

snapcraft cannot pull from source

I am trying to build a snap package. Whenever I run snapcraft I keep getting this error:
Failed to pull source: './local/my-app.zip'.
Please ensure the source path is correct and that it is accessible.
See "snapcraft help sources" for more information.
This is the source from my snapcraft.yaml:
parts:
my-part:
# See 'snapcraft plugins'
source: "./local/my-app.zip"
plugin: dump
And this is the result of ls local in the "snap" folder:
salihu#penguin:~/my-app/dist/my-apps/my-app-snap/snap$ ls local
my-app.zip
You don't need to include the "./" part of the path. It seems to throw things off. Should work with this:
parts:
my-part:
# See 'snapcraft plugins'
source: local/my-app.zip
plugin: dump

Hyperledger Fabric Nix Derivation

I'm trying to build a nix derivation for the Hyperledger Fabric project.
source root is source
with import <nixpkgs> {};
stdenv.mkDerivation {
name = "hyperledger-fabric";
src = builtins.fetchGit {
url = "https://github.com/hyperledger/fabric";
rev = "d0eaa0646fc83bf17066a82f54b3c99370914a02";
};
depsBuildBuild = [curl which git];
nativeBuildInputs = [go docker];
}
when running nix-build fabric.nix I receive:
nix-build fabric.nix
these derivations will be built:
/nix/store/8z0wlnf8897ng5wkfjja66m31fafsqyp-hyperledger-fabric.drv
building '/nix/store/8z0wlnf8897ng5wkfjja66m31fafsqyp-hyperledger-fabric.drv'...
unpacking sources
unpacking source archive /nix/store/q4mq48i1f7sp7d8f3n8w6q8kp053h9ny-source
source root is source
patching sources
configuring
no configure script, doing nothing
building
build flags: SHELL=/nix/store/n9hba031gjky8hpjgx9fnlaxhidyzxbz-bash-4.4-p23/bin/bash
gotools.mk:22: *** target pattern contains no '%'. Stop.
builder for '/nix/store/8z0wlnf8897ng5wkfjja66m31fafsqyp-hyperledger-fabric.drv' failed with exit code 2
error: build of '/nix/store/8z0wlnf8897ng5wkfjja66m31fafsqyp-hyperledger-fabric.drv' failed
The error points to https://github.com/hyperledger/fabric/blob/release-1.4/gotools.mk#L22
Do I need to set environment variables or what is causing the problem ?
Solved by use of buildGoPackage, see https://github.com/NixOS/nixpkgs/pull/52551

How to put an extra file in the kernel image by yocto

I have a trouble of putting my initramfs.cpio in my kernel image by yocto.
I have two bb files, one is used to build an initramfs, and the other one is used to build a fitimage.
I successful to build the fitimage bundled with my initramfs image.
But it always failed to build a fitImage that has an initramfs.cpio.gz in the /usr directory in the fitImage.
( I mean, I want to see a file named initramfs.cpio in the /usr when I use my fitImage booting to console )
====================================================================
Here are my error message..
ERROR: linux-mine-1_4.9.27+gitAUTOINC+d87116e608-r0 do_package: QA Issue: linux-mine: Files/directories were installed but not shipped in any package:
/usr
/usr/initramfs-mine-qemu.cpio
Please set FILES such that these items are packaged. Alternatively if they are unneeded, avoid installing them or delete them within do_install.
linux-mine: 2 installed and not shipped files. [installed-vs-shipped]
ERROR: linux-mine-1_4.9.27+gitAUTOINC+d87116e608-r0 do_package: Fatal QA errors found, failing task.
ERROR: linux-mine-1_4.9.27+gitAUTOINC+d87116e608-r0 do_package: Function failed: do_package
ERROR: Logfile of failure stored in: /home/paul/projects/Test/yocto/build/tmp/work/mine-poky-linux-gnueabi/linux-mine/1_4.9.27+gitAUTOINC+d87116e608-r0/temp/log.do_package.26149
ERROR: Task (/home/paul/projects/Test/yocto/yocto-2.2/poky/../meta-mine/recipes-kernel/linux/linux-mine_4.9.bb:do_package) failed with exit code '1'
====================================================================
Here is my kernel image bb file
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}-${PV}:"
LINUX_VERSION ?= "4.9.27"
SRCREV = "d87116e608e94ad684b5e94d46c892e33b9e2d78"
SRC_URI = "git://local/kernel;protocol=ssh;branch=master"
#FILES_${PN} += "/usr /usr/initramfs-mine-${MACHINE_ARCH}.cpio"
#FILES_${PN}-${PV} += "/usr /usr/initramfs-mine-${MACHINE_ARCH}.cpio"
#IMAGE_INSTALL = "initramfs-mine"
do_install_append () {
echo "WangPaul : S=[${S}]"
echo "WangPaul : B=[${B}]"
echo "WangPaul : D=[${D}]"
install -d ${D}/usr/
install -m 0444 ${B}/usr/initramfs-mine-${MACHINE_ARCH}.cpio ${D}/usr/
}
====================================================================
Here is my initramfs bb file
LICENSE = "GPLv2"
PACKAGE_INSTALL = "initramfs-live-boot ${VIRTUAL-RUNTIME_base-utils} udev ${ROOTFS_BOOTSTRAP_INSTALL}"
IMAGE_FSTYPES = "${INITRAMFS_FSTYPES}"
inherit core-image
====================================================================
I have found similar questions:
Ship extra files in kernel module recipe and
An example of using FILES_${PN}
The way in aboves discussion are not work...
Any information would be appreciate !!
Thanks !!
The error seems to QA issues it means the source is compiled but not adding to rootfs. Add below line to yourkernel-image.bb. it will solve the issue.
FILES_${PN} += "${exec_prefix}/*"
Note: may be In your kernel.bb file you have given wrong format

Yocto do_package_qa hangs for bin_package nodejs recipe

Using Yocto morty, I'm trying to add a prebuilt version of nodejs in my distribution. When I bitbake core-image-sato, do_package_qa hangs for hours. I'd be grateful for your help in getting me past this issue.
I've added this to the bottom of local.conf:
CORE_IMAGE_EXTRA_INSTALL += "mynode"
This is my recipe for mynode:
SUMMARY = "puts the node.js binary distribution into my image"
SECTION = "base"
LICENSE = "MIT & BSD & Artistic-2.0"
LIC_FILES_CHKSUM = "file://usr/node-v7.10.0-linux-x64/LICENSE;md5=d29463feca32ea5977af7b6c7d62c14a"
SRC_URI = "https://nodejs.org/dist/v7.10.0/node-v7.10.0-linux-x64.tar.xz;subdir=usr"
SRC_URI[md5sum] = "b9122f212e0716d199d7e954ff81e1ec"
SRC_URI[sha256sum] = "6166b9f3fb1a9e861335d864688fee5366f040db808080856a1a2b71b6019786"
S = "${WORKDIR}"
inherit bin_package
This is the content of log.do_install for my nodejs package. Maybe the message from tar describes my problem somehow?
DEBUG: Executing shell function do_install
tar: ./pseudo/pseudo.socket: socket ignored
DEBUG: Shell function do_install finished
There doesn't appear to be anything useful in log.do_package_qa for my nodejs package, but maybe somebody will see something that I don't see:
DEBUG: Executing python function sstate_task_prefunc
DEBUG: Python function sstate_task_prefunc finished
DEBUG: Executing python function do_package_qa
NOTE: DO PACKAGE QA
DEBUG: Executing python function read_subpackage_metadata
DEBUG: Python function read_subpackage_metadata finished
NOTE: Checking Package: mynode-dev
NOTE: Checking Package: mynode
I see a few bitbake-worker processes running, one with argument decafbad, two with argument decafbadbeef. I also see a pseudo process running.
If you're going to use
subdir=usr
At the end of SRC_URI then you also need to change the source directory it uses (S) accordingly:
S = "${WORKDIR}/usr"
In addition, I think for all pre-built binary packages (inherit bin_package), you want to do it that way. I tried without either and it hung forever. Also, you may want to use a subdir name that nothing else uses, like say external_binary. That way each binary recipe can use the same subdir.

How to use Scons to compile same objects in different environments with Glob?

I have a C++ project builds with Scons. At first I have only the optimized version to compile, it works fine. Then I also need a debug version, then I add another environment for it. Here is the Scons code:
env = Environment()
opt = env.Clone(CCFLAGS=['-pthread', '-O3', '-Wall'])
opt_objs = opt.Glob('src/*.cpp')
prog = opt.Program('prog', opt_objs)
dbg = env.Clone(CCFLAGS=['-pthread', '-Wall', '-g', '-O0'])
dbg_objs = dbg.Glob('src/*.cpp')
dbg_prog = dbg.Program('dbg_prog', dbg_objs)
With this code, I ran into error:
scons: *** Two environments with different actions were specified for the same target:
src/CometReadService.o
As you can see, those .o files targets created by opt.Glob('src/.cpp') and dbg.Glob('src/.cpp') exactly same name. By reading the document Multiple Construction Environments I know I can rename the object like "opt.Object('xxx-opt', 'xxx.c')", but however, it is Glob not Object. How can I solve this problem?
The scons manual describes how to use the VariantDir function (or argument when adding SConscripts) to set up different build directories. At its simplest, VariantDir separates the build output from the source files, but it can also be used to separate the build output of different environments.
env = Environment()
opt = env.Clone(CCFLAGS=['-pthread', '-O3', '-Wall'])
opt.VariantDir('gen-opt', 'src', duplicate=0)
opt_objs = opt.Glob('gen-opt/*.cpp')
prog = opt.Program('prog', opt_objs)
dbg = env.Clone(CCFLAGS=['-pthread', '-Wall', '-g', '-O0'])
dbg.VariantDir('gen-dbg', 'src', duplicate=0)
dbg_objs = dbg.Glob('gen-dbg/*.cpp')
dbg_prog = dbg.Program('dbg_prog', dbg_objs)
Using VariantDir can take some experimentation. For instance, note that the Glob argument has changed -- without the duplicate=0 parameter, the default behavior is for VariantDir to duplicate the source files in the build directory.

Resources