openWRT Makefile for python backports-abc - openwrt

I'm attempting to build the backports-abc python module in to my OpenWRT build, and need a bit of help on the build/extraction process.
My issue seems to be that the downloaded backports-abc tar file extracts the content to backports_abc-0.5 due to the underlying tar file structure, but the build process is looking for the setup.py etc under backports-abc-0.5 (see below). I can manually copy the files over and rebuild, and that works fine, but that's not ideal. Also, though it builds OK, when I load the image to the device, the backports module is missing.
/home/ubuntu/build2/openwrt/staging_dir/host/bin/python2: can't open file './setup.py': [Errno 2] No such file or directory
Makefile:59: recipe for target '/home/ubuntu/build2/openwrt/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/backports-abc-0.5//.built' failed
make[3]: *** [/home/ubuntu/build2/openwrt/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/backports-abc-0.5//.built] Error 2
make[3]: Leaving directory '/home/ubuntu/build2/openwrt/feeds/linkit/python-backports-abc
'
The openWRT documentation around Makefiles is a bit vague, and so is my understanding of the process.
How do I get the tar file extracted to the right folder, or where in the Makefile process should I just copy the files to a correct folder?
Here's my Makefile.
include $(TOPDIR)/rules.mk
PKG_NAME:=backports_abc
PKG_VERSION:=0.5
PKG_RELEASE:=1
PKG_SOURCE:=backports_abc-0.5.tar.gz
PKG_SOURCE_URL:=https://pypi.python.org/packages/68/3c/1317a9113c377d1e33711ca8de1e80afbaf4a3c950dd0edfaf61f9bfe6d8/
PKG_MD5SUM:=7d1936ec183a3586290adf60f6f96764
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)/
#PKG_BUILD_DEPENDS:=python-setuptools
include $(INCLUDE_DIR)/package.mk
$(call include_mk, python-package.mk)
define Package/backports_abc
SECTION:=lang-python
CATEGORY:=Languages
SUBMENU:=Python
TITLE:=backports_abc
URL:=https://pypi.python.org/pypi/backports_abc/0.5
DEPENDS:=+python
endef
define Package/backports_abc/description
A backport of recent additions to the 'collections.abc' module.
endef
define Build/Compile
$(call Build/Compile/PyMod,., \
install --prefix="/usr" --root="$(PKG_INSTALL_DIR)" \
)
endef
define Build/InstallDev
$(INSTALL_DIR) $(STAGING_DIR)$(PYTHON_PKG_DIR)
$(CP) \
$(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \
$(STAGING_DIR)$(PYTHON_PKG_DIR)/
[ ! -e $(PKG_INSTALL_DIR)/usr/include ] || $(CP) \
$(PKG_INSTALL_DIR)/usr/include/* \
$(STAGING_DIR)/usr/include/
endef
define Package/backportsabc/install
$(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)/
$(CP) \
$(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \
$(1)$(PYTHON_PKG_DIR)/
endef
$(eval $(call BuildPackage,backports_abc))

Copy your Makefile somewhere in packages directory, and to overcome the issue remove PKG_BUILD_DIR variable from your Makefile.

I resolved this by fixing up some underscores and hyphens... ie: backports_abc and backports-abc
Basically..
This... PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)/
meant that it was looking for the files based on the PKG_NAME variable.
include $(TOPDIR)/rules.mk
PKG_NAME:=backports_abc
PKG_VERSION:=0.5
PKG_RELEASE:=1
PKG_SOURCE:=backports_abc-0.5.tar.gz
PKG_SOURCE_URL:=https://pypi.python.org/packages/68/3c/1317a9113c377d1e33711ca8de1e80afbaf4a3c950dd0edfaf61f9bfe6d8/
PKG_MD5SUM:=7d1936ec183a3586290adf60f6f96764
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)/
#PKG_BUILD_DEPENDS:=python-setuptools
include $(INCLUDE_DIR)/package.mk
$(call include_mk, python-package.mk)
define Package/backports-abc
SECTION:=lang-python
CATEGORY:=Languages
SUBMENU:=Python
TITLE:=backports-abc
URL:=https://pypi.python.org/pypi/backports_abc/0.5
DEPENDS:=+python
endef
define Package/backports-abc/description
A backport of recent additions to the 'collections.abc' module.
endef
define Build/Compile
$(call Build/Compile/PyMod,., \
install --prefix="/usr" --root="$(PKG_INSTALL_DIR)" \
)
endef
define Build/InstallDev
$(INSTALL_DIR) $(STAGING_DIR)$(PYTHON_PKG_DIR)
$(CP) \
$(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \
$(STAGING_DIR)$(PYTHON_PKG_DIR)/
[ ! -e $(PKG_INSTALL_DIR)/usr/include ] || $(CP) \
$(PKG_INSTALL_DIR)/usr/include/* \
$(STAGING_DIR)/usr/include/
endef
define Package/backports-abc/install
$(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)/
$(CP) \
$(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \
$(1)$(PYTHON_PKG_DIR)/
endef
$(eval $(call BuildPackage,backports-abc))

Related

Building and linking lua from source via makefile

I've tried to compile and link lua with my application. This is my makefile:
app.o: app.cpp
g++ -c app.cpp
PATH_LUA=../lua-5.4.3/src
LUA= \
$(PATH_LUA)/lapi.c \
$(PATH_LUA)/lauxlib.c \
$(PATH_LUA)/lbaselib.c \
$(PATH_LUA)/lcode.c \
$(PATH_LUA)/lcorolib.c \
$(PATH_LUA)/lctype.c \
$(PATH_LUA)/ldblib.c \
$(PATH_LUA)/ldebug.c \
$(PATH_LUA)/ldo.c \
$(PATH_LUA)/ldump.c \
$(PATH_LUA)/lfunc.c \
$(PATH_LUA)/lgc.c \
$(PATH_LUA)/linit.c \
$(PATH_LUA)/liolib.c \
$(PATH_LUA)/llex.c \
$(PATH_LUA)/lmathlib.c \
$(PATH_LUA)/lmem.c \
$(PATH_LUA)/loadlib.c \
$(PATH_LUA)/lobject.c \
$(PATH_LUA)/lopcodes.c \
$(PATH_LUA)/loslib.c \
$(PATH_LUA)/lparser.c \
$(PATH_LUA)/lstate.c \
$(PATH_LUA)/lstring.c \
$(PATH_LUA)/lstrlib.c \
$(PATH_LUA)/ltable.c \
$(PATH_LUA)/ltablib.c \
$(PATH_LUA)/ltm.c \
$(PATH_LUA)/lundump.c \
$(PATH_LUA)/lutf8lib.c \
$(PATH_LUA)/lvm.c \
$(PATH_LUA)/lzio.c
libLua.so:
g++ -shared $(LUA) -fPIC -o lua/libLua.so
all: libLua.so app.o
g++ -o app app.o -I$(PATH_LUA) -lLua -Llua -ldl
The compilation works fine, but something is wrong with the linkage, because I get tons of undefined references to "lua_XYZ-function". The undefined reference to lua_tointegerx for example makes no sense, since its implementation is located in lapi.c which is in the file-list above.
(INB4: "This is a duplicate question!" … I've tried my best to check them all.)
What am I missing?
You are putting the libLua.so (by the way, personally I think it's a really bad idea to name your library the same name as the standard library, just uppercase... there's no way that can't bite you or someone in the rear at some point) in the lua subdirectory but you don't tell the linker where to find it.
Then, you list liblua.a as the prerequisite, but you have no actual rule to build liblua.a, which means make will come up with one based on its internal rules... whatever rule it uses will certainly not include all your source files (how could it know?).
If you show us the actual output of running make (before all the error messages) it should be pretty clear this has gone wrong from the beginning.
Speaking from a strictly makefile perspective, it's virtually always wrong to have the name of the file your recipe builds be different than the name of the target in the makefile.
You have to compile lua as c++-code explicitly.
You do this by including
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
instead of
#include <lua.hpp> which includes that extern "C" {...} statement.

makeinfo command not found in pbuilder-dist

I am trying following tutorial in Ubuntu 18.04.5 LTS (in docker in MacOS Catalina 10.15.4).
https://packaging.ubuntu.com/html/packaging-new-software.html
When I exec command below in step 4.4. Next Steps, I got error (/build/hello-2.10/build-aux/missing: line 81: makeinfo: command not found).
Though I already installed makeinfo, why did the error occur and how to fix it?
tester#d88221b85d5a:~/workspace/build-area$ sudo pbuilder-dist bionic build hello_2.10-0ubuntu1.dsc
...
make[3]: Entering directory '/build/hello-2.10'
restore=: && backupdir=".am$$" && \
am__cwd=`pwd` && CDPATH="${ZSH_VERSION+.}:" && cd . && \
rm -rf $backupdir && mkdir $backupdir && \
if (/bin/bash /build/hello-2.10/build-aux/missing makeinfo --version) >/dev/null 2>&1; then \
for f in doc/hello.info doc/hello.info-[0-9] doc/hello.info-[0-9][0-9] doc/hello.i[0-9] doc/hello.i[0-9][0-9]; do \
if test -f $f; then mv $f $backupdir; restore=mv; else :; fi; \
done; \
else :; fi && \
cd "$am__cwd"; \
if /bin/bash /build/hello-2.10/build-aux/missing makeinfo -I doc -I ./doc \
-o doc/hello.info ./doc/hello.texi; \
then \
rc=0; \
CDPATH="${ZSH_VERSION+.}:" && cd .; \
else \
rc=$?; \
CDPATH="${ZSH_VERSION+.}:" && cd . && \
$restore $backupdir/* `echo "./doc/hello.info" | sed 's|[^/]*$||'`; \
fi; \
rm -rf $backupdir; exit $rc
/build/hello-2.10/build-aux/missing: line 81: makeinfo: command not found
WARNING: 'makeinfo' is missing on your system.
You should only need it if you modified a '.texi' file, or
any other file indirectly affecting the aspect of the manual.
You might want to install the Texinfo package:
<http://www.gnu.org/software/texinfo/>
The spurious makeinfo call might also be the consequence of
using a buggy 'make' (AIX, DU, IRIX), in which case you might
want to install GNU make:
<http://www.gnu.org/software/make/>
Makefile:1683: recipe for target 'doc/hello.info' failed
make[3]: *** [doc/hello.info] Error 127
make[3]: Leaving directory '/build/hello-2.10'
Makefile:1890: recipe for target 'check-recursive' failed
make[2]: *** [check-recursive] Error 1
Makefile:2374: recipe for target 'check' failed
make[1]: *** [check] Error 2
dh_auto_test: make -j4 -O check VERBOSE=1 returned exit code 2
debian/rules:3: recipe for target 'build' failed
make: *** [build] Error 25
dpkg-buildpackage: error: debian/rules build subprocess returned exit status 2
E: Failed autobuilding of package
I: unmounting dev/ptmx filesystem
I: unmounting dev/pts filesystem
I: unmounting dev/shm filesystem
I: unmounting proc filesystem
I: unmounting sys filesystem
I: cleaning the build env
I: removing directory /var/cache/pbuilder/build/12573 and its subdirectories
Actually, in my environment, makeinfo command exists, so I'm confusing why pbuilder-dist does not find makeinfo command.
tester#d88221b85d5a:~/workspace/build-area$ which makeinfo
/usr/bin/makeinfo
tester#d88221b85d5a:~/workspace/build-area$ makeinfo --version
texi2any (GNU texinfo) 6.5
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Here is my Dockerfile and entrypoint.sh which I suppose that I installed texinfo to use makeinfo.
Dockerfile
FROM ubuntu:18.04
MAINTAINER ntb
RUN apt update
RUN apt install -y \
language-pack-ja=1:18.04+20190718 \
vim=2:8.0.1453-1ubuntu1.4 \
build-essential=12.4ubuntu1 \
libgtk2.0-dev=2.24.32-1ubuntu1 \
dpkg-dev=1.19.0.5ubuntu2.3 \
debhelper=12.1.1ubuntu1~ubuntu18.04.1 \
devscripts=2.17.12ubuntu1.1 \
fakeroot=1.22-2ubuntu1 \
lintian=2.5.81ubuntu1 \
dh-make=2.201701 \
devscripts=2.17.12ubuntu1.1 \
texinfo=6.5.0.dfsg.1-2 \
software-properties-common=0.96.24.32.14 \
sudo=1.8.21p2-3ubuntu1.2 \
gnupg \
pbuilder \
ubuntu-dev-tools \
apt-file
RUN useradd \
-m --uid 1000 --groups sudo tester -s /bin/bash \
&& echo tester:tester | chpasswd
ENV PATH /home/tester/bin:$PATH
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/entrypoint.sh
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
entrypoint.sh
#!/bin/bash
groupmod -g ${GROUP_ID} tester
usermod -u ${USER_ID} -o tester
echo "export PATH=/home/tester/bin:$PATH" > /home/tester/.bashrc
echo "export DEBFULLNAME="foo"" >> /home/tester/.bashrc
echo "export DEBEMAIL="bar"" >> /home/tester/.bashrc
chown tester /home/tester/.bashrc
chgrp tester /home/tester/.bashrc
ttyfile=$(ls -l `tty`)
chown tester $ttyfile
su tester
Additional Information
That's interesting. Indeed texi2any is a Perl-script, so if doesn't start, there might be some problem with /usr/bin/perl but what it could be?
Here is my texi2any and perl in the container.
tester#d88221b85d5a:~/workspace/build-area$ texi2any --version
texi2any (GNU texinfo) 6.5
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
tester#d88221b85d5a:~/workspace/build-area$ which perl
/usr/bin/perl
tester#d88221b85d5a:~/workspace/build-area$ /usr/bin/perl -V
Summary of my perl5 (revision 5 version 26 subversion 1) configuration:
Platform:
osname=linux
osvers=4.9.0
archname=x86_64-linux-gnu-thread-multi
uname='linux localhost 4.9.0 #1 smp debian 4.9.0 x86_64 gnulinux '
config_args='-Dusethreads -Duselargefiles -Dcc=x86_64-linux-gnu-gcc -Dcpp=x86_64-linux-gnu-cpp -Dld=x86_64-linux-gnu-gcc -Dccflags=-DDEBIAN -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -fdebug-prefix-map=/build/perl-kahdkK/perl-5.26.1=. -fstack-protector-strong -Wformat -Werror=format-security -Dldflags= -Wl,-Bsymbolic-functions -Wl,-z,relro -Dlddlflags=-shared -Wl,-Bsymbolic-functions -Wl,-z,relro -Dcccdlflags=-fPIC -Darchname=x86_64-linux-gnu -Dprefix=/usr -Dprivlib=/usr/share/perl/5.26 -Darchlib=/usr/lib/x86_64-linux-gnu/perl/5.26 -Dvendorprefix=/usr -Dvendorlib=/usr/share/perl5 -Dvendorarch=/usr/lib/x86_64-linux-gnu/perl5/5.26 -Dsiteprefix=/usr/local -Dsitelib=/usr/local/share/perl/5.26.1 -Dsitearch=/usr/local/lib/x86_64-linux-gnu/perl/5.26.1 -Dman1dir=/usr/share/man/man1 -Dman3dir=/usr/share/man/man3 -Dsiteman1dir=/usr/local/man/man1 -Dsiteman3dir=/usr/local/man/man3 -Duse64bitint -Dman1ext=1 -Dman3ext=3perl -Dpager=/usr/bin/sensible-pager -Uafs -Ud_csh -Ud_ualarm -Uusesfio -Uusenm -Ui_libutil -Ui_xlocale -Uversiononly -DDEBUGGING=-g -Doptimize=-O2 -dEs -Duseshrplib -Dlibperl=libperl.so.5.26.1'
hint=recommended
useposix=true
d_sigaction=define
useithreads=define
usemultiplicity=define
use64bitint=define
use64bitall=define
uselongdouble=undef
usemymalloc=n
default_inc_excludes_dot=define
bincompat5005=undef
Compiler:
cc='x86_64-linux-gnu-gcc'
ccflags ='-D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fwrapv -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'
optimize='-O2 -g'
cppflags='-D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fwrapv -fno-strict-aliasing -pipe -I/usr/local/include'
ccversion=''
gccversion='7.5.0'
gccosandvers=''
intsize=4
longsize=8
ptrsize=8
doublesize=8
byteorder=12345678
doublekind=3
d_longlong=define
longlongsize=8
d_longdbl=define
longdblsize=16
longdblkind=3
ivtype='long'
ivsize=8
nvtype='double'
nvsize=8
Off_t='off_t'
lseeksize=8
alignbytes=8
prototype=define
Linker and Libraries:
ld='x86_64-linux-gnu-gcc'
ldflags =' -fstack-protector-strong -L/usr/local/lib'
libpth=/usr/local/lib /usr/lib/gcc/x86_64-linux-gnu/7/include-fixed /usr/include/x86_64-linux-gnu /usr/lib /lib/x86_64-linux-gnu /lib/../lib /usr/lib/x86_64-linux-gnu /usr/lib/../lib /lib
libs=-lgdbm -lgdbm_compat -ldb -ldl -lm -lpthread -lc -lcrypt
perllibs=-ldl -lm -lpthread -lc -lcrypt
libc=libc-2.27.so
so=so
useshrplib=true
libperl=libperl.so.5.26
gnulibc_version='2.27'
Dynamic Linking:
dlsrc=dl_dlopen.xs
dlext=so
d_dlsymun=undef
ccdlflags='-Wl,-E'
cccdlflags='-fPIC'
lddlflags='-shared -L/usr/local/lib -fstack-protector-strong'
Characteristics of this binary (from libperl):
Compile-time options:
HAS_TIMES
MULTIPLICITY
PERLIO_LAYERS
PERL_COPY_ON_WRITE
PERL_DONT_CREATE_GVSV
PERL_IMPLICIT_CONTEXT
PERL_MALLOC_WRAP
PERL_OP_PARENT
PERL_PRESERVE_IVUV
USE_64_BIT_ALL
USE_64_BIT_INT
USE_ITHREADS
USE_LARGE_FILES
USE_LOCALE
USE_LOCALE_COLLATE
USE_LOCALE_CTYPE
USE_LOCALE_NUMERIC
USE_LOCALE_TIME
USE_PERLIO
USE_PERL_ATOF
USE_REENTRANT_API
Locally applied patches:
DEBPKG:debian/cpan_definstalldirs - Provide a sensible INSTALLDIRS default for modules installed from CPAN.
DEBPKG:debian/db_file_ver - https://bugs.debian.org/340047 Remove overly restrictive DB_File version check.
DEBPKG:debian/doc_info - Replace generic man(1) instructions with Debian-specific information.
DEBPKG:debian/enc2xs_inc - https://bugs.debian.org/290336 Tweak enc2xs to follow symlinks and ignore missing #INC directories.
DEBPKG:debian/errno_ver - https://bugs.debian.org/343351 Remove Errno version check due to upgrade problems with long-running processes.
DEBPKG:debian/libperl_embed_doc - https://bugs.debian.org/186778 Note that libperl-dev package is required for embedded linking
DEBPKG:fixes/respect_umask - Respect umask during installation
DEBPKG:debian/writable_site_dirs - Set umask approproately for site install directories
DEBPKG:debian/extutils_set_libperl_path - EU:MM: set location of libperl.a under /usr/lib
DEBPKG:debian/no_packlist_perllocal - Don't install .packlist or perllocal.pod for perl or vendor
DEBPKG:debian/fakeroot - Postpone LD_LIBRARY_PATH evaluation to the binary targets.
DEBPKG:debian/instmodsh_doc - Debian policy doesn't install .packlist files for core or vendor.
DEBPKG:debian/ld_run_path - Remove standard libs from LD_RUN_PATH as per Debian policy.
DEBPKG:debian/libnet_config_path - Set location of libnet.cfg to /etc/perl/Net as /usr may not be writable.
DEBPKG:debian/perlivp - https://bugs.debian.org/510895 Make perlivp skip include directories in /usr/local
DEBPKG:debian/deprecate-with-apt - https://bugs.debian.org/747628 Point users to Debian packages of deprecated core modules
DEBPKG:debian/squelch-locale-warnings - https://bugs.debian.org/508764 Squelch locale warnings in Debian package maintainer scripts
DEBPKG:debian/patchlevel - https://bugs.debian.org/567489 List packaged patches for 5.26.1-6ubuntu0.5 in patchlevel.h
DEBPKG:fixes/document_makemaker_ccflags - https://bugs.debian.org/628522 [rt.cpan.org #68613] Document that CCFLAGS should include $Config{ccflags}
DEBPKG:debian/find_html2text - https://bugs.debian.org/640479 Configure CPAN::Distribution with correct name of html2text
DEBPKG:debian/perl5db-x-terminal-emulator.patch - https://bugs.debian.org/668490 Invoke x-terminal-emulator rather than xterm in perl5db.pl
DEBPKG:debian/cpan-missing-site-dirs - https://bugs.debian.org/688842 Fix CPAN::FirstTime defaults with nonexisting site dirs if a parent is writable
DEBPKG:fixes/memoize_storable_nstore - [rt.cpan.org #77790] https://bugs.debian.org/587650 Memoize::Storable: respect 'nstore' option not respected
DEBPKG:debian/makemaker-pasthru - https://bugs.debian.org/758471 Pass LD settings through to subdirectories
DEBPKG:debian/makemaker-manext - https://bugs.debian.org/247370 Make EU::MakeMaker honour MANnEXT settings in generated manpage headers
DEBPKG:debian/kfreebsd-softupdates - https://bugs.debian.org/796798 Work around Debian Bug#796798
DEBPKG:fixes/autodie-scope - https://bugs.debian.org/798096 Fix a scoping issue with "no autodie" and the "system" sub
DEBPKG:fixes/memoize-pod - [rt.cpan.org #89441] Fix POD errors in Memoize
DEBPKG:debian/hurd-softupdates - https://bugs.debian.org/822735 Fix t/op/stat.t failures on hurd
DEBPKG:fixes/math_complex_doc_great_circle - https://bugs.debian.org/697567 [rt.cpan.org #114104] Math::Trig: clarify definition of great_circle_midpoint
DEBPKG:fixes/math_complex_doc_see_also - https://bugs.debian.org/697568 [rt.cpan.org #114105] Math::Trig: add missing SEE ALSO
DEBPKG:fixes/math_complex_doc_angle_units - https://bugs.debian.org/731505 [rt.cpan.org #114106] Math::Trig: document angle units
DEBPKG:fixes/cpan_web_link - https://bugs.debian.org/367291 CPAN: Add link to main CPAN web site
DEBPKG:fixes/time_piece_doc - https://bugs.debian.org/817925 Time::Piece: Improve documentation for add_months and add_years
DEBPKG:fixes/extutils_makemaker_reproducible - https://bugs.debian.org/835815 https://bugs.debian.org/834190 Make perllocal.pod files reproducible
DEBPKG:fixes/file_path_hurd_errno - File-Path: Fix test failure in Hurd due to hard-coded ENOENT
DEBPKG:debian/hppa_op_optimize_workaround - https://bugs.debian.org/838613 Temporarily lower the optimization of op.c on hppa due to gcc-6 problems
DEBPKG:debian/installman-utf8 - https://bugs.debian.org/840211 Generate man pages with UTF-8 characters
DEBPKG:fixes/file_path_chmod_race - https://bugs.debian.org/863870 [rt.cpan.org #121951] Prevent directory chmod race attack.
DEBPKG:fixes/extutils_file_path_compat - Correct the order of tests of chmod(). (#294)
DEBPKG:fixes/getopt-long-2 - [rt.cpan.org #120300] Withdraw part of commit 5d9947fb445327c7299d8beb009d609bc70066c0, which tries to implement more GNU getopt_long campatibility. GNU
DEBPKG:fixes/getopt-long-3 - provide a default value for optional arguments
DEBPKG:fixes/getopt-long-4 - https://bugs.debian.org/864544 [rt.cpan.org #122068] Fix issue #122068.
DEBPKG:fixes/test-builder-reset - https://bugs.debian.org/865894 Reset inside subtest maintains parent
DEBPKG:debian/hppa_opmini_optimize_workaround - https://bugs.debian.org/869122 Lower the optimization level of opmini.c on hppa
DEBPKG:debian/sh4_op_optimize_workaround - https://bugs.debian.org/869373 Also lower the optimization level of op.c and opmini.c on sh4
DEBPKG:fixes/json-pp-example - [rt.cpan.org #92793] https://bugs.debian.org/871837 fix RT-92793: bug in SYNOPSIS
DEBPKG:debian/perldoc-pager - https://bugs.debian.org/870340 [rt.cpan.org #120229] Fix perldoc terminal escapes when sensible-pager is less
DEBPKG:debian/prune_libs - https://bugs.debian.org/128355 Prune the list of libraries wanted to what we actually need.
DEBPKG:debian/configure-regen - https://bugs.debian.org/762638 Regenerate Configure et al. after probe unit changes
DEBPKG:fixes/rename-filexp.U-phase1 - regen-configure: rename filexp.U to filexp_path.U, phase 1
DEBPKG:fixes/rename-filexp.U-phase2 - regen-configure: rename filexp.U to filexp_path.U, phase 2
DEBPKG:fixes/packaging_test_skips - Skip various tests if PERL_BUILD_PACKAGING is set
DEBPKG:debian/mod_paths - Tweak #INC ordering for Debian
DEBPKG:fixes/encode-alias-regexp - https://bugs.debian.org/880085 fix https://github.com/dankogai/p5-encode/issues/127
DEBPKG:fixes/regex-memory-leak - [910a6a8] https://bugs.debian.org/891196 [perl #132892] perl #132892: avoid leak by mortalizing temporary copy of pattern
DEBPKG:fixes/CVE-2018-6797 - [perl #132227] (perl #132227) restart a node if we change to uni rules within the node and encounter a sharp S
DEBPKG:fixes/CVE-2018-6798/pt1 - [perl #132063] Heap buffer overflow
DEBPKG:fixes/CVE-2018-6798/pt2 - [perl #132063] 5.26.1: fix TRIE_READ_CHAR and DECL_TRIE_TYPE to account for non-utf8 target
DEBPKG:fixes/CVE-2018-6798/pt3 - [perl #132063] (perl #132063) we should no longer warn for this code
DEBPKG:fixes/CVE-2018-6798/pt4 - [perl #132063] utf8.c: Don't dump malformation past first NUL
DEBPKG:fixes/CVE-2018-6913 - [perl #131844] (perl #131844) fix various space calculation issues in pp_pack.c
DEBPKG:fixes/CVE-2018-12015.patch - [PATCH] [PATCH] Remove existing files before overwriting them
DEBPKG:fixes/CVE-2018-18311.patch - [PATCH] Perl_my_setenv(); handle integer wrap
DEBPKG:fixes/CVE-2018-18312.patch - [PATCH 242/242] PATCH: [perl #133423] for 5.26 maint
DEBPKG:fixes/CVE-2018-18313.patch - [PATCH] regcomp.c: Convert some strchr to memchr
DEBPKG:fixes/CVE-2018-18314.patch - [PATCH] fix #131649 - extended charclass can trigger assert
DEBPKG:fixes/CVE-2020-10543.patch - [PATCH v528 1/3] regcomp.c: Prevent integer overflow from nested regex quantifiers.
DEBPKG:fixes/CVE-2020-10878.patch - [PATCH v528 2/3] study_chunk: extract rck_elide_nothing
DEBPKG:fixes/CVE-2020-12723.patch - [PATCH v528 3/3] study_chunk: avoid mutating regexp program within GOSUB
DEBPKG:fixes/fix_test_2020.patch - [PATCH] Fix Time::Local tests
Built under linux
Compiled at Oct 19 2020 10:57:24
#INC:
/etc/perl
/usr/local/lib/x86_64-linux-gnu/perl/5.26.1
/usr/local/share/perl/5.26.1
/usr/lib/x86_64-linux-gnu/perl5/5.26
/usr/share/perl5
/usr/lib/x86_64-linux-gnu/perl/5.26
/usr/share/perl/5.26
/usr/local/lib/site_perl
/usr/lib/x86_64-linux-gnu/perl-base

How to cross-compile Coreutils or other GNU projects with clang/LLVM?

I have a tough need to compile Coreutils with llvm for other arch: arm/aarch64/mips/mips32/ppc/ppc32...
Since I install all the gcc-cross tools like mips-linux-gnu, powerpc64-linux-gnu and if I have a simple C program like that test.c
#include<stdio.h>
int main(){
printf("hello!");
return 0;
}
I can compile it to the arch, i.e.
clang --target=mips64-linux-gnuabi64 test.c -o test-mips64
➜ tests file test-mips64
test-mips64: ELF 64-bit MSB executable, MIPS, MIPS64 rel2 version 1 (SYSV), dynamically linked, interpreter /lib64/ld.so.1, BuildID[sha1]=7b33d55a0d08e6cd18d966341590dc351e346a78, for GNU/Linux 3.2.0, not stripped
I try to the same way for compile Coreutils that try to set
export CC=clang
export CXX=clang++
CFLAGS = "--target=mips64-linux-gnuabi64"
./configure --host=mips64-linux-gnuabi64
Howerver, every time got errors in configure or make...
How should I set the configure? Can I easily compile Coreuntils with llvm for other archs?
It's a bit tricky to get the command-line options right for cross-compiling. I got it to work with the commands below, assuming you're working on a Debian-based system (like Debian or Ubuntu). Here are the steps.
Install gcc-mips64-linux-gnuabi64 and gcc-powerpc64-linux-gnu.
Choose the correct arguments for CFLAGS
-B/usr/mips64-linux-gnuabi64/bin/ to indicate we want to use the linker ld within that directory. Do the same for powerpc.
--target=mips64-linux-gnuabi64 to indicate what our target for compilation is. Do the same for powerpc.
-I/usr/mips64-linux-gnuabi64/include to include header files. Do the same for powerpc.
Use ./configure --host=mips64-linux-gnuabi to configure for mips64 and ./configure --host=powerpc64-linux-gnueabi to configure for powerpc64.
Here are the commands to compile for mips64:
make clean
CFLAGS="-B/usr/mips64-linux-gnuabi64/bin/ --target=mips64-linux-gnuabi64 -I/usr/mips64-linux-gnuabi64/include" \
./configure --host=mips64-linux-gnuabi
make
And the commands to compile for powerpc64:
make clean
CFLAGS="-B/usr/powerpc64-linux-gnu/bin/ --target=powerpc64-linux-gnueabi -I/usr/powerpc64-linux-gnu/include" \
./configure --host=powerpc64-linux-gnueabi
make
Here is the output of file ./src/ls to demonstrate that it is a powerpc64 executable:
$ file ./src/ls
./src/ls: ELF 64-bit MSB executable, 64-bit PowerPC or cisco 7500, version 1 (SYSV), dynamically linked, interpreter /lib64/ld64.so.1, for GNU/Linux 3.2.0, BuildID[sha1]=97fe33981ca0112160f44a6fb678d6dc1b462114, not stripped
Below is a Dockerfile that can be used to reproducibly cross-compile coreutils for mips64 and powerpc64.
# Cross-compile GNU coreutils for mips64 and powerpc64 using clang.
# With help from https://medium.com/#wolfv/cross-compiling-arm-on-travis-using-clang-and-qemu-2b9702d7c6f3
FROM debian:buster
# Install compile-time dependencies.
RUN apt-get update \
&& apt-get install --yes \
clang \
curl \
gcc-mips64-linux-gnuabi64 \
gcc-powerpc64-linux-gnu \
make \
perl \
&& rm -rf /var/lib/apt/lists/*
# Download source code for release.
WORKDIR /tmp/coreutils
RUN curl -fsSL https://ftp.gnu.org/gnu/coreutils/coreutils-8.32.tar.xz \
| tar xJ --strip-components 1
# Compile and install for mips64.
RUN CFLAGS="-B/usr/mips64-linux-gnuabi64/bin/ --target=mips64-linux-gnuabi64 -I/usr/mips64-linux-gnuabi64/include" \
./configure --host=mips64-linux-gnuabi --prefix=/opt/coreutils-mips \
&& make \
&& make install
# Compile and install for powerpc64.
RUN make clean \
&& CFLAGS="-B/usr/powerpc64-linux-gnu/bin/ --target=powerpc64-linux-gnueabi -I/usr/powerpc64-linux-gnu/include" \
./configure --host=powerpc64-linux-gnueabi --prefix=/opt/coreutils-powerpc64 \
&& make \
&& make install
# Keep only the compiled programs from the previous stage.
FROM debian:buster
COPY --from=0 /opt /opt
I am current working on a simple build tool in Python that maybe help you.
Unfortunately, still at moment, lacks clang implementation, but works fine with GCC and MSVC.
Basically the thing mix Json parameters files to generate command line building.
CppMagic

Openwrt:What can I do to package bin files into ipk packages?

I've compiled the openwrt source and run it on my device (HC5661).Then I wrote a helloword.cpp (an example, any other name) using Eclipse IDE,helloword.bin was successfully generated by compilation and debugged on the target device using sftp and gdb.Now I want to compile helloword into an ipk package. What can I do to package bin files into ipk packages?
You have to use the SDK. You can follow this steps:
1) Download the OpenWrt-SDK
2) In the OpenWrt-SDK folder run ./scripts/feeds/update -a && ./scripts/feeds/install -a
3) Create a folder called helloworld in the path OpenWrt-SDK/feeds/packages/utils/
4) Inside this folder create a file called Makefile and new folder called src.
5) Inside the src folder put your helloworld.cpp and the Makefile which allows to compile it.
6) Your Makefile in the folder OpenWrt-SDK/scripts/feeds/packages/utils/ should look like the following:
include $(TOPDIR)/rules.mk
# Name and release number of this package
PKG_NAME:=helloworld
PKG_VERSION:=1.0
PKG_RELEASE:=0
# This specifies the directory where we're going to build the program.
# The root build directory, $(BUILD_DIR), is by default the build_mipsel
# directory in your OpenWrt SDK directory
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
include $(INCLUDE_DIR)/uclibc++.mk
include $(INCLUDE_DIR)/package.mk
# Specify package information for this program.
# The variables defined here should be self explanatory.
define Package/helloworld
SECTION:=utils
CATEGORY:=Utilities
TITLE:=helloworld exampke
endef
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
$(CP) ./src/* $(PKG_BUILD_DIR)/
endef
TARGET_CFLAGS += \
-I$(STAGING_DIR)/usr/include \
-D_GNU_SOURCE \
-ggdb3
MAKE_FLAGS += \
CFLAGS="$(TARGET_CFLAGS)" \
LDFLAGS="$(TARGET_LDFLAGS)"
define Build/Compile
$(call Build/Compile/Default, \
CCOPTS="$(TARGET_CFLAGS)" \
INCLUDE="$(EXTRA_CFLAGS)" \
LDFLAGS="$(EXTRA_LDFLAGS)" \
)
endef
define Package/helloworld/install
$(INSTALL_DIR) $(1)/bin
$(CP) $(PKG_BUILD_DIR)/$(PKG_NAME) $(1)/bin/
endef
# This line executes the necessary commands to compile our program.
# The above define directives specify all the information needed, but this
# line calls BuildPackage which in turn actually uses this information to
# build a package.
$(eval $(call BuildPackage,helloworld))
7) In the OpenWrt-SDK folder run ./scripts/feeds update -i && ./scripts/feeds install helloworld
8) In the same folder run make package/helloworld/compile
9) You can find your .ipk package in OpenWrt-SDK/bin/ar71xx/packages/packages/
PS: You may have to install ccache by typing (Ubuntu) sudo apt-get install ccache. You must not type your makefiles using spaces, you must use tabulator.
If you already have hello.bin,You can put it into hello/src and:
makefile(hello/):
include $(TOPDIR)/rules.mk
PKG_NAME:=hello
PKG_VERSION:=1.0
include $(INCLUDE_DIR)/package.mk
define Package/hello
CATEGORY:=Examples
TITLE:=hello
DEPENDS:=+libstdcpp
endef
define Package/hello/description
hello world
endef
define Package/hello/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) ./src/hello $(1)/usr/bin
endef
$(eval $(call BuildPackage,hello))
makefile(hello/src):
all:hello
If not,You should put hello.cpp into hello/src and:
makefile(hello/):
include $(TOPDIR)/rules.mk
PKG_NAME:=hello
PKG_VERSION:=1.0
include $(INCLUDE_DIR)/package.mk
define Package/hello
CATEGORY:=Examples
TITLE:=hello
DEPENDS:=+libstdcpp
endef
define Package/hello/description
hello world
endef
define Package/hello/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/hello $(1)/usr/bin
endef
$(eval $(call BuildPackage,hello))
makefile(hello/src):
target=hello
all:$(target)
objects=hello.o
hello:$(objects)
$(CXX) -o $(target) $(objects)
clean:
#rm -rf $(objects)

How to install a lua module in a subdirectory of libdir with the autotools

I have written a little lua module that I complile using the autotools and I want to modify its organization:
Now I have this in the main directory:
autogen.sh
configure.ac
Makefile.am
src
file1.c
file2.c
file3.c
the autogen.sh
#!/bin/sh
echo "Running aclocal..." ; aclocal $ACLOCAL_FLAGS || exit 1
echo "Running libtoolize..."; libtoolize --copy --automake || exit 1;
echo "Running autoheader..." ; autoheader || exit 1
echo "Running autoconf..." ; autoconf || exit 1
echo "Running automake..." ; automake --add-missing --copy --gnu || exit 1
./configure "$#"
The configure.ac
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.69])
AC_INIT([lua-clangc], [0.0.1], [cedlemo#gmx.com])
AC_CONFIG_SRCDIR([configure.ac])
AC_CONFIG_HEADERS([config.h])
# Checks for programs.
AC_PROG_CC(clang gcc)
# Checks for libraries.
PKG_CHECK_MODULES([DEPS], [lua])
#LUA_VERSION = $(pkg-config --version)
#AC_SUBST([LUA_VERSION])
# Checks for header files.
AC_CHECK_HEADERS([string.h stdlib.h clang-c/Index.h])
# Checks for typedefs, structures, and compiler characteristics.
# Checks for library functions.
AM_INIT_AUTOMAKE(1.13 dist-bzip2 foreign subdir-objects)
LT_PREREQ(2.4)
LT_INIT
AC_CONFIG_FILES([
Makefile
])
AC_OUTPUT
and the Makefile.am
MAINTAINERCLEANFILES = \
Makefile.in aclocal.m4 config.h.in configure \
depcomp install-sh missing compile config.sub \
config.guess ltmain.sh compile
lib_LTLIBRARIES = src/clangc.la
src_clangc_la_SOURCES = src/clangc.c src/indexlib.c src/translationunitlib.c src/constants.c src/clangc_module_functions.c
src_clangc_la_LDFLAGS = -module -avoid-version -shared -llua -lm -lclang -fPIC
I use this commands to compile and install the lua module:
./autogen.sh --libdir=/usr/lib/lua/5.3
make
sudo make install
My files are installed in /usr/lib/lua/5.3
/usr/lib/lua/5.3/clangc.so
/usr/lib/lua/5.3/clangc.la
I would like to just use
./autogen.sh --prefix=/usr
And that the configure.ac script build libdir like this:
libdir=prefix + /lib/lua/ + LUA_VERSION + /clangc/
(I have already a way to get the LUA_VERSION in the configure.ac)
As always I answer to myself:
I just have to modify my configure.ac like this:
AC_PREREQ([2.69])
AC_INIT([lua-clangc], [0.0.1], [cedlemo#gmx.com])
AC_CONFIG_SRCDIR([configure.ac])
AC_CONFIG_HEADERS([config.h])
# Checks for programs.
AC_PROG_CC(clang gcc)
# Checks for libraries.
PKG_CHECK_MODULES([DEPS], [lua])
LUA_VERSION=$(pkg-config --modversion lua | awk -F "." '{print $1"."$2}')
AC_SUBST([LUA_VERSION])
libdir=$prefix/lib/lua/$LUA_VERSION/clangc
# Checks for header files.
AC_CHECK_HEADERS([string.h stdlib.h clang-c/Index.h])
# Checks for typedefs, structures, and compiler characteristics.
# Checks for library functions.
AM_INIT_AUTOMAKE(1.13 dist-bzip2 foreign subdir-objects)
LT_PREREQ(2.4)
LT_INIT
AC_CONFIG_FILES([
Makefile
])
AC_OUTPUT
First I had to find the current lua version:
LUA_VERSION=$(pkg-config --modversion lua | awk -F "." '{print $1"."$2}')
On my system:
pkg-config --modversion lua returns 5.3.1
awk -F "." '{print $1"."$2}' returns 5.3
Then the line:
libdir=$prefix/lib/lua/$LUA_VERSION/clangc
Do all the magic.
When I use:
./autogen.sh --prefix=/usr
My lib is installed in:
/usr/lib/lua/5.3/clangc

Resources