Application crash with TERMINATED - linux

I have one application made in QT, and sometimes when I start it, occurre an inexpected TERMINATED error.
But If I retry sometimes, the application open normally.
ebonomo#ICCSW-044681NB /usr/local/app/bin$ ./myapp
Terminado
ebonomo#ICCSW-044681NB /usr/local/app/bin$ ./myapp
Terminado
ebonomo#ICCSW-044681NB /usr/local/app/bin$ ./myapp
"Iniciando ...
.....
I created a lib folder in app/lib with all libs detected in lddtree. I changed too in .bashrc to set LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/app/lib/
But I can't get why this error. Could you help me? How can I get the cause? Is there any command to check it?
I already tried remove all in main method keeping only a debug message, and the error occurred yet.
I don't know more what can I do. :(
My environment is:
Ubuntu 20.04
Qt 5.15.2
Qt Creator 7.0.1
Based on Qt 6.2.3 (GCC 10.3.1 20210422 (Red Hat 10.3.1-1), 64 bit)
Built on Apr 26 2022 01:18:11
From revision da16d778d5
OBS: I can reproduce the error with this code:
int main(int argc, char *argv[])
{
qFatal("Starting application");
}
My .pro is it:
#-------------------------------------------------
#
# Project created by QtCreator 2020-09-24T10:15:43
#
#-------------------------------------------------
QT += core gui network svg
QT += multimedia
QT += multimediawidgets
QT += 3drender
QT += printsupport
CONFIG += ccache use_gold_linker precompile_header # Improve Build Speed
PRECOMPILED_HEADER = precompiled_header.h
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets quick
# Additional import path used to resolve QML modules in Qt Creator's code model
QML_IMPORT_PATH = $$PWD/ui/imports
TARGET = myapp
TEMPLATE = app
INCLUDEPATH += $$PWD/libs
INCLUDEPATH += $$PWD/libs/qtmqtt
INCLUDEPATH += /usr/include/opencv4
INCLUDEPATH += $$PWD/imagerender/src
INCLUDEPATH += $$PWD/libs/fingerprint/Futronic/header
#Include static lib QT MQTT
equals(QT_VERSION, "5.15.2") {
#message("Loading lib libQt5Mqtt for 5.15.2")
LIBS += -L$$PWD/libs/qtmqtt/5.15.2 -lQt5Mqtt
QMAKE_LFLAGS += -Wl,--rpath=$$PWD/libs/qtmqtt/5.15.2
}
equals(QT_VERSION, "5.15.1") {
#message("Loading lib libQt5Mqtt for 5.15.1")
LIBS += -L$$PWD/libs/qtmqtt/5.15.1 -lQt5Mqtt
QMAKE_LFLAGS += -Wl,--rpath=$$PWD/libs/qtmqtt/5.15.1
}
LIBS += -L$$PWD/libs/fingerprint/Futronic -lScanAPI
QMAKE_LFLAGS += -Wl,--rpath=$$PWD/libs/fingerprint/Futronic
# The following define makes your compiler emit warnings if you use
# any feature of Qt which has been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
LIBS += -lopencv_core
LIBS += -lopencv_highgui
LIBS += -lopencv_imgproc
LIBS += -lopencv_features2d
LIBS += -lopencv_calib3d
LIBS += -lopencv_videoio
LIBS += -lopencv_imgcodecs
LIBS += -lrt
SOURCES += \
main.cpp
# a lot of .cpp here
HEADERS += \
constants.h
# a lot of .h here
FORMS +=
DISTFILES += \
settings.ini
RESOURCES += \
resources.qrc \
images/logos/logo.png
TRANSLATIONS += i18n/en.ts \
i18n/es.ts \
i18n/pt.ts
# From here https://stackoverflow.com/a/36438618
copydata.commands = $(COPY_DIR) $$PWD/settings.ini $$OUT_PWD
first.depends = $(first) copydata
export(first.depends)
export(copydata.commands)
QMAKE_CXXFLAGS += -Wno-unknown-pragmas # Ignore pragma region warnings
QMAKE_EXTRA_TARGETS += first copydata

Related

How can I run qmake tool on target with yocto?

