Intel MIC offload pragma error - intel

What's this error? Couldn't find anything useful googling* about it :/
error: this pragma must immediately precede a statement
#pragma offload target(mic) \
^
Edit 1:
This is my pragma:
#pragma offload target(mic) \
in (v1: length(B)) \
in (v2, v3: length(A) \
inout(v4, v5, v6: length(A))

Related

Cosmos DB emulator installation on Mac

ipaddr="`ifconfig | grep "inet " | grep -Fv 127.0.0.1 | awk '{print $2}' | head -n 1`"
docker pull mcr.microsoft.com/cosmosdb/linux/azure-cosmos-emulator
docker run \
--publish 8081:8081 \
--publish 10250-10255:10250-10255 \
--memory 3g --cpus=2.0 \
--name=test-linux-emulator1 \
--env AZURE_COSMOS_EMULATOR_PARTITION_COUNT=10 \
--env AZURE_COSMOS_EMULATOR_ENABLE_DATA_PERSISTENCE=true \
--env AZURE_COSMOS_EMULATOR_IP_ADDRESS_OVERRIDE=$ipaddr \
--interactive \
--tty \
mcr.microsoft.com/cosmosdb/linux/azure-cosmos-emulator
I followed these steps but getting this error
./cosmosdb-emulator: ERROR: Invalid mapping of address 0x40037db000 in reserved address space below 0x400000000000. Possible causes:
1) the process (itself, or via a wrapper) starts-up its own running environment sets the stack size limit to unlimited via syscall setrlimit(2);
2) the process (itself, or via a wrapper) adjusts its own execution domain and flag the system its legacy personality via syscall personality(2);
3) sysadmin deliberately sets the system to run on legacy VA layout mode by adjusting a sysctl knob vm.legacy_va_layout.
Mac Chip: Apple M1 Pro
From the official doc,
The emulator only supports MacBooks with Intel processors.
The Apple M1 Pro you are using is not supported by the emulator

How do you include bluetooth in a yocto linux system

