Controlling architecture in resulting RPM's - yocto

I am trying to build all the recipes I made for my target architecture for my host systems architecture (x86_64), with the intention of being able to install these RPM's in x86_64 environments.
To do this I simply set MACHINE=genericx86-64 and build; however, the resulting RPM's seem to have their architecture set to core2_64. I guess it is related to the TUNE_FEATURES="m64 core2" reported when running bitbake (see below).
How can I make sure that these RPM's end up as x86_64 so that my host (RHEL7) accepts them?
Build Configuration:
BB_VERSION = "1.34.0"
BUILD_SYS = "x86_64-linux"
NATIVELSBSTRING = "universal-4.8"
TARGET_SYS = "x86_64-poky-linux"
MACHINE = "genericx86-64"
DISTRO = "generic-panel"
DISTRO_VERSION = "0.7"
TUNE_FEATURES = "m64 core2"
TARGET_FPU = ""
Example
# rpm -i xxx.core2_64.rpm
package xxx.core2_64 is intended for a different architecture
$ uname -a
Linux localhost 3.10.0-693.2.2.el7.x86_64 #1 SMP Sat Sep 9 03:55:24 EDT 2017 x86_64 x86_64 x86_64 GNU/Linux

The solution was to modify the DEFAULTTUNE variable, so i just added DEFAULTTUNE_genericx86-64 = "x86-64" to my local.conf.

Related

Rust recipe depends on library from other recipe

I am trying to generate a package from a Bitbake recipe for Raspberry Pi:
inherit cargo
SUMMARY = "myapp"
DESCRIPTION = "Compile and configure myapp"
LICENSE = "CLOSED"
HOMEPAGE = "git://git.myserver.com:myapp/myapp.git"
DEPENDS = "openssl postgresql"
SRC_URI = "git://git.myserver.com/myapp/myapp.git;protocol=https;user=myuser:mypass;tag=v${PV}"
SRC_URI[sha256sum] = "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"
S = "${WORKDIR}/git"
The program I am compiling depends on the PostgreSQL library libpq which is generated by the postgresql package. My problem is that the linker cannot find libpq, even been in DEPENDS.
The output error is:
...
"-Wl,--end-group" "/home/yocto-image/build/tmp/work/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/myapp/0.0.1-r0/recipe-sysroot-native/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-e2523c360f03ba10.rlib" "-Wl,-Bdynamic" "-lpq" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc"
| = note: /home/yocto-image/build/tmp/hosttools/ld: cannot find -lpq
| collect2: error: ld returned 1 exit status
|
|
| error: aborting due to previous error
|
...
Finally found the solution. I was cross-compiling the code in a Ubuntu x86_64 PC. The library was necessary for the compiling machine not for the target machine (Raspberry Pi). The solution is just to install the libraries needed in Ubuntu:
sudo apt-get install libpq-dev

How to solve "no such file or directory" when trying to run aarch64-gnu-linux-g++ (64-bit version) on 64-bit Ubuntu Linux O/S?