My team is using Petalinux 18.02 which uses Yocto ver.rocko and meta-qt5.
I added IMAGE_INSTALL_append = " packagegroup-qt5-toolchain-target " in local.conf but it did not integrate qmake to target image. Then I modified local.conf one more time and added IMAGE_INSTALL_append = " qtbase-tools " and it did that! So I finally integrated qmake tool on target system.
However, it does not work well...
Its configuration looks invalid and it can't find features, test functions.
I'll add a detail below.
# Environment variables
export QTDIR="/usr/bin/qt5";
export QTINC="/usr/include/qt5";
export QTLIB="/usr/lib/qt5";
export QMAKESPEC="/usr/lib/qt5/mkspecs/linux-oe-g++";
export QMAKEFEATURES="/usr/lib/qt5/mkspecs/features";
export PATH="${QTDIR}:${PATH}"
root#petalinux18.02:~# /usr/bin/qt5/qmake -query
QT_SYSROOT:/scratch/petalinux-yocto/yocto_downloads_2018.2_zynqmp-generic/build_zynqmp-generic/tmp/work/aarch64-xilinx-linuxt
QT_INSTALL_PREFIX:/scratch/petalinux-yocto/yocto_downloads_2018.2_zynqmp-generic/build_zynqmp-generic/tmp/work/aarch64-xilinr
QT_INSTALL_PREFIX/raw:/usr
QT_INSTALL_ARCHDATA:/scratch/petalinux-yocto/yocto_downloads_2018.2_zynqmp-generic/build_zynqmp-generic/tmp/work/aarch64-xil5
QT_INSTALL_ARCHDATA/raw:/usr/lib/qt5
QT_INSTALL_DATA:/scratch/petalinux-yocto/yocto_downloads_2018.2_zynqmp-generic/build_zynqmp-generic/tmp/work/aarch64-xilinx-5
QT_INSTALL_DATA/raw:/usr/share/qt5
QT_INSTALL_DOCS:/scratch/petalinux-yocto/yocto_downloads_2018.2_zynqmp-generic/build_zynqmp-generic/tmp/work/aarch64-xilinx-5
QT_INSTALL_DOCS/raw:/usr/share/doc/qt5
QT_INSTALL_HEADERS:/scratch/petalinux-yocto/yocto_downloads_2018.2_zynqmp-generic/build_zynqmp-generic/tmp/work/aarch64-xili5
QT_INSTALL_HEADERS/raw:/usr/include/qt5
QT_INSTALL_LIBS:/scratch/petalinux-yocto/yocto_downloads_2018.2_zynqmp-generic/build_zynqmp-generic/tmp/work/aarch64-xilinx-b
QT_INSTALL_LIBS/raw:/usr/lib
QT_INSTALL_LIBEXECS:/scratch/petalinux-yocto/yocto_downloads_2018.2_zynqmp-generic/build_zynqmp-generic/tmp/work/aarch64-xilc
QT_INSTALL_LIBEXECS/raw:/usr/lib/qt5/libexec
QT_INSTALL_BINS:/scratch/petalinux-yocto/yocto_downloads_2018.2_zynqmp-generic/build_zynqmp-generic/tmp/work/aarch64-xilinx-5
QT_INSTALL_BINS/raw:/usr/bin/qt5
QT_INSTALL_TESTS:/scratch/petalinux-yocto/yocto_downloads_2018.2_zynqmp-generic/build_zynqmp-generic/tmp/work/aarch64-xilinxs
QT_INSTALL_TESTS/raw:/usr/share/qt5/tests
QT_INSTALL_PLUGINS:/scratch/petalinux-yocto/yocto_downloads_2018.2_zynqmp-generic/build_zynqmp-generic/tmp/work/aarch64-xilis
QT_INSTALL_PLUGINS/raw:/usr/lib/qt5/plugins
QT_INSTALL_IMPORTS:/scratch/petalinux-yocto/yocto_downloads_2018.2_zynqmp-generic/build_zynqmp-generic/tmp/work/aarch64-xilis
QT_INSTALL_IMPORTS/raw:/usr/lib/qt5/imports
QT_INSTALL_QML:/scratch/petalinux-yocto/yocto_downloads_2018.2_zynqmp-generic/build_zynqmp-generic/tmp/work/aarch64-xilinx-ll
QT_INSTALL_QML/raw:/usr/lib/qt5/qml
QT_INSTALL_TRANSLATIONS:/scratch/petalinux-yocto/yocto_downloads_2018.2_zynqmp-generic/build_zynqmp-generic/tmp/work/aarch64s
QT_INSTALL_TRANSLATIONS/raw:/usr/share/qt5/translations
QT_INSTALL_CONFIGURATION:/scratch/petalinux-yocto/yocto_downloads_2018.2_zynqmp-generic/build_zynqmp-generic/tmp/work/aarch65
QT_INSTALL_CONFIGURATION/raw:/etc/qt5
QT_INSTALL_EXAMPLES:/scratch/petalinux-yocto/yocto_downloads_2018.2_zynqmp-generic/build_zynqmp-generic/tmp/work/aarch64-xils
QT_INSTALL_EXAMPLES/raw:/usr/share/qt5/examples
QT_INSTALL_DEMOS:/scratch/petalinux-yocto/yocto_downloads_2018.2_zynqmp-generic/build_zynqmp-generic/tmp/work/aarch64-xilinxs
QT_INSTALL_DEMOS/raw:/usr/share/qt5/examples
QT_HOST_PREFIX:/scratch/petalinux-yocto/yocto_downloads_2018.2_zynqmp-generic/build_zynqmp-generic/tmp/work/aarch64-xilinx-le
QT_HOST_DATA:/scratch/petalinux-yocto/yocto_downloads_2018.2_zynqmp-generic/build_zynqmp-generic/tmp/work/aarch64-xilinx-lin5
QT_HOST_BINS:/usr/bin/qt5
QT_HOST_LIBS:/scratch/petalinux-yocto/yocto_downloads_2018.2_zynqmp-generic/build_zynqmp-generic/tmp/work/aarch64-xilinx-linb
QMAKE_SPEC:linux-oe-g++
QMAKE_XSPEC:linux-oe-g++
QMAKE_VERSION:3.1
QT_VERSION:5.9.4
# test.pro
TEMPLATE = app
TARGET = test_qmake
DEPENDPATH += .
INCLUDEPATH += .
INCLUDEPATH += /usr/include/qt5
# Input
HEADERS += test_qmake.hpp
SOURCES += test_qmake.cpp
root#petalinux18.02:~# ls
test.pro
root#petalinux18.02:~# /usr/bin/qt5/qmake
/usr/lib/qt5/mkspecs/features/resolve_config.prf:25: 'addExclusiveBuilds' is not a recognized test function.
/usr/lib/qt5/mkspecs/features/resolve_config.prf:37: 'addExclusiveBuilds' is not a recognized test function.
Project ERROR: Could not find feature force_asserts.
I know running qmake on target not host is not normal. But our client wants it then I have to do it.
I have been searching a solution in google but I found out nothing...
Is there anyone else has a solution?