Does any know of any good instructions explaining how to implement bluetooth into a yocto build.
I've added bluetooth into the MACHINE variable within the machine.conf and bluez to CORE_IMAGE_EXTRA_INSTALL in the local.conf located in my build directory. After building a new image, bluetoothd won't start because this condition is not met ConditionPathIsDirectory=/sys/class/bluetooth which is correct because that location doesn't exist on my system.
I'm new to yocto so any guidance would be greatly appreciated.
EDIT
So the /conf/bblayers has the following content:
BBLAYERS ?= " \
${BSPDIR}/poky/meta \
${BSPDIR}/poky/meta-poky \
${BSPDIR}/poky/meta-yocto-bsp \
${BSPDIR}/meta-atmel \
${BSPDIR}/meta-openembedded/meta-oe \
${BSPDIR}/meta-openembedded/meta-networking \
${BSPDIR}/meta-openembedded/meta-python \
${BSPDIR}/meta-openembedded/meta-multimedia \
${BSPDIR}/meta-swupdate \
${BSPDIR}/meta-custom \
${BSPDIR}/meta-openembedded/meta-initramfs \
The local.conf contains:
CORE_IMAGE_EXTRA_INSTALL += "\
bluez5 \
rpm \
valgrind \
"
DISTRO_FEATURES_append = " systemd bluetooth"
DISTRO_FEATURES_BACKFILL_CONSIDERED += "sysvinit"
VIRTUAL-RUNTIME_init_manager = "systemd"
VURTUAL-RUNTIME_initscripts = "systemd-compat-units"
The .inc file in my custom layer contains:
#IMAGE_FEATURES += "ssh-server-openssh package-management"
IMAGE_INSTALL = "\
packagegroup-core-boot \
packagegroup-core-full-cmdline \
packagegroup-base-bluetooth \
kernel-modules \
libgpiod \
ntp \
sqlite3 \
openssl \
mtd-utils \
${CORE_IMAGE_EXTRA_INSTALL} \
"
inherit core-image
The machine conf file contains:
MACHINE_FEATURES = "apm ext2 ext3 pcmcia usbhost usbgadget"
Running
bitbake -e packagegroup-base | grep ^ADD_BT
Returns
ADD_BT="packagegroup-base-bluetooth"
bitbake -e <image-name> | grep ^IMAGE_INSTALL=
Returns
IMAGE_INSTALL=" packagegroup-core-boot packagegroup-core-full-cmdline packagegroup-base-bluetooth kernel-modules libgpiod ntp sqlite3 openssl mtd-utils apg-st-databases bluez5 rpm valgrind "
bitbake -e packagegroup-base-extended | grep ^RDEPENDS_packagegroup-base-extended=
returns
RDEPENDS_packagegroup-base-extended=" packagegroup-base packagegroup-base-wifi packagegroup-base-bluetooth "
First of all, MACHINE is dedicated to have one value which is the configuration file for your board, and you can not add bluetooth to it.
Yocto has an automatic bluetooth feature that handles adding bluetooth into your build. But it only there for boards that have a builtin bluetooth module.
For more info, check the machine features in the official Yocto doc here.
Let me now explain how bluetooth is integrated:
Basically, you only need some kernel defconfig configuration and bluez5 utility.
If you add the following line to local.conf or your custom machine file:
DISTRO_FEATURES_append = " bluetooth"
it will take effect if you build image that is based on core-image class, like core-image-minimal, because it contains a packagegroup-base-bluetooth as follows:
SUMMARY_packagegroup-base-bluetooth = "Bluetooth support"
RDEPENDS_packagegroup-base-bluetooth = "\
bluez5 \
"
RRECOMMENDS_packagegroup-base-bluetooth = "\
kernel-module-bluetooth \
kernel-module-l2cap \
kernel-module-rfcomm \
kernel-module-hci-vhci \
kernel-module-bnep \
kernel-module-hidp \
kernel-module-hci-uart \
kernel-module-sco \
${#bb.utils.contains('COMBINED_FEATURES', 'usbhost', 'kernel-module-hci-usb', '',d)} \
${#bb.utils.contains('COMBINED_FEATURES', 'pcmcia', 'kernel-module-bluetooth3c-cs', '',d)} \
${#bb.utils.contains('COMBINED_FEATURES', 'pcmcia', 'kernel-module-bluecard-cs', '',d)} \
${#bb.utils.contains('COMBINED_FEATURES', 'pcmcia', 'kernel-module-bluetoothuart-cs', '',d)} \
${#bb.utils.contains('COMBINED_FEATURES', 'pcmcia', 'kernel-module-dtl1-cs', '',d)} \
"
It will add packagegroup-base-bluetooth only in two conditions:
If bluetooth in DISTRO_FEATRUES and not in MACHINE_FEATURES and one of (pcmcia, pci or usbhost) in MACHINE_FEATURES
If bluetooth in COMBINED_FEATURES.
For more info on COMBINED_FEATURES check this link.
So, you just need to make true one of the conditions.
You can dig in more to understand more details, check:
poky/meta/classes/core-image.bbclass
poky/meta/recipes-core/packagegroups/packagegroup-base.bb
NOTE
If your bluetooth module has a dedicated kernel driver for example, you need to activate it in the kernel configuration via a fragment file.
Or create a module recipe for it.
EDIT
In order to add bluetooth just:
DISTRO_FEATURES_append = " bluetooth"
after that, you can check that bluetooth package is added. Here are details:
packagegroup-base-extended is always added to images based on core-image.bbclass and here is its content:
RDEPENDS_packagegroup-base-extended = "\
packagegroup-base \
${ADD_WIFI} \
${ADD_BT} \
${ADD_3G} \
${ADD_NFC} \
"
You see the ADD_BT variable? It is by default empty, and it is filled with packagegroup-base-bluetooth only if the first condition is true, and here is the detail from the recipe:
if "bluetooth" in distro_features and not "bluetooth" in machine_features and ("pcmcia" in machine_features or "pci" in machine_features or "usbhost" in machine_features):
d.setVar("ADD_BT", "packagegroup-base-bluetooth")
Now, to check that it is added, run:
bitbake -e packagegroup-base | grep ^ADD_BT
you should see: ADD_BT="packagegroup-base-bluetooth"
Also, you can check that packagegroup-base-extended is added to your image:
bitbake -e <your_image> | grep ^IMAGE_INSTALL=
Also, you can check if packagegroup-base-extended has packaged bluetooth package with it:
bitbake -e packagegroup-base-extended | grep ^RDEPENDS_packagegroup-base-extended=
EDIT2:
Your configuration looks okay, specially when packagegroup-base-bluetooth is shipped with in IMAGE_INSTALL.
I have some comments that you need to consider anyways:
local.conf:
Remove bluez5 from CORE_IMAGE_EXTRA_INSTALL
Change:
DISTRO_FEATURES_append = " systemd bluetooth"
DISTRO_FEATURES_BACKFILL_CONSIDERED += "sysvinit"
VIRTUAL-RUNTIME_init_manager = "systemd"
VURTUAL-RUNTIME_initscripts = "systemd-compat-units"
with:
INIT_MANAGER = "systemd"
DISTRO_FEATURES_append = " bluetooth"
In your custom image file:
Put inherit core-image before IMAGE_INSTALL, because IMAGE_INSTALL of core-image will not take effect because it is ?=. So:
inherit core-image
IMAGE_INSTALL += "\
packagegroup-core-full-cmdline \
kernel-modules \
libgpiod \
ntp \
sqlite3 \
openssl \
mtd-utils \
"
Now, the only part that mention bluetooth is :
DISTRO_FEATURES_append = " bluetooth"
Now, check again for the variable tests.
This is not as simple as adding bluetooth as a DISTRO_FEATURE. Adding this only adds the systemd service and other user-space tools to the build. In fact, what you really need is your Linux kernel to support Bluetooth (i.e. add the necessary drivers and configuration to the Linux Kconfig). It can be done by means of enabling CONFIG_BT through menuconfig or directly on your config file. Additionally, you might want to include kernel drivers/plugins for the specific Bluetooth hardware you are using.
For /sys/class/bluetooth to exist, the kernel module bluetooth.ko, which is only autoloaded by systemd-udev if it actually finds a working Bluetooth hardware device.
I suggest you start by adding support for Bluetooth on your Linux kernel, recompiling and reflashing. Then all your user-space tools should start working if your BT hardware is able to be brought up.
This is a good resource that may help you: https://wiki.archlinux.org/title/bluetooth#Troubleshooting