The title I think says it all. Originally I though it might be a 64-bit program running on a 32-bit O/S - not the case as far as I can see.
yoctoadm#kickseed:/ntg6src/source/packages/sdk_armv8/sysroots/x86_64-oesdk-linux/usr/bin/aarch64-gnu-linux$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.6 LTS
Release: 16.04
Codename: xenial
// uname -a output
yoctoadm#kickseed:/ntg6src/source/packages/sdk_armv8/sysroots/x86_64-oesdk-linux/usr/bin/aarch64-gnu-linux$ uname -a
Linux kickseed 4.4.0-165-generic #193-Ubuntu SMP Tue Sep 17 17:42:52 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
// file aarch64-gnu-linux-g++ output
yoctoadm#kickseed:/ntg6src/source/packages/sdk_armv8/sysroots/x86_64-oesdk-linux/usr/bin/aarch64-gnu-linux$ file aarch64-gnu-linux-g++
aarch64-gnu-linux-g++: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /ntg6sdk, for GNU/Linux 2.6.32, BuildID[sha1]=0bc9f03b2a2bee373f6ec3c85527230243579763, stripped
// no such file or directory error
yoctoadm#kickseed:/ntg6src/source/packages/sdk_armv8/sysroots/x86_64-oesdk-linux/usr/bin/aarch64-gnu-linux$ ls
aarch64-gnu-linux-addr2line aarch64-gnu-linux-dwp aarch64-gnu-linux-gcc-nm aarch64-gnu-linux-gdb aarch64-gnu-linux-nm aarch64-gnu-linux-size
aarch64-gnu-linux-ar aarch64-gnu-linux-elfedit aarch64-gnu-linux-gcc-ranlib aarch64-gnu-linux-gprof aarch64-gnu-linux-objcopy aarch64-gnu-linux-strings
aarch64-gnu-linux-as aarch64-gnu-linux-g++ aarch64-gnu-linux-gcov aarch64-gnu-linux-ld aarch64-gnu-linux-objdump aarch64-gnu-linux-strip
aarch64-gnu-linux-c++filt aarch64-gnu-linux-gcc aarch64-gnu-linux-gcov-dump aarch64-gnu-linux-ld.bfd aarch64-gnu-linux-ranlib
aarch64-gnu-linux-cpp aarch64-gnu-linux-gcc-ar aarch64-gnu-linux-gcov-tool aarch64-gnu-linux-ld.gold aarch64-gnu-linux-readelf
yoctoadm#kickseed:/ntg6src/source/packages/sdk_armv8/sysroots/x86_64-oesdk-linux/usr/bin/aarch64-gnu-linux$ ./aarch64-gnu-linux-g++
bash: ./aarch64-gnu-linux-g++: No such file or directory
The environment variables weren't setup correctly. It was necessary to "source" the environment file, which exports the correct environment variables.

Error on building Openembedded for Intel Quark

