Makefile:273: recipe for target 'install' failed make: *** [install] Error 1 in ubuntu16.04 in Docker container - docker

I am using Docker container in which i install ubuntu16.04 , i tried to install setup of openvino toolkit so i got the following error when I Install Paho* MQTT C client libraries by following command given in https://github.com/intel-iot-devkit/people-counter
root#2fe5f8678637:~# cd paho.mqtt.c
root#2fe5f8678637:~/paho.mqtt.c# ls -a
. CODE_OF_CONDUCT.md .git src
.. conanfile.py .gitignore test
about.html CONTRIBUTING.md .gitreview test_package
android .cproject LICENSE travis-build.sh
appveyor.yml debian Makefile travis-deploy.sh
build deploy_rsa.enc notice.html travis-env-vars
build.xml dist .project travis-install.sh
cbuild.bat doc .pydevproject travis-macos-vars
cmake edl-v10 README.md travis-setup-deploy.sh
CMakeLists.txt epl-v10 .settings .travis.yml
root#2fe5f8678637:~/paho.mqtt.c# make
mkdir -p build/output/samples
mkdir -p build/output/test
echo OSTYPE is Linux
OSTYPE is Linux
root#2fe5f8678637:~/paho.mqtt.c# sudo make install
mkdir -p build/output/samples
mkdir -p build/output/test
echo OSTYPE is Linux
OSTYPE is Linux
mkdir -p /usr/local/include
install -m 644 build/output/libpaho-mqtt3c.so.1.0 /usr/local/lib
install -m 644 build/output/libpaho-mqtt3cs.so.1.0 /usr/local/lib
install -m 644 build/output/libpaho-mqtt3a.so.1.0 /usr/local/lib
install -m 644 build/output/libpaho-mqtt3as.so.1.0 /usr/local/lib
install build/output/paho_c_version /usr/local/bin
install build/output/samples/paho_c_pub /usr/local/bin
install build/output/samples/paho_c_sub /usr/local/bin
install build/output/samples/paho_cs_pub /usr/local/bin
install build/output/samples/paho_cs_sub /usr/local/bin
/sbin/ldconfig /usr/local/lib
ln -s libpaho-mqtt3c.so.1 /usr/local/lib/libpaho-mqtt3c.so
ln: failed to create symbolic link '/usr/local/lib/libpaho-mqtt3c.so': File exists
Makefile:273: recipe for target 'install' failed
make: *** [install] Error 1
Can someone explain what that error means and how to resolve it?

From the documentation:
ln [OPTION]... TARGET... DIRECTORY
So if your target is /usr/local/lib/libpaho-mqtt3c.so, you should use it the other way around, like this:
ln -s /usr/local/lib/libpaho-mqtt3c.so libpaho-mqtt3c.so.1

Related

Docker: GLIBC_2.34 not found (required by /usr/local/lib/bashlib.so)

I am having an issue where I'm trying to build in docker, I am getting an error saying GLIBC_2.34 not found (required by /usr/local/lib/bashlib.so)
I am doing this on WSL (Ubuntu) on Windows 11
The contents of my Makefile in the assets folder is as follows
all: bashlib.so
bashlib.so: processhider.c
gcc -Wall -fPIC -shared -o bashlib.so processhider.c -ldl
.PHONY clean:
rm -f bashlib.so
I issue make all and the bashlib.so file gets created. Running ldd --version brings ldd (Ubuntu GLIBC 2.35-0ubuntu3.1) 2.35
I go up a folder (I do the above) to create the bashlib.so needed for the next bit.
The processhider.c file mentioned above is taken from https://github.com/gianlucaborello/libprocesshider/blob/master/processhider.c
So now I go into the parent folder and run sudo make build and get the following error:
...
=> ERROR [11/40] RUN groupadd init -g 1050 0.3s
------
> [11/40] RUN groupadd init -g 1050:
#15 0.277 /bin/sh: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by /usr/local/lib/bashlib.so)
------
executor failed running [/bin/sh -c groupadd init -g 1050]: exit code: 1
make: *** [Makefile:8: build] Error 1
The content of the Makefile is as follows
TAG?=cheeseballs/$(shell basename `pwd`):latest
all: build
build:
docker build -t "${TAG}" .
run: build
docker run --rm -e RESOURCE_ID=00000000-0000-4000-0000-000000000000 -ti "${TAG}"
clean:
docker rmi "${TAG}"
The contents of the Dockerfile are below (up to and including the line where it errors)
# Pull base image.
FROM debian:bullseye
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y man
# Uncomment the line below to set a root password for testing purposes
# RUN bash -c 'echo -e "testing\ntesting" | passwd root'
# No changes should need to be made here
RUN python3 -m pip install
RUN python3 -m pip install libtmux
RUN python3 -m pip install tmuxp
RUN python3 -m pip install pyinstaller
COPY assets/bashlib.so /usr/local/lib/bashlib.so
RUN chmod 755 /usr/local/lib/bashlib.so
RUN echo /usr/local/lib/bashlib.so >> /etc/ld.so.preload
ENV LC_ALL=C.UTF-8
ENV LANG=C.UTF-8
RUN groupadd init -g 1050
...
I don't know where to go from here - any suggestions?