Can't run Qt application o 32-bit Yocto build with eglfs

I have built a Yocto image with the following configuration
# Architecture of the host machine
SDKMACHINE ?= "x86_64"
# Extra image configuration defaults
EXTRA_IMAGE_FEATURES = "debug-tweaks ssh-server-openssh"
CORE_IMAGE_EXTRA_INSTALL += "openssh-sftp openssh-sftp-server"
INIT_MANAGER = "systemd"
INHERIT += "rm_work"
# Extra packages
LICENSE_FLAGS_WHITELIST = "commercial"
DISTRO_FEATURES:remove = " \
x11 \
directfb \
vulkan \
wayland \
"
DISTRO_FEATURES:append = " \
alsa \
opengl \
gles2 \
"
IMAGE_INSTALL:append = " \
coreutils \
qtbase-plugins \
qtbase-tools \
qtdeclarative \
qtdeclarative-plugins \
qtdeclarative-qmlplugins \
qtdeclarative-tools \
qtimageformats-plugins \
qtmultimedia \
qtmultimedia-plugins \
qtmultimedia-qmlplugins \
qtquickcontrols2 \
qtquicktimeline \
qtscript \
qtsvg \
qtsvg-plugins \
qtsystems \
qtsystems-qmlplugins \
qtsystems-tools \
rsync \
"
PACKAGECONFIG:append:pn-qtbase = " \
eglfs \
fontconfig \
gles2 \
libpng \
jpeg \
libs \
widgets \
"
# Image file system types to package
IMAGE_FSTYPES = "rpi-sdimg"
# Package management configuration
PACKAGE_CLASSES = "package_ipk"
MACHINE ??= "raspberrypi4"
DISTRO ??= "poky"
BBMULTICONFIG ?= ""
I could successfully build and generate and SDK. I can build the Qt app and deploy it to the device.
I set
QT_QPA_PLATFORM=eglfs
DISPLAY=:0
but I get the error
EGL library doesn't support Emulator extensions
Aborted
The error looks similar to
QT Creator can not remote run and debugging on i.Mx6 (buildroot)
but since the Pi doesn't have a Vivante driver, I wouldn't know what to pass. I tried to search for integrations
$ find / -name "*egl*"
/usr/lib/plugins/video/videonode/libeglvideonode.so
/usr/lib/plugins/videoeglvideonode
/usr/lib/plugins/egldeviceintegrations
/usr/lib/plugins/egldeviceintegrations/libqeglfs-emu-integration.so
/usr/lib/plugins/egldeviceintegrations/libqeglfs-kms-integration.so
/usr/lib/plugins/egldeviceintegrations/libqeglfs-kms-egldevice-integration.so
/usr/lib/plugins/platforms/libqminimalegl.so
/usr/lib/plugins/platforms/libqeglfs.so
but eglfs-kms or all other combinations I have tried, don't work.
If I try
QT_QPA_EGLFS_INTEGRATION=none
I get
Unable to query physical screen size, defaulting to 100 dpi.
To override, set QT_QPA_EGLFS_PHYSICAL_WIDTH and QT_QPA_EGLFS_PHYSICAL_HEIGHT (in millimeters).
Cannot find EGLConfig, returning null config
EGL Error : Could not create the egl surface: error = 0x300b

