Build RPM of Qt5 Application - qt5

predecessors.
I have a trouble in building RPM from my source code.
It is written in Qt5 with Qt5.7.0.
My system is Fedora 24.
I installed qt-opensource-linux-x64-5.7.0.run and built my code successfully.
But while building RPM, I have error in install stage.
My RPM file is as following.
Name: KPIViewer
Version: 1.0
Release: 1%{?dist}
Summary: KPIViewer
Group: Applications/Productivity
License: super2lao#gmail.com
#Source0: %{name}-%{version}-%(release).tar.gz
Source0: %{name}-%{version}.tar.gz
#BuildArch: i386
BuildRoot: %{_tmppath}/%{name}-root
Packager: PhonPanom Sivilay
Url: [http://www.kjbsoft.com]
Vendor: PhonPanom Sivilay
Requires: libtool
%define QT_LIB /opt/Qt5.7.0/5.7/gcc_64/lib/
%description
KPI Viewer
%prep
%setup -q -n %{name}-%{version}
%build
# % configure
qmake KPIViewer.pro
make %{?_smp_mflags} BINDIR=%{_bindir}
%install
mkdir -p $RPM_BUILD_ROOT/usr/{bin,share}
mkdir -p $RPM_BUILD_ROOT/usr/bin/%{name}
mkdir -p $RPM_BUILD_ROOT/usr/bin/%{name}/platforms
mkdir -p $RPM_BUILD_ROOT/usr/share/{applications,pixmaps}
mkdir -p $RPM_BUILD_ROOT%{QT_LIB}
install %{name} $RPM_BUILD_ROOT/usr/bin/%{name}
#install %{name}.sh $RPM_BUILD_ROOT/usr/bin/%{name}
#install %{QT_LIB}libQt5*.so.* $RPM_BUILD_ROOT/usr/bin/%{name}
#install %{QT_LIB}libicu*.so.* $RPM_BUILD_ROOT/usr/bin/%{name}
#install %{QT_LIB}libq* $RPM_BUILD_ROOT/usr/bin/%{name}/platforms
install %{QT_LIB}libQt5*.so.* $RPM_BUILD_ROOT%{QT_LIB}
install %{QT_LIB}libicu*.so.* $RPM_BUILD_ROOT%{QT_LIB}
install %{QT_LIB}libq* $RPM_BUILD_ROOT%{QT_LIB}
#install %{name}.desktop $RPM_BUILD_ROOT/usr/share/applications
#install %{name}.png $RPM_BUILD_ROOT/usr/share/pixmaps
%files
% defattr(-,root,root)
%{_bindir}/%{name}/%{name}
%{_bindir}/%{name}/%{name}.sh
%{_bindir}/%{name}/libicu*
%{_bindir}/%{name}/libQt5*
%{_bindir}/%{name}/platforms/libq*
%{_datadir}/applications/%{name}.desktop
%{_datadir}/pixmaps/%{name}.png
%clean
rm -rf $RPM_BUILD_ROOT
rm -rf $RPM_BUILD_DIR
%changelog
* Mon Aug 29 2016 super2lao
- Initial build
But in installation stage, I get the following errors.
extracting debug info from /home/makerpm/rpmbuild/BUILDROOT/KPIViewer-1.0-1.fc24.x86_64/usr/bin/KPIViewer/KPIViewer
extracting debug info from /home/makerpm/rpmbuild/BUILDROOT/KPIViewer-1.0-1.fc24.x86_64/opt/Qt5.7.0/5.7/gcc_64/lib/libicudata.so.56.1
xz: /tmp/tmp.JB9sU3EDbZ: No such file or directory
objcopy: cannot open: /tmp/tmp.JB9sU3EDbZ.xz: No such file or directory
extracting debug info from /home/makerpm/rpmbuild/BUILDROOT/KPIViewer-1.0-1.fc24.x86_64/opt/Qt5.7.0/5.7/gcc_64/lib/libicui18n.so.56
extracting debug info from /home/makerpm/rpmbuild/BUILDROOT/KPIViewer-1.0-1.fc24.x86_64/opt/Qt5.7.0/5.7/gcc_64/lib/libicudata.so.56
xz: /tmp/tmp.WVrLRUiOv4: No such file or directory
objcopy: cannot open: /tmp/tmp.WVrLRUiOv4.xz: No such file or directory
*** WARNING: identical binaries are copied, not linked:
/opt/Qt5.7.0/5.7/gcc_64/lib/libicudata.so.56
and /opt/Qt5.7.0/5.7/gcc_64/lib/libicudata.so.56.1
extracting debug info from /home/makerpm/rpmbuild/BUILDROOT/KPIViewer-1.0-1.fc24.x86_64/opt/Qt5.7.0/5.7/gcc_64/lib/libicui18n.so.56.1
*** WARNING: identical binaries are copied, not linked:
/opt/Qt5.7.0/5.7/gcc_64/lib/libicui18n.so.56.1
and /opt/Qt5.7.0/5.7/gcc_64/lib/libicui18n.so.56
extracting debug info from /home/makerpm/rpmbuild/BUILDROOT/KPIViewer-1.0-1.fc24.x86_64/opt/Qt5.7.0/5.7/gcc_64/lib/libicuuc.so.56
extracting debug info from /home/makerpm/rpmbuild/BUILDROOT/KPIViewer-1.0-1.fc24.x86_64/opt/Qt5.7.0/5.7/gcc_64/lib/libicuuc.so.56.1
*** WARNING: identical binaries are copied, not linked:
/opt/Qt5.7.0/5.7/gcc_64/lib/libicuuc.so.56.1
and /opt/Qt5.7.0/5.7/gcc_64/lib/libicuuc.so.56
dwz: Too few files for multifile optimization
/usr/lib/rpm/sepdebugcrcfix: Updated 0 CRC32s, 7 CRC32s did match.
+ '[' '%{buildarch}' = noarch ']'
+ QA_CHECK_RPATHS=1
+ case "${QA_CHECK_RPATHS:-}" in
+ /usr/lib/rpm/check-rpaths
*******************************************************************************
*
* WARNING: 'check-rpaths' detected a broken RPATH and will cause 'rpmbuild'
* to fail. To ignore these errors, you can set the '$QA_RPATHS'
* environment variable which is a bitmask allowing the values
* below. The current value of QA_RPATHS is 0x0000.
*
* 0x0001 ... standard RPATHs (e.g. /usr/lib); such RPATHs are a minor
* issue but are introducing redundant searchpaths without
* providing a benefit. They can also cause errors in multilib
* environments.
* 0x0002 ... invalid RPATHs; these are RPATHs which are neither absolute
* nor relative filenames and can therefore be a SECURITY risk
* 0x0004 ... insecure RPATHs; these are relative RPATHs which are a
* SECURITY risk
* 0x0008 ... the special '$ORIGIN' RPATHs are appearing after other
* RPATHs; this is just a minor issue but usually unwanted
* 0x0010 ... the RPATH is empty; there is no reason for such RPATHs
* and they cause unneeded work while loading libraries
* 0x0020 ... an RPATH references '..' of an absolute path; this will break
* the functionality when the path before '..' is a symlink
*
*
* Examples:
* - to ignore standard and empty RPATHs, execute 'rpmbuild' like
* $ QA_RPATHS=$(( 0x0001|0x0010 )) rpmbuild my-package.src.rpm
* - to check existing files, set $RPM_BUILD_ROOT and execute check-rpaths like
* $ RPM_BUILD_ROOT= /usr/lib/rpm/check-rpaths
*
*******************************************************************************
ERROR 0002: file '/usr/bin/KPIViewer/KPIViewer' contains an invalid rpath '/opt/Qt5.7.0/5.7/gcc_64/lib' in [/opt/Qt5.7.0/5.7/gcc_64/lib]
error: Bad exit status from /var/tmp/rpm-tmp.CbBYR1 (%install)
RPM build errors:
Bad exit status from /var/tmp/rpm-tmp.CbBYR1 (%install)
What is my fault?
Please help me.
Thank you for your time.

Fedora explains how to fix it here.
This usually works for me, in the spec file after the call to configure:
%configure
sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool

Related

FASTCGI Install on Raspberry PI Error - Cannot Manually Build Package

I have searched the internet all weekend and cannot find anyone who has had a similar error. I am trying to install libapache-mod-factcgi but the package errors out and I cannot figure out why.
pi#applejacks:/tmp $ sudo apt-get source -b libapache2-mod-fastcgi
Reading package lists... Done
Building dependency tree
Reading state information... Done
Skipping already downloaded file 'libapache-mod-fastcgi_2.4.7~0910052141-1.1+deb8u1.dsc'
Skipping already downloaded file 'libapache-mod-fastcgi_2.4.7~0910052141.orig.tar.gz'
Skipping already downloaded file 'libapache-mod-fastcgi_2.4.7~0910052141-1.1+deb8u1.diff.gz'
Need to get 0 B of source archives.
Skipping unpack of already unpacked source in libapache-mod-fastcgi-2.4.7~0910052141
dpkg-buildpackage: source package libapache-mod-fastcgi
dpkg-buildpackage: source version 2.4.7~0910052141-1.1+deb8u1
dpkg-buildpackage: source distribution jessie
dpkg-buildpackage: source changed by Andreas Beckmann <anbe#debian.org>
dpkg-buildpackage: host architecture armhf
dpkg-source --before-build libapache-mod-fastcgi-2.4.7~0910052141
debian/rules clean
dh_listpackages: Please specify the compatibility level in debian/compat
dh_listpackages: Compatibility levels before 5 are no longer supported (level 1 requested)
/usr/share/cdbs/1/rules/dpatch.mk:33: CDBS WARNING: dpatch.mk is deprecated since 0.4.85 - please use source format 3.0 (quilt) instead
test -x debian/rules
rmdir /tmp/libapache-mod-fastcgi-2.4.7~0910052141/build-tmp
rmdir: failed to remove ‘/tmp/libapache-mod-fastcgi-2.4.7~0910052141/build-tmp’: No such file or directory
/usr/share/cdbs/1/rules/buildcore.mk:46: recipe for target 'cleanbuilddir' failed
make: [cleanbuilddir] Error 1 (ignored)
dh_clean
dh_clean: Please specify the compatibility level in debian/compat
/usr/share/cdbs/1/rules/debhelper.mk:189: recipe for target 'clean' failed
make: *** [clean] Error 2
dpkg-buildpackage: error: debian/rules clean gave error exit status 2
Build command 'cd libapache-mod-fastcgi-2.4.7~0910052141 && dpkg-buildpackage -b -uc' failed.
E: Child process failed
I'm trying to build Apache2 on RPi also. These commands got the .deb building for me:
cd libapache-mod-fastcgi-2.4.7~0910052141;
echo 10 > debian/compat;
dpkg-buildpackage -b -uc
Then cd .. to go one level up, then install the package with dpkg -i ./libapache2-mod-fastcgi_2.4.7~0910052141-1.1+deb8u1_armhf.deb

How to include mruby after installing with rbenv/ruby-build?

I'm trying to compile the "Source Code (.c)" example from this tutorial.
I have installed mruby using rbenv: rbenv install mruby-1.2.0
I get an error when trying to compile the program:
$ gcc -std=c99 -Imruby/include test_program.c -o test_program
test_program.c:1:10: fatal error: 'mruby.h' file not found
#include "mruby.h"
^
1 error generated.
How am I supposed to reference the mruby library when installing via rbenv/ruby-build?
Seems like rbenv install mruby-1.2.0 doesn't install header files of mruby(it's only a dump of build/host directory after mruby is built):
% ls $(rbenv prefix mruby-1.2.0)
LEGAL bin lib mrbgems mrblib src
You need
# get mruby's code
git clone https://github.com/mruby/mruby.git mruby
# build mruby
cd mruby && rake
# go back to directory of `test_program.c`
cd ..
before test_program.c's compilation instead.
And you need mruby/build/host/lib/libmruby.a -lm compile options too.
add -lm
in mruby is /include directory in my source is possible -I mruby_directory/include
next add ~/mruby/build/host/lib/libmruby.a

