Docker failed with [Makefile:192: imagick_file.lo] Error 127 - docker

I try to install php in docker of w2orking project with header in Dockerfile :
FROM composer:1 AS composer
FROM php:7.4-fpm-alpine
COPY --from=composer /usr/bin/composer /usr/bin/composer
ENV PHPIZE_DEPS \
build-base \
...
I got errors:
checking if cc PIC flag -fPIC works... yes
checking if cc static flag -static works... yes
checking if cc supports -c -o file.o... yes
checking whether the cc linker (/usr/x86_64-alpine-linux-musl/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
creating libtool
appending configuration tag "CXX" to libtool
configure: patching config.h.in
configure: creating ./config.status
config.status: creating config.h
running: make
/bin/sh /tmp/pear/temp/pear-build-defaultuserOFhDoe/imagick-3.4.3/libtool --mode=compile cc -I/usr/include/ImageMagick-7 -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -I. -I/tmp/pear/temp/imagick -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-defaultuserOFhDoe/imagick-3.4.3/include -I/tmp/pear/temp/pear-build-defaultuserOFhDoe/imagick-3.4.3/main -I/tmp/pear/temp/imagick -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -I/usr/include/ImageMagick-7 -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/imagick/imagick_file.c -o imagick_file.lo
make: /bin/sh: Operation not permitted
make: *** [Makefile:192: imagick_file.lo] Error 127
ERROR: `make' failed
ERROR: Service 'backapp' failed to build: The command '/bin/sh -c set -xe && apk add --no-cache ${PERMANENT_DEPS} && apk add --no-cache --virtual .build-deps ${PHPIZE_DEPS} && apk add --no-cache --repository http://dl-3.alpinelinux.org/alpine/edge/community gnu-libiconv && pecl install imagick-3.4.3 && docker-php-ext-enable imagick && docker-php-ext-configure pdo_mysql && docker-php-ext-configure bcmath --enable-bcmath && docker-php-ext-configure pcntl --enable-pcntl && docker-php-ext-configure intl --enable-intl && docker-php-ext-configure sysvmsg && docker-php-ext-configure sysvsem && docker-php-ext-configure sysvshm && docker-php-ext-install -j$(nproc) pdo_mysql sockets gettext bcmath pcntl intl sysvmsg sysvsem sysvshm && apk del .build-deps' returned a non-zero code: 1
Searching in net for decision I check cc/gcc in my system :
ProjectName$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:hsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.3.0-17ubuntu1~20.04' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-9-HskZEa/gcc-9-9.3.0/debian/tmp-nvptx/usr,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04)
ProjectName$ cc -v
Using built-in specs.
COLLECT_GCC=cc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:hsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.3.0-17ubuntu1~20.04' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-9-HskZEa/gcc-9-9.3.0/debian/tmp-nvptx/usr,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
ProjectName$ uname -a
Linux master-laptop 5.11.0-37-generic #41~20.04.2-Ubuntu SMP Fri Sep 24 09:06:38 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
ProjectName$ composer -v
______
Composer version 2.1.8 2021-09-15 13:55:14
Also I installed build-essential, but checking its info I found error in its output. Could it be the issue, but how to fix bit ?
$ apt show build-essential — info -a
Package: build-essential
Version: 12.8ubuntu1.1
Priority: optional
Build-Essential: yes
Section: devel
Origin: Ubuntu
Maintainer: Ubuntu Developers <ubuntu-devel-discuss#lists.ubuntu.com>
Original-Maintainer: Matthias Klose <doko#debian.org>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 21,5 kB
Depends: libc6-dev | libc-dev, gcc (>= 4:9.2), g++ (>= 4:9.2), make, dpkg-dev (>= 1.17.11)
Task: ubuntu-mate-core, ubuntu-mate-desktop
Download-Size: 4 664 B
APT-Manual-Installed: yes
APT-Sources: http://ua.archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages
Description: Informational list of build-essential packages
If you do not plan to build Debian packages, you don't need this
package. Starting with dpkg (>= 1.14.18) this package is required
for building Debian packages.
.
This package contains an informational list of packages which are
considered essential for building Debian packages. This package also
depends on the packages on that list, to make it easy to have the
build-essential packages installed.
.
If you have this package installed, you only need to install whatever
a package specifies as its build-time dependencies to build the
package. Conversely, if you are determining what your package needs
to build-depend on, you can always leave out the packages this
package depends on.
.
This package is NOT the definition of what packages are
build-essential; the real definition is in the Debian Policy Manual.
This package contains merely an informational list, which is all
most people need. However, if this package and the manual disagree,
the manual is correct.
Package: build-essential
Version: 12.8ubuntu1
Priority: optional
Build-Essential: yes
Section: devel
Origin: Ubuntu
Maintainer: Ubuntu Developers <ubuntu-devel-discuss#lists.ubuntu.com>
Original-Maintainer: Matthias Klose <doko#debian.org>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 20,5 kB
Depends: libc6-dev | libc-dev, gcc (>= 4:9.2), g++ (>= 4:9.2), make, dpkg-dev (>= 1.17.11)
Task: ubuntu-mate-core, ubuntu-mate-desktop
Download-Size: 4 624 B
APT-Sources: http://ua.archive.ubuntu.com/ubuntu focal/main amd64 Packages
Description: Informational list of build-essential packages
If you do not plan to build Debian packages, you don't need this
package. Starting with dpkg (>= 1.14.18) this package is required
for building Debian packages.
.
This package contains an informational list of packages which are
considered essential for building Debian packages. This package also
depends on the packages on that list, to make it easy to have the
build-essential packages installed.
.
If you have this package installed, you only need to install whatever
a package specifies as its build-time dependencies to build the
package. Conversely, if you are determining what your package needs
to build-depend on, you can always leave out the packages this
package depends on.
.
This package is NOT the definition of what packages are
build-essential; the real definition is in the Debian Policy Manual.
This package contains merely an informational list, which is all
most people need. However, if this package and the manual disagree,
the manual is correct.
Package: info
Version: 6.7.0.dfsg.2-5
Priority: standard
Section: doc
Source: texinfo
Origin: Ubuntu
Maintainer: Ubuntu Developers <ubuntu-devel-discuss#lists.ubuntu.com>
Original-Maintainer: Debian TeX maintainers <debian-tex-maint#lists.debian.org>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 831 kB
Provides: info-browser
Depends: libc6 (>= 2.15), libtinfo6 (>= 6), install-info
Breaks: texinfo-doc-nonfree
Replaces: texinfo (<< 4.7-2), texinfo-doc-nonfree
Homepage: https://www.gnu.org/software/texinfo/
Task: standard
Download-Size: 203 kB
APT-Manual-Installed: no
APT-Sources: http://ua.archive.ubuntu.com/ubuntu focal/main amd64 Packages
Description: Standalone GNU Info documentation browser
The Info file format is an easily-parsable representation for online
documents. This program allows you to view Info documents, like the
ones stored in /usr/share/info.
.
Much of the software in Debian comes with its online documentation in
the form of Info files, so it is most likely you will want to install it.
N: Unable to locate package —
How to fix this error ?
Modified BLOCK # 1:
Searching in net I found hints that reason of this error can be that some apps are not in $PATH
So I added line with build-essential path :
export PATH="/usr/share/build-essential:$PATH"
in file /home/master/.bashrc and run update command :
source ~/.bashrc
After that I check that all related apops in PATH :
master#master-laptop:ProjectName$ $PATH
bash: /usr/share/build-essential:/home/master/.composer/vendor/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin: No such file or directory
master#master-laptop:ProjectName$ whereis gcc
gcc: /usr/bin/gcc /usr/lib/gcc /usr/share/gcc /usr/share/man/man1/gcc.1.gz
master#master-laptop:ProjectName$ whereis cc
cc: /usr/bin/cc /usr/share/man/man1/cc.1.gz
master#master-laptop:ProjectName$ whereis build-essential
build-essential: /usr/share/build-essential
But anyway I got the same error :
...
make: /bin/sh: Operation not permitted
make: *** [Makefile:192: imagick_file.lo] Error 127
Thanks!

It's difficult to provide an accurate answer without the whole Dockerfile, but I will try to point your problem.
Well, first of all you're using a multi-staged build, but you're not taking advantage from it. The whole point about the composer image isn't just the Composer PHAR, but that image already contains all the dependencies require to build your PHP dependencies.
Meanwhile you have something like this:
FROM composer:1 as composer
FROM php:7.4-fpm-alpine
ENV ...
[BUILD_PROCESS]
[EXTRA_PROCESS]
You should have something like this:
FROM composer:1 as vendor
WORKDIR /app
COPY database/ database/
COPY composer.json composer.json
COPY composer.lock composer.lock
[BUILD_PROCESS]
FROM php:7.4-fpm-alpine
WORKDIR /app
COPY --from=vendor /app/vendor/ ./vendor/
COPY . .
[EXTRA_PROCESS]
Basically: delegate the build of the dependencies to the Composer image and use your lightweight PHP Alpine just for the application.

Using multiple FROM clauses creates multiple images
I agree with #Daniel Campos however I will suggest looking at the resultant images. You should file multiple.
Have a look at this thread which explains some more details.
Multiple FROMs - what it means

Related

how to solve the glm problem when installing pymol?

I am trying to install pymol in CentOS 7 system. I installed the dependency glm-devel-0.9.6.3-1.el7.noarch by yum:
sudo yum install glm-devel.
During compiling I got an error related to glm as following:
layer1/SceneView.cpp:34:61: error: no matching function for call to ‘equal(const vec3&, const vec3&, float)’
Could anyone tell why this error appears?
I will appreciate any help!
Best regards.
install pymol in CentOS 7
Build example with updated glm-devel
# yum install mmtf-cpp-devel.x86_64 glew-devel.x86_64 libpng-devel freetype-devel msgpack-devel libxml2-devel python36-qt5-devel.x86_64 freeglut-devel mesa-libGL-devel.x86_64 python3-devel
# yum install ./glm-devel-0.9.9.6-6.el7.noarch.rpm
## works with the default python3 (3.6.8) and g++ -4.8.5
Link, glm-devel-0.9.9.6-6.el7 https://drive.google.com/file/d/1BXygEWqpvlbZg867dsXuW47T67Z0V0Q8/view?usp=sharing
https://github.com/schrodinger/pymol-open-source →
https://github.com/schrodinger/pymol-open-source/blob/master/INSTALL
git clone https://github.com/schrodinger/pymol-open-source.git
cd pymol-open-source/
python3 setup.py build
# python3 setup.py install
pymol ## the pymol GUI opens OK
There is also a binary version available, with python 3.7 included : https://pymol.org/2/ →
https://pymol.org/installers/PyMOL-2.5.2_293-Linux-x86_64-py37.tar.bz2 → tar xvf PyMOL-2.5.2_293-Linux-x86_64-py37.tar.bz2
cd pymol/ && ./pymol

`pip install cyrptography ` not able to install on python3.7-alpine docker

I'm trying to install crypotography using the below dockerfile for alpine3.7 python base.
However, I'm getting error like this:
#7 17.27 Failed to build cryptography cffi
#7 17.37 Installing collected packages: pycparser, six, idna, cffi, asn1crypto, pymysql, cryptography
#7 17.68 Running setup.py install for cffi: started
#7 18.04 Running setup.py install for cffi: finished with status 'error'
#7 18.04 ERROR: Command errored out with exit status 1:
#7 18.04 command: /usr/local/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-twxf8fj_/cffi_1f087e9b9e8c4af8b4e6bf3deb3a5bf9/setup.py'"'"'; __file__='"'"'/tmp/pip-install-twxf8fj_/cffi_1f087e9b9e8c4af8b4e6bf3deb3a5bf9/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-j8mkceyt/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.7m/cffi
#7 18.04 cwd: /tmp/pip-install-twxf8fj_/cffi_1f087e9b9e8c4af8b4e6bf3deb3a5bf9/
#7 18.04 Complete output (48 lines):
#7 18.04 unable to execute 'gcc': No such file or directory
#7 18.04 unable to execute 'gcc': No such file or directory
As per cryptography document I'm installing all necessary packages but still it's throwing me the same error.
Dockerfile:
FROM python:3.7-alpine
WORKDIR /project
RUN apk add --no-cache --virtual gcc musl-dev python3-dev libffi-dev openssl-dev cargo mariadb-dev
RUN pip install pymysql cryptography
Can you anyone point me what is i'm doing wrong?
-t, --virtual NAME Instead of adding all the packages to 'world', create a new
virtual package with the listed dependencies and add that
to 'world'; the actions of the command are easily reverted
by deleting the virtual package
What that means is when you install packages, those packages are not added to global packages. And this change can be easily reverted. So if I need gcc to compile a program, but once the program is compiled I no more need gcc.
I can install gcc, and other required packages in a virtual package and all of its dependencies and everything can be removed this virtual package name. Below is an example usage:
apk add --virtual .dep gcc
apk del .dep
So, for you, in apk add --no-cache --virtual gcc, the gcc was wrongly treat as virtual package name, which means you in fact did not install gcc.
To fix this, try to add a virtual package name before all packages as next:
/ # apk add --no-cache --virtual .dep gcc
fetch https://mirrors.ustc.edu.cn/alpine/v3.14/main/x86_64/APKINDEX.tar.gz
fetch https://mirrors.ustc.edu.cn/alpine/v3.14/community/x86_64/APKINDEX.tar.gz
(1/12) Installing libgcc (10.3.1_git20210424-r2)
(2/12) Installing libstdc++ (10.3.1_git20210424-r2)
(3/12) Installing binutils (2.35.2-r2)
(4/12) Installing libgomp (10.3.1_git20210424-r2)
(5/12) Installing libatomic (10.3.1_git20210424-r2)
(6/12) Installing libgphobos (10.3.1_git20210424-r2)
(7/12) Installing gmp (6.2.1-r0)
(8/12) Installing isl22 (0.22-r0)
(9/12) Installing mpfr4 (4.1.0-r0)
(10/12) Installing mpc1 (1.2.1-r0)
(11/12) Installing gcc (10.3.1_git20210424-r2)
(12/12) Installing .dep (20210629.140945)
Executing busybox-1.33.1-r2.trigger
OK: 122 MiB in 47 packages
/ # gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-alpine-linux-musl/10.3.1/lto-wrapper
Target: x86_64-alpine-linux-musl
Configured with: /home/buildozer/aports/main/gcc/src/gcc-10.3.1_git20210424/configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --build=x86_64-alpine-linux-musl --host=x86_64-alpine-linux-musl --target=x86_64-alpine-linux-musl --with-pkgversion='Alpine 10.3.1_git20210424' --enable-checking=release --disable-fixed-point --disable-libstdcxx-pch --disable-multilib --disable-nls --disable-werror --disable-symvers --enable-__cxa_atexit --enable-default-pie --enable-default-ssp --enable-cloog-backend --enable-languages=c,c++,d,objc,go,fortran,ada --disable-libssp --disable-libmpx --disable-libmudflap --disable-libsanitizer --enable-shared --enable-threads --enable-tls --with-system-zlib --with-linker-hash-style=gnu
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 10.3.1 20210424 (Alpine 10.3.1_git20210424)
Or directly as document said, remove --virtual:
apk add gcc

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

avahi compilation error "libgdbm.so not found" ubuntu 16.04?

Getting libgdbm.so not found error, couldn't resolve even after installing proper package. Also I couldn't find proper documentation on compiling from source and installing.
To build avahi on Ubuntu I would suggest the following steps:
sudo apt-get build-dep avahi # (you'll need to have enabled deb-src lines in /etc/apt/sources.list for this to work, or you can use the software settings to enable source packages)
Then additionally install xml2man and python-gi-dev
sudo apt install python-gi-dev xml2man
Then configure with these options:
./configure --disable-gtk --disable-qt3 --disable-mono
Avahi always errors about a build dependency it can't find, requiring you to explicitly disable those items. Above I suggest to disable some old toolkits (gtk2 and qt3) plus mono support. If you get other errors you can generally use a similar --disable-X option to disable those. But for Ubuntu generally you can compile almost everything else.
gtk and qt3 is disabled by default in the latest git, but not the latest release.
A quick place to check for the required ubuntu deps would be the travis configuration: https://github.com/lathiat/avahi/blob/master/.travis.yml
Out of curiosity, what is the reason you're building from source? The Avahi packages in Ubuntu 16.04 should work well.
Compilation steps:
1) Install dependency
export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/
sudo apt-get install libqt4-dev libtool libglib2.0-dev intltool build-essential libgtk2.0-dev libdaemon-dev xmltoman
2) Generate configure file
bash autogen.sh
Ignore following error
checking for QT5... no
configure: error: Package requirements ( Qt5Core >= 5.0.0 ) were not met:
No package 'Qt5Core' found
3) Create makefile
./configure --prefix=/usr \
--sysconfdir=/etc \
--localstatedir=/var \
--disable-static \
--disable-mono \
--disable-monodoc \
--disable-python \
--disable-qt3 \
--disable-qt4 \
--disable-qt5 \
--disable-gdbm \
--enable-core-docs \
--with-distro=none \
--with-systemdsystemunitdir=no \
--disable-shared \
--disable-gtk
4) Make and install
make
sudo make install
[Edit] if debugging with custom logs/code use --disable-shared in configure else changes wont reflect.

Resources