Installing Iroha on Raspberry pi 4

I am trying to install Iroha on Raspberry pi 3 and 4. I am manually building it as following:
1) git clone -b master https://github.com/hyperledger/iroha
cd iroha
mkdir build; cd build; cmake ..; make -j$(nproc)
and then i get the following error
CMake Error at cmake/dependencies.cmake:24 (find_package):
Could not find a package configuration file provided by "spdlog" (requested
version 1.3.1) with any of the following names:
spdlogConfig.cmake
spdlog-config.cmake
Add the installation prefix of "spdlog" to CMAKE_PREFIX_PATH or set
"spdlog_DIR" to a directory containing one of the above files. If "spdlog"
provides a separate development package or SDK, be sure it has been
installed.
Call Stack (most recent call first):
CMakeLists.txt:179 (include)
– Configuring incomplete, errors occurred!
See also "/home/pi/Desktop/iroha/build/CMakeFiles/CMakeOutput.log".
See also "/home/pi/Desktop/iroha/build/CMakeFiles/CMakeError.log"
Any idea how to solve this?
I've managed to build iroha (version 1.1.3) on RPI 4 on Ubuntu Server 20.04.1 LTS (GNU/Linux 5.4.0-1015-raspi aarch64)
First of all we need to update our system:
sudo apt-get update
sudo apt-get upgrade -y
Then we should install dependencies according to instruction:
sudo apt-get -y --no-install-recommends install build-essential git ca-certificates tar curl unzip cmake vim ninja-build -y
Now I suggest to reboot system:
sudo reboot now
Next step was to download iroha source, I've tested this on Iroha 1.1.3, so my source was:
git clone --branch 1.1.3 https://github.com/hyperledger/iroha.git --depth=1
Next step according to instruction is to call:
iroha/vcpkg/build_iroha_deps.sh
But when I was building with the script on October 2020 some extra steps was necessarily, it was because of facts that:
vcpkg does not support aarch64,
g++ on RPI does not have flag -m64
one of dependency (GRPC) downloaded by VCPKG was not compiling
When You build this after some time possibly you will not face any of those problems, but it is also possible that You are going to face different problems.
So first step of building on RPI is to just run command:
iroha/vcpkg/build_iroha_deps.sh
and wait. If you don't see any problems you don't need the instruction.
If You see problem with cmake connected with vcpkg it means that vcpkg still doesn't support aarch64, but there is a hack to use system's cmake, instead of downloaded by vcpkg. To do this we need to add -useSystemBinaries to the file iroha/vcpkg/build_iroha_deps.sh after command bootstrap-vcpkg.sh. It can be done fast with command:
sed -i 's/\(^.*bootstrap.*$\)/\1 -useSystemBinaries/g' iroha/vcpkg/build_iroha_deps.sh
Then you can resume building:
./vcpkg/vcpkg install $(cat iroha/vcpkg/VCPKG_DEPS_LIST | cut -d':' -f1 | tr '\n' ' ')
./vcpkg/vcpkg install --head $(cat iroha/vcpkg/VCPKG_HEAD_DEPS_LIST | cut -d':' -f1 | tr '\n' ' ')
If you face problem with building boost-container, connected with flag -m64, which does not exist on gcc at RPI, you need to create wrapper to remove the flag. I've created the wrapper in c++ (file g++wrapper.cc):
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
using namespace std;
string args2Text(int argc, char** argv, const char* forbiddenFlag="-m64", const char* compilerCommand="/usr/bin/g++");
int returnValidNumberFromSubcommand(int systemCallReturnValue);
string escapeQuotes(const string& text);
int main(int argc, char* argv[])
{
const auto command = args2Text(argc, argv);
const auto status = system(command.c_str());
return returnValidNumberFromSubcommand(status);
}
string args2Text(int argc, char** argv, const char* forbiddenFlag, const char* compilerCommand)
{
string command = compilerCommand;
for (int i = 1; i < argc; ++i)
{
if (strcmp(argv[i], forbiddenFlag))
command += " "s + escapeQuotes(argv[i]);
}
return command;
}
string escapeQuotes(const string& text)
{
constexpr const char* escapedQuote = R"_(\")_";
string returnString;
returnString.reserve(text.size() + 2);
for (auto c : text)
{
if ('"' == c)
returnString += escapedQuote;
else
returnString += c;
}
return returnString;
}
int returnValidNumberFromSubcommand(int systemCallReturnValue)
{
if (systemCallReturnValue < 0)
{
return -1;
}
else
{
if (WIFEXITED(systemCallReturnValue))
{
return WEXITSTATUS(systemCallReturnValue);
}
else
{
return 1;
}
}
}
just compile that: g++ g++wrapper.cc -o g++wrapper
We just need to replace system's /usr/bin/c++ with our wrapper, we can do that with commands:
sudo mv /usr/bin/c++ /usr/bin/c++_original
sudo mv g++wrapper /usr/bin/c++
Now we can resume building now as above.
When we face problem with building GRPC:
-- Using source at /home/ubuntu/vcpkg/buildtrees/grpc/src/577f0c79b1-086c8c6e6c
-- Configuring x64-linux-dbg
-- Configuring x64-linux-rel
-- Building x64-linux-dbg
CMake Error at scripts/cmake/vcpkg_execute_build_process.cmake:134 (message):
Command failed: /usr/bin/cmake;--build;.;--config;Debug;--target;install;--;-v
Working Directory: /home/ubuntu/vcpkg/buildtrees/grpc/x64-linux-dbg
See logs for more information:
/home/ubuntu/vcpkg/buildtrees/grpc/install-x64-linux-dbg-out.log
And check in the log file:
/home/ubuntu/vcpkg/buildtrees/grpc/install-x64-linux-dbg-out.log
/home/ubuntu/vcpkg/buildtrees/grpc/src/577f0c79b1-086c8c6e6c/src/core/lib/iomgr/ev_epollex_linux.cc:1105:13: error: ambiguating new declaration of ‘long int gettid()’
Then I've fixed with commenting gettid function redefinition:
sed -i 's_\(^.*long gettid(.*$\)_//\1_g' $(find . -name ev_epollex_linux.cc)
Then I've faced similar problem with another definition of function gettid, so I did similar:
sed -i 's_\(^.*long gettid(.*$\)_//\1_g' $(find . -name log_linux.cc)
After correcting we can resume building.
If everything is all right and we wrapped c++ command with our binary we should restore original command:
sudo mv /usr/bin/c++_original /usr/bin/c++
Then we should be able to compile dependencies to iroha. Now according to instruction2 we should find out what cmake's flag we need, we can do this with command:
vcpkg/vcpkg integrate install
in my situation it was printed:
-DCMAKE_TOOLCHAIN_FILE=/home/ubuntu/vcpkg/scripts/buildsystems/vcpkg.cmake
Now we can use this in cmake's command.
cd iroha
cmake -H. -Bbuild -DTESTING=OFF \
-DVCPKG_TARGET_TRIPLET=x64-linux \
-DCMAKE_TOOLCHAIN_FILE=/home/ubuntu/vcpkg/scripts/buildsystems/vcpkg.cmake
Then lets call makefile (I suggest single thread on RPI):
cd build
make
sudo make install
If succesfull great! But is you see problem:
CMake Error at cmake_install.cmake:78 (file):
file INSTALL cannot find "/home/ubuntu/iroha/-lpthread": No such file or directory
You need to comment that line from the file:
sed -i 's_\(^.*\-lpthread.*\)$_#\1_g' cmake_install.cmake
Then we can rerun:
sudo make install
Thats all about building Iroha on Raspberry Pi 4, now You can install (or use docker image) database and enjoy.