makefile:513: pod/perlintern.pod Segmentation fault (core dumped) When installing specific perl version in dockerfile

I am trying to install perl 5.12.3 onto a Fedora 33 Docker image in my dockerfile however when I attempt to build the image I am faced with this error:
/bin/sh: line 1: /dev/tty: No such device or address
make[1]: Leaving directory '/'
make[1]: [makefile:964: minitest] Error 1 (ignored)
./miniperl -Ilib autodoc.pl
make: *** [makefile:513: pod/perlintern.pod] Segmentation fault (core dumped)
This is how I am attempting to install it:
RUN wget https://www.cpan.org/authors/id/R/RJ/RJBS/perl-5.12.3.tar.gz
RUN tar -xzf perl-5.12.3.tar.gz
RUN perl-5.12.3/Configure -Dmksymlinks -des -Dprefix=/usr/local/ -d y &&\
make && \
make test && \
make install
RUN perl -v
I guess that the problem is that docker is running the build context with no stdin or tty. Does anyone know a fix for this? I tried to install perlbrew instead to accomplish this but that was already proving to have quite a few of its own issues. Thank you for any help or advice. I am open to any other methods to installing perl 5.12.3 in the image.
I was able to install Perl version 5.12.4 with perlbrew like this (building fedora:33 docker image from my Ubuntu 21.04 laptop):
Dockerfile:
FROM fedora:33
SHELL ["/bin/bash", "-c"]
RUN yum -y update \
&& yum -y install gcc gcc-c++ make curl \
vim wget zlib-devel openssl-devel bzip2 patch \
perl-CPAN perl-App-cpanminus
ARG user=root
ARG home=/$user
WORKDIR $home
USER $user
COPY entrypoint.sh .
RUN chmod +x entrypoint.sh
ENTRYPOINT ["./entrypoint.sh"]
entrypoint.sh:
curl -L https://install.perlbrew.pl | SHELL=/bin/bash bash
echo 'export PERLBREW_ROOT=$HOME/perl5/perlbrew' >> .bashrc
echo 'source $PERLBREW_ROOT/etc/bashrc' >> .bashrc
export PERLBREW_ROOT=$HOME/perl5/perlbrew
source $PERLBREW_ROOT/etc/bashrc
perlbrew install --notest --noman perl-5.12.4
perlbrew install-cpanm
perlbrew switch perl-5.12.4
perl --version
exec bash

creating an RPM package from binary file doesn't package the files into an archive