Bazel build fails with "Executing genrule #six_archive//:copy_six failed" error while building syntaxnet

I'm trying to follow the instructions at syntaxnet's github page to build syntaxnet parser models.
My system is a Debian Wheezy. Shouldn't be very different from Ubuntu 14.04 LTS or 15.05. I have compiled bazel 0.2.2 (as opposed to 0.2.2b) from source and it appears to work correctly.
Whenever I launch the bazel test syntaxnet/... util/utf8/... command, no tests are executed (all skipped) with some quite cryptic error messages. Here's an example:
root#host:~/tensorflow_syntaxnet/models/syntaxnet# ../../bazel/output/bazel test syntaxnet/... util/utf8/...
Extracting Bazel installation...
.............
INFO: Found 65 targets and 12 test targets...
ERROR: /root/.cache/bazel/_bazel_root/74c6bab7a21f28ad02405b720243d086/external/six_archive/BUILD:1:1: Executing genrule #six_archive//:copy_six failed: namespace-sandbox failed: error executing command /root/.cache/bazel/_bazel_root/74c6bab7a21f28ad02405b720243d086/syntaxnet/_bin/namespace-sandbox ... (remaining 5 argument(s) skipped).
unshare failed with EINVAL even after 101 tries, giving up.
INFO: Elapsed time: 95.469s, Critical Path: 22.46s
//syntaxnet:arc_standard_transitions_test NO STATUS
//syntaxnet:beam_reader_ops_test NO STATUS
//syntaxnet:graph_builder_test NO STATUS
//syntaxnet:lexicon_builder_test NO STATUS
//syntaxnet:parser_features_test NO STATUS
//syntaxnet:parser_trainer_test NO STATUS
//syntaxnet:reader_ops_test NO STATUS
//syntaxnet:sentence_features_test NO STATUS
//syntaxnet:shared_store_test NO STATUS
//syntaxnet:tagger_transitions_test NO STATUS
//syntaxnet:text_formats_test NO STATUS
//util/utf8:unicodetext_unittest NO STATUS
Executed 0 out of 12 tests: 12 were skipped.
I'm using Oracle Java 8 JDK as recommended, and my compiler is:
~/tensorflow_syntaxnet/models/syntaxnet# gcc --version
gcc (Debian 4.7.2-5) 4.7.2
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Tried looking into the namespace-sandbox binary that's mentioned in the error message, but before I dive deep into this, I thought I'd ask here.
~/tensorflow_syntaxnet/models/syntaxnet# ls -l /root/.cache/bazel/_bazel_root/74c6bab7a21f28ad02405b720243d086/syntaxnet/_bin/namespace-sandbox
lrwxrwxrwx 1 root root 108 May 13 14:52 /root/.cache/bazel/_bazel_root/74c6bab7a21f28ad02405b720243d086/syntaxnet/_bin/namespace-sandbox -> /root/.cache/bazel/_bazel_root/install/ca381eaad1c931167a6355cb8a2b98cf/_embedded_binaries/namespace-sandbox
~/tensorflow_syntaxnet/models/syntaxnet# readlink /root/.cache/bazel/_bazel_root/74c6bab7a21f28ad02405b720243d086/syntaxnet/_bin/namespace-sandbox
/root/.cache/bazel/_bazel_root/install/ca381eaad1c931167a6355cb8a2b98cf/_embedded_binaries/namespace-sandbox
Command seems to work fine though:
~/tensorflow_syntaxnet/models/syntaxnet# file $(readlink /root/.cache/bazel/_bazel_root/74c6bab7a21f28ad02405b720243d086/syntaxnet/_bin/namespace-sandbox)
/root/.cache/bazel/_bazel_root/install/ca381eaad1c931167a6355cb8a2b98cf/_embedded_binaries/namespace-sandbox: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.26, BuildID[md5/uuid]=0xecfd97b6a6b9a193b045be13654bd55b, not stripped
~/tensorflow_syntaxnet/models/syntaxnet# /root/.cache/bazel/_bazel_root/install/ca381eaad1c931167a6355cb8a2b98cf/_embedded_binaries/namespace-sandbox
No command specified.
Usage: /root/.cache/bazel/_bazel_root/install/ca381eaad1c931167a6355cb8a2b98cf/_embedded_binaries/namespace-sandbox [-S sandbox-root] -- command arg1
provided: /root/.cache/bazel/_bazel_root/install/ca381eaad1c931167a6355cb8a2b98cf/_embedded_binaries/namespace-sandbox
Mandatory arguments:
-S <sandbox-root> directory which will become the root of the sandbox
-- command to run inside sandbox, followed by arguments
Optional arguments:
-W <working-dir> working directory
-T <timeout> timeout after which the child process will be terminated with SIGTERM
-t <timeout> in case timeout occurs, how long to wait before killing the child with SIGKILL
-d <dir> create an empty directory in the sandbox
-M/-m <source/target> system directory to mount inside the sandbox
Multiple directories can be specified and each of them will be mounted readonly.
The -M option specifies which directory to mount, the -m option specifies where to
mount it in the sandbox.
-n if set, a new network namespace will be created
-r if set, make the uid/gid be root, otherwise use nobody
-D if set, debug info will be printed
-l <file> redirect stdout to a file
-L <file> redirect stderr to a file
#FILE read newline-separated arguments from FILE
Any idea?
UPDATE: I have done exactly the same steps on a Ubuntu 14.04 LTS (my small workstation, as opposed to the production server running Debian) and everything works well there, with all tests passing. I wonder what's the difference.
Apparently some permission errors happens when setting up the sandbox. A quick workaround is to deactivate the sandbox by using --genrule_strategy=standalone --spawn_strategy=standalone (note that the second one is already specified in the TensorFlow rc file).
You can set those flag in your ~/.bazelrc:
echo "build --genrule_strategy=standalone --spawn_strategy=standalone" >>~/.bazelrc