Trying to build Linux for Advantech UBC-221 that has Intel Quark processor.
The system is Debian 9, running on VMware. Was able to build poky succefully before.
Let me summarize what I was doing:
mkdir quark
cd quark
git clone git://git.yoctoproject.org/meta-intel-quark
git clone git://git.openembedded.org/openembedded-core
git clone git://git.yoctoproject.org/poky
cp -r poky/bitbake .
cd openembedded-core
source oe-init-build-env
bitbake-layers add-layer ~/quark/meta-intel-quark/
bitbake core-image-base
Error code I get:
WARNING: Layer quark-bsp should set LAYERSERIES_COMPAT_quark-bsp in its conf/layer.conf file to list the core layer names it is compatible with.
WARNING: Layer quark-bsp should set LAYERSERIES_COMPAT_quark-bsp in its conf/layer.conf file to list the core layer names it is compatible with.
WARNING: /home/bgabor/quark/meta-intel-quark/recipes-kernel/linux/linux-yocto-quark_3.8.bb: Variable key RDEPENDS_${KERNEL_PACKAGE_NAME}-base (${KERNEL_PACKAGE_NAME}-image) replaces original key RDEPENDS_kernel-base ().
WARNING: /home/bgabor/quark/meta-intel-quark/recipes-bsp/grub/grub_0.97.bb: Exception during build_dependencies for CFLAGS
WARNING: /home/bgabor/quark/meta-intel-quark/recipes-bsp/grub/grub_0.97.bb: Error during finalise of /home/bgabor/quark/meta-intel-quark/recipes-bsp/grub/grub_0.97.bb
ERROR: ExpansionError during parsing /home/bgabor/quark/meta-intel-quark/recipes-bsp/grub/grub_0.97.bb
Traceback (most recent call last):
bb.data_smart.ExpansionError: Failure expanding variable CFLAGS, expression was -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map=/home/bgabor/quark/openembedded-core/build/tmp-glibc/work/i586-oe-linux/grub/0.97+gitAUTOINC+5775f32a62-r0=/usr/src/debug/grub/0.97+gitAUTOINC+5775f32a62-r0 -fdebug-prefix-map=/home/bgabor/quark/openembedded-core/build/tmp-glibc/work/i586-oe-linux/grub/0.97+gitAUTOINC+5775f32a62-r0/recipe-sysroot= -fdebug-prefix-map=/home/bgabor/quark/openembedded-core/build/tmp-glibc/work/i586-oe-linux/grub/0.97+gitAUTOINC+5775f32a62-r0/recipe-sysroot-native= -Os -fno-strict-aliasing -Wall -Werror -Wno-shadow -Wno-unused -Wno-pointer-sign -DINTEL_QUARK_TEST=${#base_contains('PACKAGECONFIG', 'grub_test', '1', '0', d)} which triggered exception NameError: name 'base_contains' is not defined
Summary: There were 5 WARNING messages shown.
Summary: There was 1 ERROR message shown, returning a non-zero exit code.
I'm pretty much stuck here. Some help would be greatly appreciated!
Edit:
Tried to build on Debian 7.11 32 bit system. It went better however another error came:
bgabor#debian:~/quark/dizzy/build$ bitbake core-image-base
WARNING: Host distribution "Debian-7.11" has not been validated with this version of the build system; you may possibly experience unexpected failures. It is recommended that you use a tested distribution.
Loading cache: 100% |####################################################################################################################################################| ETA: 00:00:00
Loaded 1292 entries from dependency cache.
NOTE: Resolving any missing task queue dependencies
Build Configuration:
BB_VERSION = "1.24.0"
BUILD_SYS = "i686-linux"
NATIVELSBSTRING = "Debian-7.11"
TARGET_SYS = "i586-poky-linux"
MACHINE = "quark"
DISTRO = "poky"
DISTRO_VERSION = "1.7.3"
TUNE_FEATURES = "m32 i586"
TARGET_FPU = ""
meta
meta-yocto
meta-yocto-bsp = "dizzy:58863ad092c9a279e305c841dbb4353de2ecfae8"
meta-intel-quark = "master:a314f0ceea986fde42d5d9b0ea449f7a563e9351"
NOTE: Preparing runqueue
NOTE: Executing SetScene Tasks
NOTE: Executing RunQueue Tasks
ERROR: Unable to install packages. Command '/home/bgabor/quark/dizzy/build/tmp/sysroots/i686-linux/usr/bin/smart --quiet --data-dir=/home/bgabor/quark/dizzy/build/tmp/work/quark-poky-linux/core-image-minimal-initramfs/1.0-r0/rootfs/var/lib/smart install -y busybox#i586 initramfs-live-install-efi#i586 run-postinsts#all initramfs-live-install#i586 udev#i586 initramfs-live-boot#quark base-passwd#i586' returned 1:
error: Can't install initramfs-live-install-1.0-r9#i586: no package provides grub
ERROR: Function failed: do_rootfs
ERROR: Logfile of failure stored in: /home/bgabor/quark/dizzy/build/tmp/work/quark-poky-linux/core-image-minimal-initramfs/1.0-r0/temp/log.do_rootfs.29435
ERROR: Task 240 (/home/bgabor/quark/dizzy/meta/recipes-core/images/core-image-minimal-initramfs.bb, do_rootfs) failed with exit code '1'
NOTE: Tasks Summary: Attempted 2529 tasks of which 2527 didn't need to be rerun and 1 failed.
No currently running tasks (2435 of 2531)
Summary: 1 task failed:
/home/bgabor/quark/dizzy/meta/recipes-core/images/core-image-minimal-initramfs.bb, do_rootfs
Summary: There was 1 WARNING message shown.
Summary: There were 2 ERROR messages shown, returning a non-zero exit code.
It does not find grub package, however I can see there are two in the recipes:
bgabor#debian:~/quark/dizzy/build$ bitbake-layers show-recipes | grep "grub" -A 3
Parsing recipes..done.
grub:
meta-intel-quark 0.97+gitAUTOINC+5775f32a62
meta 0.97
meta 2.00
--
grub-conf:
meta-intel-quark 1.0
grub-efi:
meta 2.00
gsettings-desktop-schemas:
meta 3.10.1
Tried to clean and then bitbake again but no result.
What might be the problem here?
First, Poky includes OpenEmbedded Core so you don't need to clone both, just clone Poky.
Second, the meta-intel-iot layer is pretty dead and only formally supports the Daisy release of Poky (see the README). You may have luck using newer releases, but obviously not git master (aka Thud).
https://wiki.yoctoproject.org/wiki/Releases lists the releases. Instead of checking out master of Poky, check out the relevant release branch. I suggest starting with daisy but trying something a little newer such as jethro would be a good idea.

Ubuntu error: "filename" cannot execute binary file

I am working on matlab R2013a on Ubuntu. I am referring this code:
sift_bin = fullfile('lib/sift/bin/siftfeat');
[pf,nf,ef] = fileparts(filename);
desc_file = [fullfile(pf,nf) '.txt'];
im1=imread(filename);
if (size(im1,1)<=1000 && size(im1,2)<=1000)
status1 = system([sift_bin ' -x -o ' desc_file ' ' filename]);
else
status1 = system([sift_bin ' -d -x -o ' desc_file ' ' filename]);
end
But it gives an error:
lib/sift/bin/siftfeat cannot execute binary file
Is there anything wrong with system call?
lib/sift/bin/siftfeat is a path of sift library.
Use file utility to make sure that file is an executable and see its architecture
system('file /bin/ls')
/bin/ls: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked
(uses shared libs), for GNU/Linux 2.6.24,
BuildID[sha1]=0xf31e99218b4d7034cf8257055686bca22f5a3c01, stripped
ans = 0
Then uname -a shows architecture of your system
system('uname -a')
Linux optiPlex7010 3.8.0-35-generic #50-Ubuntu SMP Tue Dec 3 01:24:59 UTC 2013
x86_64 x86_64 x86_64 GNU/Linux
ans = 0
As one can see I have 64-bit Linux and executable is also 64-bit. However, when it comes to 32-bit systems and executable support is backward compatible. That means 64-bit system may execute both 32-bit and 64-bit executables, but 32-bit system can execute only 32-bit executables.
From your comments I see that you are trying to launch 64-bit executable in 32-bit system, which is not capable of doing that. You should find 32-bit version of siftfeat or change your OS to 64-bit, if that is possible.

Schrödinger's file

I am puzzled by the following sequence of commands.
sh-4.2$ pwd
/home/willard
sh-4.2$ ls -l f
-rwxr-xr-x 1 willard users 59116 Jan 23 14:54 f
sh-4.2$ file f
f: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, BuildID[sha1]=0xea0e08ff2b5a062698d45b78177acdd6bf140d1f, stripped
sh-4.2$ ./f
sh: ./f: No such file or directory
sh-4.2$ strace ./f
execve("./f", ["./f"], [/* 32 vars */]) = -1 ENOENT (No such file or directory)
write(2, "strace: exec: No such file or di"..., 40strace: exec: No such file or directory
) = 40
exit_group(1) = ?
+++ exited with 1 +++
sh-4.2$ ls -l f
-rwxr-xr-x 1 willard users 59116 Jan 23 14:54 f
sh-4.2$ uname -a
Linux xdat10 3.6.2-1-ARCH #1 SMP PREEMPT Fri Oct 12 23:58:58 CEST 2012 x86_64 GNU/Linux
How is this possible?
I found someone having the same problem (with relative explanation)
Running 32bit binary on a 64bit system
Quoting the most important sentences:
This situation often arises when you try to run a binary for the right
system (or family of systems) and superarchitecture but the wrong
subarchitecture. Here you have ELF binaries on a system that expects
ELF binaries, so the kernel loads them just fine. They are i386
binaries running on an x86_64 processor, so the instructions make
sense and get the program to the point where it can look for its
loader. But the program is a 32-bit program (as the file output
indicates), looking for the 32-bit loader /lib/ld-linux.so.2, and
you've presumably only installed the 64-bit loader
/lib64/ld-linux-x86-64.so.2 in the chroot.
You need to install the 32-bit runtime system in the chroot: the
loader, and all the libraries the programs need. On Debian amd64, the
32-bit loader is in the libc6-i386 package. You can install a bigger
set of 32-bit libraries by installing ia32-libs.
I bet there's a better way to verify this but i'd try to exec
ldd ./f
and search in the output which loader is needed to exec'it
man 2 execve:
ENOENT The file filename or a script or ELF interpreter does not
exist, or a shared library needed for file or interpreter can‐
not be found.
You could run ldd against this binary to look for libraries that could not be mapped and install them from multilib.