I'm trying to create an RPM package from node project packaged into a binary file with pkg.
I've created an rpmbuild skeleton in /root/rpmbuild.
The binary package was copied into /root/rpmbuild/SOURCES.
I've created a menlolab-runner.service file in /root/rpmbuild.
I'm skipping the %prep and %build sections in the .spec file. During the install section the binary files is copied to /usr/bin folder. In the %post section the service file is copied to /etc/systemd/system/
%define version %(cat package.json | jq -r '.version')
%define release 1
%define buildroot /root/rpmbuild/BUILDROOT/
Name: %{name}
Version: %{version}
Release: %{release}
Summary: menlolab-runner
Group: Installation Script
License: MIT
Source0: runner
AutoReqProv: no
%description
The agent deployed on private and public infrastructure to manage tasks.
%global debug_package %{nil}
%prep
%build
%pre
getent group menlolab-runner >/dev/null || groupadd -r menlolab-runner
getent passwd menlolab-runner >/dev/null || useradd -r -g menlolab-runner -G menlolab-runner -d / -s /sbin/nologin -c "menlolab-runner" menlolab-runner
%install
mkdir -p %{buildroot}%{_bindir}/
mkdir -p %{buildroot}%{_unitdir}
cp runner %{buildroot}%{_bindir}/menlolab-runner
cp /root/rpmbuild/menlolab-runner.service %{buildroot}%{_unitdir}
%post
systemctl enable %{_unitdir}/menlolab-runner.service
chmod ugo+x /usr/bin/menlolab-runner
mkdir -p '/etc/menlolab-runner/'
chown -R 'menlolab-runner:menlolab-runner' '/etc/menlolab-runner'
chmod 700 '/etc/menlolab-runner'
mkdir -p '/var/lib/menlolab-runner/'
chown -R 'menlolab-runner:menlolab-runner' '/var/lib/menlolab-runner/'
mkdir -p '/var/lib/menlolab-runner/jobs/'
chown -R 'menlolab-runner:menlolab-runner' '/var/lib/menlolab-runner/jobs/'
chmod 700 '/var/lib/menlolab-runner/jobs/'
mkdir -p '/var/log/menlolab-runner/'
chown -R 'menlolab-runner:menlolab-runner' '/var/log/menlolab-runner/'
mkdir -p '/var/cache/menlolab-runner/'
chown -R 'menlolab-runner:menlolab-runner' '/var/cache/menlolab-runner/'
groupadd docker
usermod -aG docker menlolab-runner
%clean
rm -rf %{buildroot}
%files
%{_bindir}/menlolab-runner
%{_unitdir}/menlolab-runner.service
%defattr(644, menlolab-runner, menlolab-runner, 755)
My issue is the fact that .rpm contains no files after executing rpmbuild -ba /path/to/spec/file.
I think it's because I have no entry in the %files section. I'm not sure what to put into this section. If I add the path to binary file there I receive the following error:
error: File not found: /root/rpmbuild/BUILDROOT/menlolab-runner-0.2.5a2-1.x86_64/root/rpmbuild/SOURCES/runner
In your %install section you must place files into $RPM_BUILD_ROOT, so something like:
%install
cp runner $RPM_BUILD_ROOT%{_bindir}/menlolab-runner
Subsequently, the %files section should list the installed files, relative to the $RPM_BUILD_ROOT, e.g.:
%files
%{_bindir}/menlolab-runner

Homebrew: untar anywhere and install formula: Error: The following directories are not writable by your user

Following the official Homebrew installation instructions to "untar anywhere":
$ homebrew_dir="$HOME"/homebrew_for_lunch_and_learn
$ mkdir "$homebrew_dir" && curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C "$homebrew_dir"
Then attempting to build on top of these instructions for convenience:
$ sudo ln -s "$homebrew_dir"/bin/brew /usr/local/bin/lunchbrew
Then attempting to install something:
$ lunchbrew install python3
...
Error: The following directories are not writable by your user:
/usr/local/include
/usr/local/lib
/usr/local/lib/pkgconfig
...
Or something else:
$ lunchbrew install vim
...
Error: The following directories are not writable by your user:
/usr/local/include
/usr/local/lib
/usr/local/lib/pkgconfig
...
Try this instead:
$ ~/homebrew_for_lunch_and_learn/bin/brew install python3
(success...)
or this:
$ alias lunchbrew="~/homebrew_for_lunch_and_learn/bin/brew"
$ lunchbrew install vim
(success...)
Why this works:
It appears that Homebrew cares about the directory of the symlink. The symlink lives at /usr/local/bin/lunchbrew in /usr/local/. That appears to be why it wants the /usr/local/ directories to be writable.

Sudo make install permissions issue on Ubuntu 14.04