New Yocto Recipe Builds but Work Directory is Deleted after Compilation

I am trying to update the recipe for zbar from 0.10.0 to 0.20.1. Here is the original recipe:
https://github.com/openembedded/meta-openembedded/blob/master/meta-oe/recipes-support/zbar/zbar_0.10.bb
My modified recipe is at the bottom of this question. The package does compile, but the problem is that something happens during the "packaging" step and the "work" directory is wiped out except for the "temp" directory inside the "work" directory. During compilation, if I list the files in the work directory, everything I expect is present, but after compilation succeeds, something cleans the files up. What am I doing wrong?
During compilation:
user#ubuntu:~/rpi/build/tmp/work/cortexa7hf-neon-vfpv4-poky-linux-gnueabi/zbar/0.20.1-r0$ cd ../0.20.1-r0/ ; ls
build image pkgdata sysroot-destdir
configure.sstate license-destdir pseudo temp
debugsources.list package recipe-sysroot
git packages-split recipe-sysroot-native
After Compilation:
user#ubuntu:~/rpi/build/tmp/work/cortexa7hf-neon-vfpv4-poky-linux-gnueabi/zbar/0.20.1-r0$ cd ../0.20.1-r0/ ; ls
temp
Yocto Recipe:
DESRIPTION = "2D barcode scanner toolkit."
SECTION = "graphics"
LICENSE = "LGPL-2.1"
DEPENDS = "pkgconfig intltool-native libpng jpeg"
LIC_FILES_CHKSUM = "file://LICENSE;md5=243b725d71bb5df4a1e5920b344b86ad"
S = "${WORKDIR}/git"
SRCREV = "edcf08b49e0a5fe71c18fa9d4b8ed83ed8fc9082"
SRC_URI = "git://github.com/mchehab/zbar.git"
inherit autotools pkgconfig
EXTRA_OECONF = " --without-x --without-imagemagick --without-qt --without-python2 --disable-video --without-gtk"
FILES_${PN} += "${bindir}"
FILES_${PN} += "${libdir}"
do_install_append() {
echo "done..."
}
This is because of the rm_work class. You can remove,
INHERIT += "rm_work"
this from local.conf or in according image recipe file. Or you can disable the rm_work only for your recipe using,
RM_WORK_EXCLUDE += "zbar"
in conf/local.conf.

