I'm trying to build MariaDB on a Debian based container. But it cannot find a z library.
Here is the container image script:
FROM debian
RUN apt-get update
RUN apt-get install -y libncurses-dev
RUN apt-get install -y build-essential;
RUN apt-get install -y cmake;
COPY mariadb-10.1.18.tar.gz /usr/bin/
WORKDIR /usr/bin/
RUN gzip -d mariadb-10.1.18.tar.gz
RUN tar -xvf mariadb-10.1.18.tar
RUN ln -s mariadb-10.1.18 mariadb
WORKDIR /usr/bin/mariadb/
RUN mkdir install; mkdir install/data; mkdir install/var; mkdir install/etc; mkdir install/tmp
RUN cd /usr/bin/mariadb/;
RUN rm -f CMakeCache.txt;
RUN cmake \
-DCMAKE_INSTALL_PREFIX=/usr/bin/mariadb/install \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DMYSQL_DATADIR=/usr/bin/mariadb/install/data \
-DDOWNLOAD_BOOST=1 \
-DWITH_BOOST=/usr/bin/mariadb/install/boost \
-DMYSQL_UNIX_ADDR=/usr/bin/mariadb/install/tmp/mariadb.sock
And the console output:
[ 77%] Building CXX object storage/tokudb/PerconaFT/ft/CMakeFiles/ft.dir/log_print.cc.o
Linking CXX shared library libft.so
/usr/bin/ld: cannot find -lz
collect2: error: ld returned 1 exit status
storage/tokudb/PerconaFT/ft/CMakeFiles/ft.dir/build.make:1323: recipe for target 'storage/tokudb/PerconaFT/ft/libft.so' failed
make[2]: *** [storage/tokudb/PerconaFT/ft/libft.so] Error 1
CMakeFiles/Makefile2:3438: recipe for target 'storage/tokudb/PerconaFT/ft/CMakeFiles/ft.dir/all' failed
make[1]: *** [storage/tokudb/PerconaFT/ft/CMakeFiles/ft.dir/all] Error 2
Makefile:147: recipe for target 'all' failed
make: *** [all] Error 2
The command '/bin/sh -c make' returned a non-zero code: 2
either change the container script and specify CMake parameter -DWITH_ZLIB=bundled to use zlib sources in extra/zlib or install zlib by apt-get install zlib-devel
Related
I am trying to build Fiware Orion context broker using Dockerfile at:
https://hub.docker.com/r/fiware/orion/
As a first step I have tried replacing the FROM image with the "supposed" equivalent of Centos for s390x, ClefOS: https://hub.docker.com/_/clefos :
FROM s390x/clefos:7.6.1810
It takes a long time and seems to go OK but ends up with the error below. Any ideas? Anybody has successfully built any Orion version docker image on IBM Z? (s390x)
Update: I have added those four libraries in the yum install command in Dockerfile and they are correctly installed but the problem is still there. It seems not just a problem of those boost_* libs missing but some configuration fix needed to "ld" locates them.
[ 97%] Building CXX object src/lib/mongoBackend/CMakeFiles/mongoBackend.dir/mongoRegistrationCreate.cpp.o
[ 97%] Building CXX object src/lib/mongoBackend/CMakeFiles/mongoBackend.dir/mongoRegistrationDelete.cpp.o
[ 97%] Building CXX object src/lib/mongoBackend/CMakeFiles/mongoBackend.dir/connectionOperations.cpp.o
[ 97%] [ 98%] Building CXX object src/lib/mongoBackend/CMakeFiles/mongoBackend.dir/mongoSubCache.cpp.o
Building CXX object src/lib/mongoBackend/CMakeFiles/mongoBackend.dir/safeMongo.cpp.o
[ 98%] Building CXX object src/lib/mongoBackend/CMakeFiles/mongoBackend.dir/compoundResponses.cpp.o
[ 98%] Building CXX object src/lib/mongoBackend/CMakeFiles/mongoBackend.dir/location.cpp.o
[ 99%] Building CXX object src/lib/mongoBackend/CMakeFiles/mongoBackend.dir/compoundValueBson.cpp.o
[ 99%] Building CXX object src/lib/mongoBackend/CMakeFiles/mongoBackend.dir/dateExpiration.cpp.o
Linking CXX static library libmongoBackend.a
make[3]: Leaving directory `/opt/libmicrohttpd-0.9.48/mongo-cxx-driver-legacy-1.1.2/fiware-orion/BUILD_RELEASE'
[ 99%] Built target mongoBackend
make[3]: Entering directory `/opt/libmicrohttpd-0.9.48/mongo-cxx-driver-legacy-1.1.2/fiware-orion/BUILD_RELEASE'
Scanning dependencies of target contextBroker
make[3]: Leaving directory `/opt/libmicrohttpd-0.9.48/mongo-cxx-driver-legacy-1.1.2/fiware-orion/BUILD_RELEASE'
make[3]: Entering directory `/opt/libmicrohttpd-0.9.48/mongo-cxx-driver-legacy-1.1.2/fiware-orion/BUILD_RELEASE'
[100%] Building CXX object src/app/contextBroker/CMakeFiles/contextBroker.dir/contextBroker.cpp.o
[100%] Building CXX object src/app/contextBroker/CMakeFiles/contextBroker.dir/orionRestServices.cpp.o
Linking CXX executable contextBroker
/usr/bin/ld: cannot find -lboost_thread-mt
/usr/bin/ld: cannot find -lboost_filesystem-mt
/usr/bin/ld: cannot find -lboost_system-mt
/usr/bin/ld: cannot find -lboost_regex-mt
collect2: error: ld returned 1 exit status
make[3]: *** [src/app/contextBroker/contextBroker] Error 1
make[3]: Leaving directory `/opt/libmicrohttpd-0.9.48/mongo-cxx-driver-legacy-1.1.2/fiware-orion/BUILD_RELEASE'
make[2]: *** [src/app/contextBroker/CMakeFiles/contextBroker.dir/all] Error 2
make[2]: Leaving directory `/opt/libmicrohttpd-0.9.48/mongo-cxx-driver-legacy-1.1.2/fiware-orion/BUILD_RELEASE'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/opt/libmicrohttpd-0.9.48/mongo-cxx-driver-legacy-1.1.2/fiware-orion/BUILD_RELEASE'
make: *** [release] Error 2
The command '/bin/sh -c adduser --comment "${ORION_USER}" ${ORION_USER} && yum -y install epel-release && yum -y install boost-devel bzip2 cmake gnutls-devel libgcrypt-devel libcurl-devel openssl-devel libuuid-devel make nc git gcc-c++ scons tar which cyrus-sasl-devel && curl -kOL http://ftp.gnu.org/gnu/libmicrohttpd/libmicrohttpd-0.9.48.tar.gz && tar xvf libmicrohttpd-0.9.48.tar.gz && cd libmicrohttpd-0.9.48 && ./configure --disable-messages --disable-postprocessor --disable-dauth && make && make install && ldconfig && curl -kOL https://github.com/mongodb/mongo-cxx-driver/archive/legacy-1.1.2.tar.gz && tar xfz legacy-1.1.2.tar.gz && cd mongo-cxx-driver-legacy-1.1.2 && scons --use-sasl-client --ssl && scons install --prefix=/usr/local --use-sasl-client --ssl && curl -kOL https://github.com/miloyip/rapidjson/archive/v1.0.2.tar.gz && tar xfz v1.0.2.tar.gz && mv rapidjson-1.0.2/include/rapidjson/ /usr/local/include && git clone https://github.com/telefonicaid/fiware-orion && cd fiware-orion && git checkout ${GIT_REV_ORION} && make && make install && strip /usr/bin/contextBroker && mkdir -p /var/log/contextBroker && mkdir -p /var/run/contextBroker && chown ${ORION_USER} /var/log/contextBroker && chown ${ORION_USER} /var/run/contextBroker && cd /opt && if [ ${CLEAN_DEV_TOOLS} -eq 0 ] ; then yum clean all && exit 0 ; fi && rm -rf /opt/libmicrohttpd-0.9.48.tar.gz /usr/local/include/microhttpd.h /usr/local/lib/libmicrohttpd.* /opt/libmicrohttpd-0.9.48 /opt/legacy-1.1.2.tar.gz /opt/mongo-cxx-driver-legacy-1.1.2 /usr/local/include/mongo /usr/local/lib/libmongoclient.a /opt/rapidjson-1.0.2 /opt/v1.0.2.tar.gz /usr/local/include/rapidjson /opt/fiware-orion /usr/share/cracklib /usr/share/i18n /usr/{lib,lib64}/gconv && yum -y erase git perl* rsync cmake libarchive gcc-c++ cloog-ppl cpp gcc glibc-devel glibc-headers kernel-headers libgomp libstdc++-devel mpfr ppl scons boost-devel libcurl-devel gnutls-devel libgcrypt-devel clang llvm llvm-libs CUnit-devel CUnit autoconf automake m4 libidn-devel boost-wave boost-serialization boost-python boost-iostreams boost boost-date-time boost-test boost-graph boost-signals boost-program-options boost-math openssh openssh-clients libedit hwdata dbus-glib fipscheck* *devel sysvinit-tools && rpm -qa groff | xargs -r rpm -e --nodeps && yum clean all && rm -rf /var/lib/yum/yumdb && rm -rf /var/lib/yum/history && rpm -vv --rebuilddb && find /usr/share/locale -mindepth 1 -maxdepth 1 ! -name 'en_US' ! -name 'locale.alias' | xargs -r rm -r && bash -c 'localedef --list-archive | grep -v -e "en_US" | xargs localedef --delete-from-archive' && /bin/cp -f /usr/lib/locale/locale-archive /usr/lib/locale/locale-archive.tmpl && build-locale-archive && rm -f /var/log/*log' returned a non-zero code: 2
By
/usr/bin/ld: cannot find -lboost_thread-mt
/usr/bin/ld: cannot find -lboost_filesystem-mt
/usr/bin/ld: cannot find -lboost_system-mt
/usr/bin/ld: cannot find -lboost_regex-mt
I guess some required dependencies are missing. The solution would be to install them as part of the Dockefile script. However, not sure how to do it in s390x/clefos (in CentOS is a matter of installing the package that contains the dependency using yum, the Dockerfile does that).
I'm building a mosquito docker image, when calling make install meet these error messages 'install: unrecognized option: strip-program=strip', please help, thanks.
install -d /usr/local/lib/
install -s --strip-program=strip libmosquitto.so.1
/usr/local/lib/libmosquitto.so.1
install: unrecognized option: strip-program=strip
BusyBox v1.27.2 (2017-12-12 10:41:50 GMT) multi-call binary.
Usage: install [-cdDsp] [-o USER] [-g GRP] [-m MODE] [-t DIR] [SOURCE]... DEST
Copy files and set attributes
-c Just copy (default)
-d Create directories
-D Create leading target directories
-s Strip symbol table
-p Preserve date
-o USER Set ownership
-g GRP Set group ownership
-m MODE Set permissions
-t DIR Install to DIR
make[1]: *** [Makefile:28: install] Error 1
make[1]: Leaving directory '/usr/local/src/mosquitto-1.4.15/lib'
make: *** [Makefile:38: install] Error 2
Part of My Dockfile:
FROM alpine:3.7
RUN apk add --update --no-cache build-base openssl openssl-dev c-ares-dev util-linux-dev libwebsockets-dev libxslt && \
cd /usr/local && \
mkdir src && \
cd src && \
wget https://mosquitto.org/files/source/mosquitto-1.4.15.tar.gz && \
tar -zxvf mosquitto-1.4.15.tar.gz && \
cd mosquitto-1.4.15 && \
make && make install
Call make the last several result lines:
cc -Wall -ggdb -O2 -c mosquitto_passwd.c -o mosquitto_passwd.o
cc mosquitto_passwd.o -o mosquitto_passwd -lcrypto
make[1]: Leaving directory '/usr/local/src/mosquitto-1.4.15/src'
set -e; for d in man; do make -C ${d}; done
make[1]: Entering directory '/usr/local/src/mosquitto-1.4.15/man'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/usr/local/src/mosquitto-1.4.15/man'
The problem is that you're installing a mosquitto tar.gz with /usr/bin/install version: BusyBox v1.27.2, and your mosquitto's tar.gz downloaded with wget needs /usr/bin/install version from GNU coreutils 8.25 for example, which includes your missing option strip-program.
So, solution is simple: install a mosquitto version for alpine, not for generic Linux:
FROM alpine:3.7
RUN apk add --update --no-cache build-base openssl openssl-dev c-ares-dev util-linux-dev libwebsockets-dev libxslt && \
apk add mosquitto
It'll install version 1.4.15.
EDIT: If you need to install a plugin and compile a generic linux tar.gz, you have to install apk add coreutils
Except for the answer #mulg0r gave me. I found there was another way to solve this. I think this is also useful when someone meets a similar problem. From https://git.alpinelinux.org/cgit/aports/tree/main/mosquitto?h=master this link. the package from alpine Linux. Click the Git repository button, inside that page, this package's build process instructions are there. And some code changes to suit alpine Linux.
For this question, find APKBUILD file from https://git.alpinelinux.org/cgit/aports/tree/main/mosquitto?h=master. this line also solved my question:
sed -i -e "s|(INSTALL) -s|(INSTALL)|g" \
-e 's|--strip-program=${CROSS_COMPILE}${STRIP}||' \
*/Makefile */*/Makefile
Above is just comment out --strip-program when excute make install
I am currently trying to setup a Gazebo Simulation with Docker.Since i want to use a custom Gazebo Version made by Alessio Rocchi I am building everything from source. But while trying to build everything, i get the following error code:
cc1plus: warning: /tmp/gazebo/deps/klampt/Simulation/include: No such file or directory
cc1plus: warning: /etc/klampt/Library/KrisLibrary: No such file or directory
In file included from /tmp/gazebo/deps/klampt/Simulation/ODECustomGeometry.cpp:1:0:
/tmp/gazebo/deps/klampt/Simulation/ODECustomGeometry.h:4:34: fatal error: geometry/AnyGeometry.h: No such file or directory
#include <geometry/AnyGeometry.h>
^
compilation terminated.
deps/klampt/CMakeFiles/gazebo_klampt.dir/build.make:54: recipe for target 'deps/klampt/CMakeFiles/gazebo_klampt.dir/Simulation/ODECustomGeometry.cpp.o' failed
make[2]: *** [deps/klampt/CMakeFiles/gazebo_klampt.dir/Simulation/ODECustomGeometry.cpp.o] Error 1
CMakeFiles/Makefile2:388: recipe for target 'deps/klampt/CMakeFiles/gazebo_klampt.dir/all' failed
make[1]: *** [deps/klampt/CMakeFiles/gazebo_klampt.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
I am guessing it is more a CMake fault than a Docker fault, but i still don't manage to find a way around it. Maybe somebody can point out my probably fairly obvious errors.
FROM stevekuznetsov/klampt:latest
RUN sh -c 'echo "deb http://packages.ros.org/ros/ubuntu vivid main" > /etc/apt/sources.list.d/ros-latest.list'
RUN apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116
RUN apt-get update
RUN apt-get -y install ros-jade-desktop-full
RUN sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable vivid main" > /etc/apt/sources.list.d/gazebo-stable.list'
RUN apt-get -y install wget
RUN wget http://packages.osrfoundation.org/gazebo.key -O - | apt-key add -
RUN apt-get update
RUN wget https://bitbucket.org/osrf/release-tools/raw/default/jenkins-scripts/lib/dependencies_archive.sh -O /tmp/dependencies.sh
RUN apt-get -y install build-essential \
cmake \
mercurial
RUN hg clone https://bitbucket.org/ignitionrobotics/ign-math /tmp/ign-math
RUN cd /tmp/ign-math && \
hg up ign-math2 && \
mkdir build && \
cd build && \
cmake ../ && \
make -j4 && \
make install
RUN apt-get -y install build-essential \
cmake \
mercurial \
python \
libboost-system-dev \
libboost-filesystem-dev \
libboost-program-options-dev \
libboost-regex-dev \
libboost-iostreams-dev \
libtinyxml-dev \
libxml2-utils \
ruby-dev \
ruby
RUN hg clone https://bitbucket.org/osrf/sdformat /tmp/sdformat
RUN cd /tmp/sdformat && \
hg up sdf3 && \
mkdir build && \
cd build && \
cmake ../ && \
make -j4 && \
make install
RUN hg clone https://lpuck#bitbucket.org/arocchi/gazebo ./tmp/gazebo
RUN apt-get -y install protobuf-compiler
RUN cd /tmp/gazebo && \
hg pull && \
hg update blem_gz6_6.5.1 && \
mkdir build && \
cd build && \
cmake -DKRISLIBRARY_INCLUDE_DIR=/etc/Klampt/Library/KrisLibrary -DKRISLIBRARY_LIBRARY=etc/Klampt/Library/KrisLibrary/lib ../ && \
make -j4 && \
make install
My guess is, that this line (third last):
cmake -DKRISLIBRARY_INCLUDE_DIR=/etc/Klampt/Library/KrisLibrary -DKRISLIBRARY_LIBRARY=etc/Klampt/Library/KrisLibrary/lib ../ && \
is wrong and therefore responsible for the error. I guess i have some dependency which is set wrong. It would be highly appreciated if somebody could help me.
Edit:
The new error, and i updated the Dockerfile and the error Cmake line
Linking CXX shared library libgazebo_physics_ode.so
/usr/bin/ld: cannot find -lKrisLibrary
collect2: error: ld returned 1 exit status
make[2]: *** [gazebo/physics/ode/libgazebo_physics_ode.so.6.5.1] Error 1
gazebo/physics/ode/CMakeFiles/gazebo_physics_ode.dir/build.make:558: recipe for target 'gazebo/physics/ode/libgazebo_physics_ode.so.6.5.1' failed
CMakeFiles/Makefile2:4864: recipe for target 'gazebo/physics/ode/CMakeFiles/gazebo_physics_ode.dir/all' failed
make[1]: *** [gazebo/physics/ode/CMakeFiles/gazebo_physics_ode.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
I am planning to run a customized Rstudio with both tidyverse, rmarkdown and rstan pre-installed on Digital Ocean's Docker 17.03.0-ce on 16.04.
On Docker Hub, there is already a pre-built image: Rocker/verse that has tidyverse and rmarkdown functionality. So my plan was to simply get the latest version of Rocker/verse and add a new layer of rstan. I use the dockerfile of jonzelner/rstan and jrnold/rstan and update them as below:
FROM rocker/verse:latest
# Install essentials
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
clang-3.6
# Global site-wide config
RUN mkdir -p $HOME/.R/ \
&& echo "\nCXX=clang++ -ftemplate-depth-256\n" >> $HOME/.R/Makevars \
&& echo "CC=clang\n" >> $HOME/.R/Makevars
# Install rstan
RUN install2.r --error \
inline \
RcppEigen \
StanHeaders \
rstan \
KernSmooth
# Config for rstudio user
RUN mkdir -p /home/rstudio/.R/ \
&& echo "\nCXX=clang++ -ftemplate-depth-256\n" >> /home/rstudio/.R/Makevars \
&& echo "CC=clang\n" >> /home/rstudio/.R/Makevars \
&& echo "CXXFLAGS=-O3\n" >> /home/rstudio/.R/Makevars \
&& echo "\nrstan::rstan_options(auto_write = TRUE)" >> /home/rstudio/.Rprofile \
&& echo "options(mc.cores = parallel::detectCores())" >> /home/rstudio/.Rprofile
# Install loo
RUN install2.r --error \
matrixStats \
loo
However, my attempt to build this image (docker build -t image_name .) ended in error. The results are provided below:
Sending build context to Docker daemon 2.56 kB
Step 1/6 : FROM rocker/verse:latest
---> 7ad7d994bffd
Step 2/6 : RUN apt-get update && apt-get install -y --no-install-recommends clang-3.6
---> Using cache
---> 77473c759438
Step 3/6 : RUN mkdir -p $HOME/.R/ && echo "\nCXX=clang++ -ftemplate-depth-256\n" >> $HOME/.R/Makevars && echo "CC=clang\n" >> $HOME/.R/Makevars
---> Using cache
---> a5b06d28b9fe
Step 4/6 : RUN install2.r --error inline RcppEigen StanHeaders rstan KernSmooth
---> Running in 86b52d5a76f3
trying URL 'https://cran.rstudio.com/src/contrib/inline_0.3.14.tar.gz'
Content type 'unknown' length 18002 bytes (17 KB)
==================================================
downloaded 17 KB
* installing *source* package ‘inline’ ...
** package ‘inline’ successfully unpacked and MD5 sums checked
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
* DONE (inline)
The downloaded source packages are in
‘/tmp/downloaded_packages’
trying URL 'https://cran.rstudio.com/src/contrib/RcppEigen_0.3.2.9.0.tar.gz'
Content type 'unknown' length 1209128 bytes (1.2 MB)
==================================================
downloaded 1.2 MB
* installing *source* package ‘RcppEigen’ ...
** package ‘RcppEigen’ successfully unpacked and MD5 sums checked
** libs
clang++ -ftemplate-depth-256 -I/usr/local/lib/R/include -DNDEBUG -I/usr/local/include -I"/usr/local/lib/R/site-library/Rcpp/include" -I../inst/include -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c RcppEigen.cpp -o RcppEigen.o
/bin/bash: clang++: command not found
/usr/local/lib/R/etc/Makeconf:141: recipe for target 'RcppEigen.o' failed
make: *** [RcppEigen.o] Error 127
ERROR: compilation failed for package ‘RcppEigen’
* removing ‘/usr/local/lib/R/site-library/RcppEigen’
Error in install.packages(pkgs = f, lib = lib, repos = if (isMatchingFile(f)) NULL else rep, :
installation of package ‘RcppEigen’ had non-zero exit status
The command '/bin/sh -c install2.r --error inline RcppEigen StanHeaders rstan KernSmooth' returned a non-zero code: 1
Some similar questions about a package having non-zero exit status have to do with memory, so I tried to increase the Docker memory on my local machine, but still no luck. Is there any thing I can do to successfully build this image?
As you see in the error output, the installation process cannot find the compiler:
/bin/bash: clang++: command not found
Be aware that this is the output from trying to install clang-3.6 in a rocker/verse container:
root#8ea0d98e67c3:/# apt-get install -y --no-install-recommends clang-3.6
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'python-clang-3.6' for regex 'clang-3.6'
0 upgraded, 0 newly installed, 0 to remove and 15 not upgraded.
It appears that this image doesn't come with Clang 3.6 in its repositories. And this name instead points to python-clang-3.6; Clang bindings for the Python programming language.
Unless you absolutely want 3.6, I would install the plain clang package that points to 3.5, and then re-run the Docker build process.
apt-get install clang
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.