Error when installing RMySQL on Windows 7

I have followed the instructions on this website for installing RMySQL on my 64 bit Windows 7 machine: http://www.ahschulz.de/2013/07/23/installing-rmysql-under-windows/
However I get the following error message: Any ideas? I have searched for some time for an answer with no luck - I wonder if the problem is the lack of a file called x86_64-w64-mingw32-gcc but I cannot figure out where this should come from or be stored.
install.packages("RMySQL", type = "source")
Installing package(s) into ‘C:/Users/lokell/Documents/R/win-library/2.14’
(as ‘lib’ is unspecified)
Warning: dependency ‘DBI’ is not available
trying URL 'http://cran.ma.imperial.ac.uk/src/contrib/RMySQL_0.10.2.tar.gz'
Content type 'application/x-gzip' length 52150 bytes (50 Kb)
opened URL
downloaded 50 Kb
* installing *source* package 'RMySQL' ...
** package 'RMySQL' successfully unpacked and MD5 sums checked
** libs
rm -f RMySQL-init.o connection.o db-apply.o driver.o exception.o fields.o result.o utils.o
"C:/PROGRA~1/R/R-214~1.1/bin/x64/Rscript.exe" "../tools/winlibs.R"
x86_64-w64-mingw32-gcc -I"C:/PROGRA~1/R/R-214~1.1/include" -I../windows/libmariadbclient-2.1.0/include -I"d:/RCompile/CRANpkg/extralibs64/local/include" -O2 -Wall -std=gnu99 -mtune=core2 -c RMySQL-init.c -o RMySQL-init.o
x86_64-w64-mingw32-gcc: not found
make: *** [RMySQL-init.o] Error 127
ERROR: compilation failed for package 'RMySQL'
* removing 'C:/Users/lokell/Documents/R/win-library/2.14/RMySQL'
The downloaded packages are in
‘C:\Users\lokell\AppData\Local\Temp\RtmpkPZRnB\downloaded_packages’
Warning messages:
1: running command 'C:/PROGRA~1/R/R-214~1.1/bin/x64/R CMD INSTALL -l "C:/Users/lokell/Documents/R/win-library/2.14" C:\Users\lokell\AppData\Local\Temp\RtmpkPZRnB/downloaded_packages/RMySQL_0.10.2.tar.gz' had status 1
2: In install.packages("RMySQL", type = "source") :
installation of package ‘RMySQL’ had non-zero exit status