How to configure Yocto for an example "hello world" program which uses a Debian library?

I build a simple software in my Debian VM. It tries the download a file from a FTP server. For that I use the libcurl library(libcurl-openssl-dev).
Now I have a SAMA5D3x-Evalboard available. For self education purpose I like to build a Linux + Toolchain for it. I found the Yocto project. The meta layer concept seems to be good approach for managing different platforms - so let's try it!
I found some examples at the net. But no which covers the combination of "hello world" + bigger lib.
I want:
get the X-compile toolchain + Linux image(includes my hello world + the libcurl shared objects)
My approach:
meta-atmel: for the SAMA5D3x eval board
meta-debian: for the lib "libcurl-openssl-dev"
meta-mySoftware: for the hello world program
The constrains are:
main.c - name of the hello world program
libcurl - c lib name (I have chosen this lib, because it has a lot of dependencies)
How to setup it right? If there are better ideas they are welcome!
Installation & Configuration of Yocto
I.) install toolchain
I.1.) apt-get:
sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib build-essential chrpath socat libsdl1.2-dev xterm
I.2.) opt. configure git after proxy
git config --global core.gitproxy <gitproxy>
I.3.) download Toolchain + meta packages and checkout the "right" commit
git clone git://git.yoctoproject.org/poky
cd poky
git checkout jethro
git clone git://github.com/linux4sam/meta-atmel.git
cd meta-atmel
git checkout jethro
cd ..
git clone git://git.openembedded.org/meta-openembedded
cd meta-openembedded
git checkout jethro
cd ..
II.) build kernel+rootfs for SAMA5D3x
II.1) create new project
source oe-init-build-env
the new project is created at the "build" dir
modify layers "conf/bblayers.conf" via commandos
bitbake-layers add-layer "../meta-atmel"
bitbake-layers add-layer "../meta-openembedded/meta-oe"
bitbake-layers add-layer "../meta-openembedded/meta-networking"
bitbake-layers add-layer "../meta-openembedded/meta-python"
edit of "conf/local.conf"
MACHINE ??= "sama5d3xek"
DL_DIR ?= "${TOPDIR}/../downloads"
DISTRO ?= "poky-atmel"
the download directory is outside of the build environment. The downloaded sources can be used for different builds.
II.2) create image
bitbake -c clean core-image-minimal
bitbake core-image-minimal
the result files are created at "tmp/deploy/images/sama5d3xek"
II.3) flash image
The sam-ba tool from Atmel is needed. The Flash-Process can be automated by a script(we create a tcl file). The self written tool "buildAtmelImages.py" copies the needed image files for the SAMA5D35, creates the u-boot configuration and a Flash-Script. An Example:
python buildAtmelImages.py --help
python buildAtmelImages.py -s "/home/user/poky/build/tmp/deploy/images/sama5d3xek" -d "/home/user/images" -t "\\\\1.2.3.4\\admin\\images"
here comes the code for "buildAtmelImages.py":
#!/usr/bin/python
# encoding: utf-8
'''
buildAtmelImages -- make yocto build images ready of the sam-ba flash tool
buildAtmelImages is a description
- reverse engineered /meta-atmel/scripts/nandflash.tcl script
- works only for the SAMA5D35
- params:
-s "<dir>" = source dir of the images generated by yocto. like "/home/user/poky/build/tmp/deploy/images/sama5d3xek"
-d "<dir>" = destination dir
-t "<dir/url>" = tcl refence dir. The path to the images, used to flash, is hard coded in the tcl script. typical example "\\\\192.168.1.2\\admin\\images" for an samba based network
- way of operation:
# hints:
I.) the SAMA5D3x implements some ECC features. This means that in every NAND sector are bits for error correction reserved.
This acts into 2 directions:
1.) the binary files have to be flashed by takeing care of the extra ECC bits. This is done by the sam-ba flash tool
2.) the kernel needs to take care, that the data stored on the NAND drive has some extra handling. This is managed by the meta-atmel package used by the yocto toolchain.
II.) u boot configuration
1.) the u boot configuration is placed into the NAND. But the configuration is not generated by the yocto toolchain. Atmel delivers a flashing script for its demo boards. This was reversed engineered into this python script.
The layout of the boot config is a defined memory space which is guared by an crc32(litle endian). The boot configuration is placed as ANSII string parameters. These parameters are seperated by a zero.
2.) because of the ecc the binary device tree(dtb) and kernel needs to be copied to memory before been executed. For that it is needed that u-boot loads them into ram before starting the kernel.
# operation:
First the generated images are copied. After the configuartion is generated and placed into the output dir. At least the tcl script is generated and placed into the output dir, as well.
#author: Stefan Jaritz
#copyright:
#license: license
#contact:
#deffield updated: Updated
'''
import sys
import os
import shutil
import binascii
import struct
from argparse import ArgumentParser
from argparse import RawDescriptionHelpFormatter
__all__ = []
__version__ = 0.1
__date__ = '2016-04-19'
__updated__ = '2016-04-19'
class _memorySeg():
def __init__(self, add, sf, df):
self.add = add
self.sf = sf
self.df = df
gArch = 'sama5d3xek'
gTCLfilename = 'SEK4.tcl'
gMemSetup = {
'bootloader' : _memorySeg(0x00000000, 'at91bootstrap-sama5d3xek.bin', 'bootloader.bin'),
'uboot' : _memorySeg(0x00040000, 'u-boot-sama5d3xek.bin', 'uboot.bin'),
'ubootEnv' : _memorySeg(0x000c0000, None, 'ubootEnv.bin'),
'ubootEnvRed' : _memorySeg(0x00100000, None, 'ubootEnv.bin'),
'dtb' : _memorySeg(0x00180000,'zImage-sama5d35ek.dtb', 'kernel.dtb'),
'kernel' : _memorySeg(0x00200000,'zImage', 'kernel'),
'rootfs' : _memorySeg(0x00800000,'core-image-minimal-sama5d3xek.ubi', 'rootfs.ubi')
}
gSourceDir = ''
gDestDir = ''
gTCLfilepath = ''
gECCcnfg = {
'at91sam9x5ek' : 0xc0c00405,
'at91sam9n12ek' : 0xc0c00405,
'sama5d3xek' :0xc0902405,
'sama5d3_xplained' : 0xc0902405,
'sama5d4ek' : 0xc1e04e07,
'sama5d4_xplained' : 0xc1e04e07
}
def _copyFiles ():
''' copies image files from source to the destination'''
global gMemSetup
for (k, ms) in gMemSetup.items():
if ms.sf is not None:
print("copy {k}".format(k=k))
shutil.copy(os.path.join(gSourceDir, ms.sf), os.path.join(gDestDir, ms.df))
def _genUBootCfg ():
global gMemSetup
global gSourceDir
global gDestDir
print("generate u-boot config")
bootCfgStr = "bootcmd=nand read 0x{dtbLoadAddr:X} 0x{dtbAddr:X} {dtbSize}; nand read 0x{kernelLoadAddr:X} 0x{kernelAddr:X} {kernelSize}; bootz 0x{kernelLoadAddr:X} - 0x{dtbLoadAddr:X}".format(
dtbLoadAddr=0x21000000,
dtbAddr=gMemSetup['dtb'].add,
dtbSize=os.path.getsize(os.path.join(gSourceDir, gMemSetup['dtb'].sf)),
kernelLoadAddr=0x22000000,
kernelAddr=gMemSetup['kernel'].add,
kernelSize=os.path.getsize(os.path.join(gSourceDir, gMemSetup['kernel'].sf))
)
bootVars = (
'bootdelay=0',
'baudrate=115200',
'stdin=serial',
'stdout=serial',
'stderr=serial',
'bootargs=console=ttyS0,115200 mtdparts=atmel_nand:256k(bootstrap)ro,512k(uboot)ro,256k(env),256k(env_redundant),256k(spare),512k(dtb),6M(kernel)ro,-(rootfs) rootfstype=ubifs ubi.mtd=7 root=ubi0:rootfs rw',
bootCfgStr
)
cfgMemCfg = bytearray(0x20000-5)
l = len(cfgMemCfg)
indx = 0
for v in bootVars:
l = len(v)
cfgMemCfg[indx:indx+l] = v.encode('utf-8')
indx += l + 1
crc = binascii.crc32(cfgMemCfg)
with open(os.path.join(gDestDir, gMemSetup['ubootEnv'].df), mode='wb') as f:
# crc32 as little endian
f.write(struct.pack('<I',crc))
f.write(bytearray(1))
f.write(cfgMemCfg)
f.close()
def _helper_genTCLFilename (idName):
pstr = os.path.join(gTCLfilepath ,gMemSetup[idName].df)
pstr = pstr.replace('/', '\\')
return pstr.replace('\\', '\\\\')
def _genFlashScript():
global gMemSetup
global gECCcnfg
global gTCLfilename
global gDestDir
global gArch
print("generate tcl script for sam-ba")
tclStr = """puts "-I- start flashing"
NANDFLASH::Init
NANDFLASH::NandHeaderValue HEADER 0x{pmeccConfig:X}
NANDFLASH::EraseAllNandFlash
NANDFLASH::SendBootFilePmeccCmd "{bootstrapFile}"
send_file {{NandFlash}} "{ubootFile}" 0x{ubootAddr:X} 0
send_file {{NandFlash}} "{ubootEnvFile}" 0x{ubootEnvAddr:X} 0
send_file {{NandFlash}} "{ubootEnvFileRed}" 0x{ubootEnvAddrRed:X} 0
send_file {{NandFlash}} "{dtbFile}" 0x{dtbAddr:X} 0
send_file {{NandFlash}} "{kernelFile}" 0x{kernelAddr:X} 0
NANDFLASH::NandSetTrimffs 1
send_file {{NandFlash}} "{rootfsFile}" 0x{rootfsAddr:X} 0
puts "-I- finished flashing"
""".format(
pmeccConfig=gECCcnfg[gArch],
bootstrapFile=_helper_genTCLFilename('bootloader'),
ubootFile=_helper_genTCLFilename('uboot'),
ubootAddr=gMemSetup['uboot'].add,
ubootEnvFile=_helper_genTCLFilename('ubootEnv'),
ubootEnvAddr=gMemSetup['ubootEnv'].add,
ubootEnvFileRed=_helper_genTCLFilename('ubootEnvRed'),
ubootEnvAddrRed=gMemSetup['ubootEnvRed'].add,
dtbFile=_helper_genTCLFilename('dtb'),
dtbAddr=gMemSetup['dtb'].add,
kernelFile=_helper_genTCLFilename('kernel'),
kernelAddr=gMemSetup['kernel'].add,
rootfsFile=_helper_genTCLFilename('rootfs'),
rootfsAddr=gMemSetup['rootfs'].add
)
with open(os.path.join(gDestDir, gTCLfilename), mode='w') as f:
f.write(tclStr)
f.close()
class _CLIError(Exception):
'''Generic exception to raise and log different fatal errors.'''
def __init__(self, msg):
super(_CLIError).__init__(type(self))
self.msg = "E: %s" % msg
def __str__(self):
return self.msg
def __unicode__(self):
return self.msg
def main(argv=None): # IGNORE:C0111
'''Command line options.'''
global gSourceDir
global gDestDir
global gTCLfilepath
if argv is None:
argv = sys.argv
else:
sys.argv.extend(argv)
program_name = os.path.basename(sys.argv[0])
program_version = "v%s" % __version__
program_build_date = str(__updated__)
program_version_message = '%%(prog)s %s (%s)' % (program_version, program_build_date)
program_shortdesc = __import__('__main__').__doc__.split("\n")[1]
program_license = '''%s
Created by Stefan Jaritz on %s.
Copyright 2016 organization_name. All rights reserved.
Licensed under the Apache License 2.0
http://www.apache.org/licenses/LICENSE-2.0
Distributed on an "AS IS" basis without warranties
or conditions of any kind, either express or implied.
USAGE
''' % (program_shortdesc, str(__date__))
try:
# Setup argument parser
parser = ArgumentParser(description=program_license, formatter_class=RawDescriptionHelpFormatter)
parser.add_argument("-s", "--source", dest="srcD", help="source path of the images [default: %(default)s]", default=os.getcwd())
parser.add_argument("-d", "--destination", dest="dstD", help="destination where the images and the flash script is copied [default: %(default)s]", default=os.getcwd() )
parser.add_argument("-t", "--tclFilePath", dest="tclD", help="TCL script path. The path where the TCL file gona be located [default: %(default)s]", default='' )
parser.add_argument('-V', '--version', action='version', version=program_version_message)
# Process arguments
args = parser.parse_args()
gSourceDir = args.srcD
gDestDir = args.dstD
gTCLfilepath = args.tclD
shutil.rmtree(gDestDir, ignore_errors=True)
os.makedirs(gDestDir)
print("start")
_copyFiles()
_genUBootCfg()
_genFlashScript()
print("finished")
return 0
except KeyboardInterrupt:
### handle keyboard interrupt ###
return -1
except Exception as e:
indent = len(program_name) * " "
sys.stderr.write(program_name + ": " + repr(e) + "\n")
sys.stderr.write(indent + " for help use --help")
return -2
if __name__ == "__main__":
sys.exit(main())
III.) Create own package
yocto-layer create own
bitbake-layers add-layer "../meta-own"
modify the example.bb
SRC_URI = "file://testFTP.c"
S = "${WORKDIR}"
DEPENDS ="curl"
do_compile() {
${CC} testFTP.c -o testFTP ${CFLAGS} -lcurl
}
do_install() {
install -d ${D}${bindir}
install -m 0755 testFTP ${D}${bindir}
}
now add in "layer.conf"
IMAGE_INSTALL_append = " vim testftp"
Now the vim editor and the testftp recipe, which includes the testFTP binary is installed at the "user/bin" at the rootfs.
After the flashing, start the the SAMA5D35 Evalboard. Login as "root". Type: "testFTP" or "vim" and enjoy the output.
Cheers!

