How to build static libgpiod-tools executables for arm64? - libgpiod

Is there a way to build the static version of libgpiod-tools executables for arm64?
I need the static-linked version, because I need to pack them into a ramdisk for an embedded system (for debug purpose).
I can find a static version of the tools from a yocto/openbmc build result, but they are for 32-bit machines, and it seems that they can not run on arm64.
[cmic#sr223 libgpio-tools.32bit]$ ls -la
total 84
drwxr-xr-x. 2 cmic cmic 101 Apr 21 22:12 .
drwxrwxr-x. 5 cmic cmic 106 Apr 21 22:13 ..
-rwxr-xr-x. 1 cmic cmic 9652 Apr 21 22:10 gpiodetect
-rwxr-xr-x. 1 cmic cmic 9652 Apr 21 22:10 gpiofind
-rwxr-xr-x. 1 cmic cmic 9648 Apr 21 22:10 gpioget
-rwxr-xr-x. 1 cmic cmic 13748 Apr 21 22:10 gpioinfo
-rwxr-xr-x. 1 cmic cmic 13744 Apr 21 22:10 gpiomon
-rwxr-xr-x. 1 cmic cmic 13744 Apr 21 22:10 gpioset
[cmic#sr223 libgpio-tools.32bit]$ file gpiodetect
gpiodetect: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, BuildID[sha1]=61afc5cfee96d4a155876775f148eb9009ada03b, for GNU/Linux 3.2.0, stripped
[cmic#sr223 libgpio-tools.32bit]$ ldd gpiodetect
not a dynamic executable
[cmic#sr223 libgpio-tools.32bit]$ ./gpiodetect
-bash: ./gpiodetect: cannot execute binary file: Exec format error
Or I can download such executables from somewhere?

I would recommend you build this package from source, using the build system openbmc uses. This is the most reliable, and fastest way to add software to an image.
There is already a recipe for libgpiod-tool. Is is supported in meta-openbedded (which openbmc is based on) Here is the recipe in openbmc.
You will need to add the recipe to a openbmc machine. Try adding
IMAGE_INSTALL:append = " libgpiod-tools"
to the conf/local.conf for the machine you want to build use this on.
Then you can either build the full image or only the libgpiod pacakge
$ bitbake libgpiod
or
$ bitbake obmc-phosphor-image
Then the executable that match the aritture of the machine should be in build/tmp/work/armv7a-openbmc-linux-gnueabi/libgpiod/1.6.3-r0/packages-split/libgpiod-tools/usr/bin
You can move you new binaries over, or install a new image, to run your libgpiod-tool.
Also feel free to ask any questions you have on the openbmc discord
found here https://discord.gg/69Km47zH98, or the openbmc mailing list here https://lists.ozlabs.org/listinfo/openbmc.

Related

TestCafe chromium test run as part of docker build

For some reason, in our CI, we need to run node tests inside docker container (including fetching dependencies, etc.). So, I am trying to have UI tests run as a part of docker build.
This is how my Dockerfile looks like:
FROM testcafe/testcafe:1.3.3
USER root
#some packages needed for some dependencies
RUN apk add --no-cache yarn python make build-base vim curl
RUN ln -s /opt/testcafe/docker/testcafe-docker.sh /usr/local/bin/testcafe-docker
WORKDIR /usr/src/app
RUN yarn config set registry https://private-npm-registry --global
COPY package*.json ./
RUN yarn
COPY . .
RUN yarn test:ui:ci
# "test:ui:clean": "rm -rf uitests/reports"
# "test:ui:ci-debug": "yarn test:ui:clean; testcafe-docker 'chromium --no-sandbox' uitests/tests -S -s uitests/reports/screenshots --video uitests/reports/videos -r spec,json:uitests/reports/report.json,html:uitests/reports/report.html",
# "test:ui:ci": "start-server-and-test serve http://127.0.0.1:8080 test:ui:ci-debug"
I get ERROR Unable to establish one or more of the specified browser connections. This can be caused by network issues or remote device failure.
Also, I tried using user user, but it gives permission error when creating reports folder inside uitests folder before running tests.
I tried it with and without the --no-sandbox option, got the same issue. Also tried chromium:headless --no-sandbox, got the same error.
Any suggestion, please? Thanks.
UPDATE:
Also tried with user: user (avoiding permission issue by using /tmp folder for report) and got same issue:
20-Jul-2019 23:53:33 > yarn test:ui:clean; whoami; ls -sail; testcafe-docker 'chromium --no-sandbox' uitests/tests -S -s /tmp/uitests/reports/screenshots --video /tmp/uitests/reports/videos -r spec,json:/tmp/uitests/reports/report.json,html:/tmp/uitests/reports/report.html
20-Jul-2019 23:53:33
20-Jul-2019 23:53:34 $ rm -rf /tmp/uitests/reports
20-Jul-2019 23:53:34 user
20-Jul-2019 23:53:34 total 528
20-Jul-2019 23:53:34 13 4 drwxr-xr-x 10 user user 4096 Jul 20 13:52 .
20-Jul-2019 23:53:34 12 4 drwxr-xr-x 8 root root 4096 Jul 20 13:52 ..
20-Jul-2019 23:53:34 79 4 -rw-r--r-- 1 root root 20 Jul 19 07:06 .dockerignore
20-Jul-2019 23:53:34 75 4 -rw-r--r-- 1 root root 45 Jul 19 07:06 .eslintignore
20-Jul-2019 23:53:34 83 4 -rw-r--r-- 1 root root 790 Jul 19 07:06 .eslintrc
20-Jul-2019 23:53:34 78 4 drwxr-xr-x 8 root root 4096 Jul 20 13:48 .git
20-Jul-2019 23:53:34 82 4 -rw-r--r-- 1 root root 326 Jul 20 13:48 .gitignore
20-Jul-2019 23:53:34 87 4 -rw-r--r-- 1 root root 189 Jul 19 07:06 Dockerfile
20-Jul-2019 23:53:34 81 4 -rw-r--r-- 1 root root 592 Jul 20 13:48 DockerfileUITest
20-Jul-2019 23:53:34 89 4 -rw-r--r-- 1 root root 451 Jul 19 07:06 README.md
20-Jul-2019 23:53:34 90 4 drwxr-xr-x 3 root root 4096 Jul 19 07:06 backend
20-Jul-2019 23:53:34 4096 4 drwxr-xr-x 3 user user 4096 Jul 20 13:53 build
20-Jul-2019 23:53:34 85 4 -rwxr-xr-x 1 root root 959 Jul 19 07:06 build.sh
20-Jul-2019 23:53:34 84 4 -rw-r--r-- 1 root root 1124 Jul 19 07:06 deploy.yaml
20-Jul-2019 23:53:34 91 4 drwxr-xr-x 1348 user user 4096 Jul 20 13:52 node_modules
20-Jul-2019 23:53:34 74 4 -rw-r--r-- 1 root root 2959 Jul 20 13:48 package.json
20-Jul-2019 23:53:34 76 4 drwxr-xr-x 2 root root 4096 Jul 19 07:06 public
20-Jul-2019 23:53:34 88 4 -rwxr-xr-x 1 root root 742 Jul 19 07:06 runUITestsInCI.sh
20-Jul-2019 23:53:34 77 4 drwxr-xr-x 8 root root 4096 Jul 19 07:06 src
20-Jul-2019 23:53:34 80 4 drwxr-xr-x 7 root root 4096 Jul 19 07:06 uitests
20-Jul-2019 23:53:34 86 448 -rw-r--r-- 1 root root 454847 Jul 20 13:48 yarn.lock
20-Jul-2019 23:53:34 Using locally installed version of TestCafe.
20-Jul-2019 23:55:36 ERROR Unable to establish one or more of the specified browser connections. This can be caused by network issues or remote device failure.
20-Jul-2019 23:55:36
20-Jul-2019 23:55:36 Type "testcafe -h" for help.
Update-2:
Tried with firefox as well and same issue: ERROR Unable to establish one or more of the specified browser connections. This can be caused by network issues or remote device failure.
Update-3:
Sorry for the delay. Got distracted in something else. Tried both in CI and local machine and it was same behaviour. Also tried suggestion in comment echo -e '#!/bin/sh\n/usr/bin/chromium-browser --no-sandbox --remote-debugging-port=9222 --headless' > /usr/local/bin/testcafe-docker and got following output in both CI and local env.
02-Dec-2019 18:45:17 DevTools listening on ws://127.0.0.1:9222/devtools/browser/711c6409-be9a-4e08-959e-0c994c8c5742
02-Dec-2019 18:45:17 [1202/074517.060637:ERROR:gl_implementation.cc(282)] Failed to load /usr/lib/chromium/swiftshader/libGLESv2.so: Error loading shared library /usr/lib/chromium/swiftshader/libGLESv2.so: No such file or directory
02-Dec-2019 18:45:17 [1202/074517.064824:ERROR:viz_main_impl.cc(176)] Exiting GPU process due to errors during initialization
02-Dec-2019 18:45:17 [1202/074517.072317:WARNING:dns_config_service_posix.cc(341)] Failed to read DnsConfig.
02-Dec-2019 18:45:17 [1202/074517.072782:WARNING:gpu_process_host.cc(1220)] The GPU process has crashed 1 time(s)
02-Dec-2019 18:45:17 [1202/074517.135149:ERROR:gl_implementation.cc(282)] Failed to load /usr/lib/chromium/swiftshader/libGLESv2.so: Error loading shared library /usr/lib/chromium/swiftshader/libGLESv2.so: No such file or directory
02-Dec-2019 18:45:17 [1202/074517.139203:ERROR:viz_main_impl.cc(176)] Exiting GPU process due to errors during initialization
02-Dec-2019 18:45:17 [1202/074517.143251:WARNING:gpu_process_host.cc(1220)] The GPU process has crashed 2 time(s)
02-Dec-2019 18:45:17 [1202/074517.208950:WARNING:gpu_process_host.cc(990)] Reinitialized the GPU process after a crash. The reported initialization time was 0 ms
02-Dec-2019 18:45:17 [1202/074517.209227:ERROR:gpu_channel_manager.cc(397)] ContextResult::kFatalFailure: Failed to create shared context for virtualization.
The recent 'Chromium' versions are not allow you to run them under the root user. Change the user from 'root' to user before running TestCafe tests.
Also, you need to setup permission for creating new folders.
See the detailed explanation in write in shared volumes docker
...
USER user
RUN yarn test:ui:ci
It is because of proxy. We use proxy to reach internet. I was adding http_proxy, https_proxy and no_proxy(127.0.0.1) in docker image. Browser in docker container was trying to reach testcafe server (running in same container) through proxy, because it does not use 127.0.0.1/localhost but 172.17.0.2as testcafe server host inside container. So adding 172.17.0.2 to no_proxy works.

Qt 5.8: Workaround for QWebEngine not supporting static libraries

I'm trying to deploy an application using Qt 5.8 and need the following libraries:
Qt5Core
Qt5Gui
Qt5Network
Qt5Widgets
Qt5WebEngineCore
Qt5WebEngineWidgets
I originally wanted to create static libraries for all these and use those in my deployment but I read that QWebEngine does not support static libraries.
All I have to work with is the shared libraries.
Example:
$ ls -lrt libQt5WebEngineCore*
-rwxr-xr-x 1 root root 95625576 Jan 18 2017 libQt5WebEngineCore.so.5.8.0
lrwxrwxrwx 1 root root 28 Mar 22 12:38 libQt5WebEngineCore.so -> libQt5WebEngineCore.so.5.8.0
lrwxrwxrwx 1 root root 28 Mar 22 12:38 libQt5WebEngineCore.so.5.8 -> libQt5WebEngineCore.so.5.8.0
lrwxrwxrwx 1 root root 28 Mar 22 12:38 libQt5WebEngineCore.so.5 -> libQt5WebEngineCore.so.5.8.0
-rw-rw-r-- 1 root root 1703 Mar 22 12:38 libQt5WebEngineCore.prl
-rw-rw-r-- 1 root root 1226 Mar 22 12:38 libQt5WebEngineCore.la
Since I can't create a static library for QWebEngine is it ok to tar the shared library files with the -dereference option to preserve the softlinks in order to deploy to the user?

SDL_Init(SDL_INIT_VIDEO) generating excpetion dbus[3856] about dbus library

I developed a C++ application that among others use SDL2.
It compiles and run on Ubuntu 18.04 (64 bit machine) and on OSX.
When I try to compile the application on a computer on chip running Ubuntu Mate 18.04 in a 32 bits machine with the libraries compiled by me, it returns an exception.
The exception is happening inside the line SDL_Init( SDL_INIT_VIDEO ) and the message is the following:
dbus[3856]: arguments to dbus_message_new_method_call were incorrect, assertion "path != NULL" failed in file ../../../dbus/dbus-message.c ine 1362.
This is normally a bug in some application using D-Bus library.
D-Bus not built with -rdynamic so unable to print backtrace.
Aborted
It seems a problem happening on Ubuntu running on a 32 bit machine. Have anyone had the same problem?
How can I solve this problem? Or does anyone know what is generating it?
NOTE 1
Running in gdb and using backtrace as suggested:
#0 0xb613d206 in __libc_do_syscall () at ../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:47
#1 0xb614ab32 in __libc_signal_restore_set (set=0xbeffe3a4) at ../sysdeps/unix/sysv/linux/nptl-signals.h:80
#2 0xb614ab32 in __GI_raise (sig=sig#entry=6) at ../sysdeps/unix/sysv/linux/raise.c:48
#3 0xb614b82e in __GI_abort () at abort.c:79
#4 0xb2adddf0 in _dbus_abort () at /lib/arm-linux-gnueabihf/libdbus-1.so.3
#5 0xb2ad7c5a in _dbus_warn_check_failed () at /lib/arm-linux-gnueabihf/libdbus-1.so.3
#6 0xb2ad8104 in _dbus_warn_return_if_fail () at /lib/arm-linux-gnueabihf/libdbus-1.so.3
#7 0xb2acce80 in dbus_message_new_method_call () at /lib/arm-linux-gnueabihf/libdbus-1.so.3
#8 0xb68acdba in () at /usr/lib/arm-linux-gnueabihf/libSDL2-2.0.so.0
NOTE 2
The same happens if I install SDL from the repository instead of building it.
I found a partial solution so anybody with a better one would be welcome.
As #Keltar suggested in the comment I debugged it with gdb and backtrace as already said in the question. The last line of backtrace got me suspicious:
#8 0xb68acdba in () at /usr/lib/arm-linux-gnueabihf/libSDL2-2.0.so.0
which suggested it is not taking the library built by me but the one installed with apt. I checked all the paths in Makefile and everything was pointing to my custom built. So I checked the dynamic library files *.so and I found the situation was the following:
drwxr-xr-x 3 odroid odroid 4096 Oct 15 12:21 cmake
lrwxrwxrwx 1 odroid odroid 17 Oct 15 12:21 libSDL2-2.0d.so -> libSDL2-2.0d.so.0
lrwxrwxrwx 1 odroid odroid 21 Oct 15 12:21 libSDL2-2.0d.so.0 -> libSDL2-2.0d.so.0.8.0
-rw-r--r-- 1 odroid odroid 4317020 Oct 15 12:21 libSDL2-2.0d.so.0.8.0
lrwxrwxrwx 1 odroid odroid 15 Oct 15 12:40 libSDL2-2.0.so -> libSDL2-2.0d.so
-rw-r--r-- 1 odroid odroid 7593354 Oct 15 12:21 libSDL2d.a
-rw-r--r-- 1 odroid odroid 4754 Oct 15 12:19 libSDL2maind.a
lrwxrwxrwx 1 odroid odroid 14 Oct 15 13:38 libSDL2.so -> libSDL2-2.0.so
drwxr-xr-x 2 odroid odroid 4096 Oct 15 12:21 pkgconfig
Note that for the symbolic link file libSDL2.so -> libSDL2-2.0.so, the linked file libSDL2-2.0.so was not created.
My solution was to rebuild the library in Release mode instead of Debug using cmake -DCMAKE_BUILD_TYPE=Release: in that way all the files library are correct. Another solution might be to symlink the file(s) manually but is is easy to mess up something.
So it seems a bug in how SDL cmake write the instructions for the Debug build type because in release mode my program run.
If anyone has a better solution or find any error that I could not find please let me know.

Groovy install on Unix OS

I want to install groovy on a unix server and test functionality. I used manual instructions from the following link:
https://itekblog.com/centos-groovy-installation-tutorial-newbs-centos-6-x/
I think the java jdk is installed, but im not certain since I didnt do it myself. I base my opinion on the following commands(i edited output with xxxs to obfuscate info):
[root#xxx groovy]# which java
/opt/xxx/xxx/bin/java
and
[root#xxx bin]# ll
total 48
lrwxrwxrwx. 1 root jdk8 29 Aug 10 2017 jar ->
/opt/xxx/jdk8/current/bin/jar
lrwxrwxrwx. 1 root jdk8 30 Aug 10 2017 java ->
/opt/xxx/jdk8/current/bin/java
lrwxrwxrwx. 1 root jdk8 29 Aug 10 2017 jps ->
/opt/xxx/jdk8/current/bin/jps
lrwxrwxrwx. 1 root jdk8 32 Aug 10 2017 jstack ->
/opt/xxx/jdk8/current/bin/jstack
lrwxrwxrwx. 1 root jdk8 31 Aug 10 2017 jstat ->
/opt/xxx/jdk8/current/bin/jstat
lrwxrwxrwx. 1 root jdk8 33 Aug 10 2017 keytool ->
/opt/xxx/jdk8/current/bin/keytool
Here is my bash_profile:
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
export GROOVY_HOME=/usr/groovy/groovy-2.5.1
PATH=$PATH:$HOME/bin:$GROOVY_HOME/bin
export PATH
I "reloaded" my profile:
source ~/.bash_profile
Here is what happens when I try to "run" groovy:
[root#lhost-cl2 groovy]# groovy -e 'println("Hello, World!")'
Exception in thread "main" java.lang.ClassFormatError:
org.codehaus.groovy.tools.GroovyStarter (unrecognized class file version)
at java.lang.VMClassLoader.defineClass(libgcj.so.10)
at java.lang.ClassLoader.defineClass(libgcj.so.10)
at java.security.SecureClassLoader.defineClass(libgcj.so.10)
at java.net.URLClassLoader.findClass(libgcj.so.10)
at java.lang.ClassLoader.loadClass(libgcj.so.10)
at java.lang.ClassLoader.loadClass(libgcj.so.10)
at gnu.java.lang.MainThread.run(libgcj.so.10)
Suggestions?
There were two versions of java installed on the server. The older version, not compatible with groovy, was being referenced. I updated the path and its happy now.

AIX not able to run applications in specific directory

This might be simple problem. But I am stuck with this for weeks now.
We have an AIX server in which we are facing this issue. I am not able to run programs inside a specific directory and its sub directories.
I am getting proper outputs for commands java and scp2 in /opt/FileNet directory. But when I am in /opt/FileNet/RM directory these commands stops working. Outputs are as below.
Java - JVMXM008: Error occured while initialising System ClassException in thread "main" Could not create the Java virtual machine.
SCP2 - Failed to parse installation path.
I have no idea why this is happening. Your thoughts please.
drwxr-xr-x 24 root system 4096 Feb 21 2012 opt
drwxr-xr-x 17 jxadmin wasadmin 4096 Aug 14 08:40 FileNet
drwxrwxr-x 17 jxadmin wasadmin 4096 Aug 14 08:45 RM
drwxrwxr-x 37 jxadmin wasadmin 4096 Feb 13 2012 AE (/opt/FileNet/AE, This directory is working as expected)
Couldn't find any ACLs.

Resources