Problems adding DKMS support to kernel module

I'm trying to add DKMS support in a kernel module i'm working on.
I have placed the kernel module source with a static lib to be linked against in the following directory:
/usr/src/dpx/1.0
With the following files:
dkms.conf
Makefile
dpxmtt.c
lib.a
dkms.conf file is like this:
MAKE="make"
CLEAN="make clean"
BUILT_MODULE_NAME=dpx
BUILT_MODULE_LOCATION=src/
DEST_MODULE_LOCATION=/kernel/drivers/input/touchscreen
PACKAGE_NAME=dpxm
PACKAGE_VERSION=1.0
REMAKE_INITRD=yes
And the makefile is like this:
EXTRA_CFLAGS+=-DLINUX_DRIVER -mhard-float
obj-m += dpx.o
dpx-objs:= dpxmtt.o ../source/lib.a
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
The ../source/lib.a is an hack since when the makefile is invoked by the dkms building system it was saying that it couldn't be found in directory (the build directory), but since it was being copied to the source directory, i'm referencing it relatively.
When I call
sudo dkms build -m dpx -v 1.0
The result is almost perfect:
santos#NS-PC:~$ sudo dkms build -m dpx -v 1.0
Kernel preparation unnecessary for this kernel. Skipping...
Building module:
cleaning build area....
make KERNELRELEASE=3.0.0-14-generic....
ERROR (dkms apport): binary package for dpx: 1.0 not found
Error! Build of dpx.ko failed for: 3.0.0-14-generic (i686)
Consult the make.log in the build directory
/var/lib/dkms/dpx/1.0/build/ for more information.
nsantos#NS-PC:~$
And the content of the log file is:
DKMS make.log for dpx-1.0 for kernel 3.0.0-14-generic (i686)
Thu Jan 19 11:07:54 WET 2012
make -C /lib/modules/3.0.0-14-generic/build M=/var/lib/dkms/dpx/1.0/build modules
make[1]: Entering directory `/usr/src/linux-headers-3.0.0-14-generic'
CC [M] /var/lib/dkms/dpx/1.0/build/dpxmtt.o
LD [M] /var/lib/dkms/dpx/1.0/build/dpx.o
Building modules, stage 2.
MODPOST 1 modules
CC /var/lib/dkms/dpx/1.0/build/dpx.mod.o
LD [M] /var/lib/dkms/dpx/1.0/build/dpx.ko
make[1]: Leaving directory `/usr/src/linux-headers-3.0.0-14-generic'
The module was built correctly but it ends with the error:
ERROR (dkms apport): binary package for dpx: 1.0 not found
Error! Build of dpx.ko failed for: 3.0.0-14-generic (i686)
And I don't know what it means. Does anybody know?
Using:
$(shell uname -r)
in the Makefile it might be also wrong! The "shell uname -r" refers to the currently running kernel, but the main reason to use the dkms it's because it offers an automated method to recompile the kernel modules that reside outside of the kernel tree for every newly installed kernel. What i mean is that the Makefile might refers to a different kernel which the dkms is building the module for.
Use:
${kernelver} instead.
I had a similar problem. I think your BUILT_MODULE_LOCATION is set incorrectly to the src directory. It should be set in your example to the current directory, or you can just omit this variable and dkms would default to the current directory.