Varnish Cache unterminated string error

I've been trying to setup varnish cache on my server for a good hour now but I can't seem to figure out why I'm getting this error:
$ sudo varnishd -C -f /etc/default/varnish
Error:
Message from VCC-compiler:
Unterminated string at
('/etc/default/varnish' Line 21 Pos 13)
DAEMON_OPTS="-a :6081 \
------------###########
Running VCC-compiler failed, exited with 2
VCL compilation failed
I'm using the default configuration from a clean install of varnish. Here's my full /etc/default/varnish:
# Should we start varnishd at boot? Set to "no" to disable.
START=yes
# Maximum number of open files (for ulimit -n)
NFILES=131072
# Maximum locked memory size (for ulimit -l)
# Used for locking the shared memory log in memory. If you increase log size,
# you need to increase this number as well
MEMLOCK=82000
DAEMON_OPTS="-a :6081 \
-T localhost:6082 \
-f /etc/varnish/default.vcl \
-S /etc/varnish/secret \
-s malloc,256m"
Any help would be greatly appreciated! If you need more details, let me know.
varnishd -C is used to compile (as in C language compile) a vcl file. You only compile vcl files not the config file. Your file does not have to specifically end with a .vcl extension but it does have to be in vcl syntax:
Varnish VCL documentation

Resources