I have amended a script from https://github.com/jayrambhia/Install-OpenCV/blob/master/Ubuntu/2.4/opencv2_4_10.sh to try to install OpenCV 2.4.13 onto a vm running Ubuntu 14.04 where I have sudo permission. I'm new to openCV, cmake & make so any help getting this script to work would be appreciated as I have to install it on 20 vm's.
After a few minutes of running the script returns with an error saying can't
/bin/sh: 1: cd: can't cd to /home/myaccount/setups/OpenCV/opencv-2.4.13/build
and
make[2]: *** [3rdparty/libtiff/CMakeFiles/libtiff.dir/depend] Error 2
make[1]: *** [3rdparty/libtiff/CMakeFiles/libtiff.dir/all] Error 2
The last few lines of the output is included below and the script is before that.
Any ideas why the script wont complete successfully or how to correct the permissions issue?
Extra Details
I'm not sure if these are relevant but as I dig into the problem I'll update this section
cmake version 2.8
Makerfile mentions # The shell in which to execute make rules. SHELL
= /bin/sh but my terminal reports echo $0 as bash
when I run make install V=1 it builds 100% but then reports
-- Install configuration: "RELEASE" CMake Error at cmake_install.cmake:36 (FILE): file cannot create directory: /usr/local/include/opencv2. Maybe need administrative privileges
But when I run sudo make install V=1 I get can't cd error above
Adding Shebang #!/bin/bash to the start of my script didn't solve it
Running the script on a fresh ubuntu local machine alows the script to run but I need to get it running on the hosted vm
umask of setups folder (where script runs and creates a directory is 0022 . Permissions for setups folder is 755, group = Domain Users, Owner = myaccount Thats where the source files folder gets created as well as the build folder which is also 755 after it is created
Script
arch=$(uname -m)
if [ "$arch" == "i686" -o "$arch" == "i386" -o "$arch" == "i486" -o "$arch" == "i586" ]; then
flag=1
else
flag=0
fi
echo "Installing OpenCV 2.4.13"
mkdir OpenCV
cd OpenCV
echo "Removing any pre-installed ffmpeg and x264"
sudo apt-get -y remove ffmpeg x264 libx264-dev
echo "Installing unzip"
sudo apt-get -y install unzip
echo "Installing Dependenices"
sudo apt-get -y install libopencv-dev
sudo apt-get -y install build-essential checkinstall cmake pkg-config yasm
sudo apt-get -y install libtiff4-dev libjpeg-dev libjasper-dev
sudo apt-get -y install libavcodec-dev libavformat-dev libswscale-dev libdc1394-22-dev libxine-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libv4l-dev
sudo apt-get -y install python-dev python-numpy
sudo apt-get -y install libtbb-dev libeigen3-dev
sudo apt-get -y install libqt4-dev libgtk2.0-dev
sudo apt-get -y install libfaac-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-core-dev
sudo apt-get -y install x264 v4l-utils ffmpeg
sudo apt-get -y install libgtk2.0-dev
echo "Downloading OpenCV 2.4.13"
if ! [ -f "OpenCV-2.4.13.zip" ]; then
wget -O OpenCV-2.4.13.zip http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.4.13/opencv-2.4.13.zip/download
fi
echo "Installing OpenCV 2.4.13"
if ! [ -d "opencv-2.4.13" ]; then
unzip OpenCV-2.4.13.zip
fi
rm OpenCV-2.4.13.zip
cd opencv-2.4.13
rm -rf build
mkdir build
cd build
cmake -D CUDA_ARCH_BIN=3.2 -D CUDA_ARCH_PTX=3.2 -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D BUILD_TIFF=ON -D WITH_QT=ON -D WITH_OPENGL=ON ..
make -j$(nproc)
sudo make install
sudo sh -c 'echo "/usr/local/lib" > /etc/ld.so.conf.d/opencv.conf'
sudo ldconfig
echo "OpenCV 2.4.13 ready to be used"
Command Output
[100%] Build Java tests
Buildfile: /home/myaccount/setups/OpenCV/opencv-2.4.13/build/modules/java/test/.build/build.xml
build:
compile:
[mkdir] Created dir: /home/myaccount/setups/OpenCV/opencv-2.4.13/build/modules/java/test/.build/build/classes
[javac] Compiling 104 source files to /home/myaccount/setups/OpenCV/opencv-2.4.13/build/modules/java/test/.build/build/classes
jar:
[mkdir] Created dir: /home/myaccount/setups/OpenCV/opencv-2.4.13/build/modules/java/test/.build/build/jar
[jar] Building jar: /home/myaccount/setups/OpenCV/opencv-2.4.13/build/modules/java/test/.build/build/jar/opencv-test.jar
BUILD SUCCESSFUL
Total time: 6 seconds
[100%] Built target opencv_test_java
[sudo] password for myaccount:
Sorry, try again.
[sudo] password for myaccount:
/bin/sh: 1: cd: can't cd to /home/myaccount/setups/OpenCV/opencv-2.4.13/build
make[2]: *** [3rdparty/libtiff/CMakeFiles/libtiff.dir/depend] Error 2
make[1]: *** [3rdparty/libtiff/CMakeFiles/libtiff.dir/all] Error 2
make: *** [all] Error 2
OpenCV 2.4.13 ready to be used
myaccount#vm-20161023-002:~/setups$
What popped up into my head to explain the lack of permission problem: if your /home is on NFS, root may have nobody's permission on files there. There are quite a few related questions on StackExchange.
My solution would be not to try installing third-party software as root in the first place. Executing as root, your make install can do anything, including adding or overwriting files that are already managed by your software package manager. This may confuse the package manager or even render your system unusable. It's better to install the software somewhere else; /usr/local and /opt were created for this purpose. In order to make sure your installation procedure doesn't deviate from this, you can create a different user (which I call local), chown -R these directories to that user, and install using sudo -u local instead of sudoing to root. This will be fine for most installations, and should you run into one that tries to do something requiring root permissions (such as writing files to /etc or /usr/bin, restarting system services, doing tricky things with permissions, etc.), it will fail with an error message, allowing you to decide whether you want this before it has already happened. I have no idea whether OpenCV requires any such steps.

Resources