qmake: make uninstall tries to remove system folders containing files installed with INSTALLS

This is my .pro file:
TEMPLATE = app
TARGET = myapp
INCLUDEPATH += .
win32 {
RC_FILE = win32/myapp.rc
}
unix {
target.path = /usr/share/myapp/
shortcutfiles.files += unix/myapp.desktop
shortcutfiles.path = /usr/share/applications/
data.files += unix/myapp.png
data.path = /usr/share/pixmaps/
INSTALLS += target
INSTALLS += shortcutfiles
INSTALLS += data
}
SOURCES += myapp.cpp
QT += webkitwidgets
RESOURCES += \
myapp.qrc
Under linux, the make uninstall command, while removing the actual installed files and folder, tries to remove the /usr/share/applications/ and /usr/share/pixmaps/ folders (with rmdir); and because they are not empty folders it fails with error code 1 (ignored actually).
How to modify my .pro file to prevent make uninstall from trying to remove those system folders?
Thanks.

How to avoid having version numbers in .so file name

I'm trying to build a dynamic library on Linux using qmake. Here is my .pro file:
TEMPLATE = lib
TARGET = sqxUiBase
QT += core gui
CONFIG += dll
INCLUDEPATH += ../../public/include
DEPENDPATH += .
UI_DIR += ../GeneratedFiles
RCC_DIR += ../GeneratedFiles
CONFIG(release, debug|release) {
DESTDIR = ../lib/release
LIBS += -L"../lib/release"
MOC_DIR += ../GeneratedFiles/release
OBJECTS_DIR += release
} else {
DESTDIR = ../lib/debug
LIBS += -L"../lib/debug"
MOC_DIR += ../GeneratedFiles/debug
OBJECTS_DIR += debug
}
include(sqxUiBase.pri)
The sqxUiBase.pri file contains the list of files that need to be built.
Now, the problem is that whatever I do, the resulting file is always named sqxUiBase.so.1.0.0, with a bunch of symlinks (sqxUiBase.so, sqxUiBase.so.1 and sqxUiBase.so.1.0) pointing to it. How can I make it so that there's only a sqxUiBase.so file and no links?
What you are looking for is making a plugin.
Add CONFIG += plugin to your project file, and qmake will generate a Makefile that builds a libFoo.so file, without the numbered links
After looking at the qmake source I found CONFIG += unversioned_libname for nix and CONFIG += skip_target_version_ext for windows.

Resources