title: Docker failed with [Makefile:192: imagick_file.lo] Error 127
body: <p>I try to install php in docker of w2orking project with header in Dockerfile :</p>
  <pre><code>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 \
  ...
  </code></pre>
  <p>I got errors:</p>
  <pre><code>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 &quot;CXX&quot; 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   &amp;&amp; apk add --no-cache ${PERMANENT_DEPS}   &amp;&amp; apk add --no-cache --virtual .build-deps ${PHPIZE_DEPS}   &amp;&amp; apk add --no-cache --repository http://dl-3.alpinelinux.org/alpine/edge/community gnu-libiconv   &amp;&amp; pecl install imagick-3.4.3   &amp;&amp; docker-php-ext-enable imagick   &amp;&amp; docker-php-ext-configure pdo_mysql   &amp;&amp; docker-php-ext-configure bcmath --enable-bcmath   &amp;&amp; docker-php-ext-configure pcntl --enable-pcntl   &amp;&amp; docker-php-ext-configure intl --enable-intl   &amp;&amp; docker-php-ext-configure sysvmsg   &amp;&amp; docker-php-ext-configure sysvsem   &amp;&amp; docker-php-ext-configure sysvshm   &amp;&amp; docker-php-ext-install -j$(nproc)     pdo_mysql     sockets     gettext     bcmath     pcntl     intl     sysvmsg     sysvsem     sysvshm   &amp;&amp; apk del .build-deps' returned a non-zero code: 1
  </code></pre>
  <p>Searching in net for decision I check cc/gcc in my system :</p>
  <pre><code>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
  </code></pre>
  <p>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 ?</p>
  <pre><code>$ 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 &lt;ubuntu-devel-discuss@lists.ubuntu.com&gt;
  Original-Maintainer: Matthias Klose &lt;doko@debian.org&gt;
  Bugs: https://bugs.launchpad.net/ubuntu/+filebug
  Installed-Size: 21,5 kB
  Depends: libc6-dev | libc-dev, gcc (&gt;= 4:9.2), g++ (&gt;= 4:9.2), make, dpkg-dev (&gt;= 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 (&gt;= 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 &lt;ubuntu-devel-discuss@lists.ubuntu.com&gt;
  Original-Maintainer: Matthias Klose &lt;doko@debian.org&gt;
  Bugs: https://bugs.launchpad.net/ubuntu/+filebug
  Installed-Size: 20,5 kB
  Depends: libc6-dev | libc-dev, gcc (&gt;= 4:9.2), g++ (&gt;= 4:9.2), make, dpkg-dev (&gt;= 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 (&gt;= 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 &lt;ubuntu-devel-discuss@lists.ubuntu.com&gt;
  Original-Maintainer: Debian TeX maintainers &lt;debian-tex-maint@lists.debian.org&gt;
  Bugs: https://bugs.launchpad.net/ubuntu/+filebug
  Installed-Size: 831 kB
  Provides: info-browser
  Depends: libc6 (&gt;= 2.15), libtinfo6 (&gt;= 6), install-info
  Breaks: texinfo-doc-nonfree
  Replaces: texinfo (&lt;&lt; 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 —
  </code></pre>
  <p>How to fix this error ?</p>
  <p><strong>Modified BLOCK # 1:</strong>
  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 :</p>
  <pre><code>export PATH=&quot;/usr/share/build-essential:$PATH&quot;
  </code></pre>
  <p>in file /home/master/.bashrc and run update command :</p>
  <pre><code>source ~/.bashrc
  </code></pre>
  <p>After that I check that all related apops in PATH :</p>
  <pre><code>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
  </code></pre>
  <p>But anyway I got the same error :</p>
  <pre><code>...
  make: /bin/sh: Operation not permitted
  make: *** [Makefile:192: imagick_file.lo] Error 127
  </code></pre>
  <p>Thanks!</p>