Undefined reference to symbol 'BIO_ctrl##libcrypto.so.10' - libraries

Hey guys I'm getting a weird g++ compile error while trying to run this C++ file,
here's exact repro steps.
# install taglib-devel
$ sudo yum -y install taglib-devel
$ cd /tmp && git clone https://gist.github.com/1468279.git; cd 1461468279/
$ gcc -g base64.c -lssl -c;
# install cmake
$ sudo yum install cmake
$ cd /tmp
# install taglib again =/
$ git clone git#github.com:taglib/taglib.git && cd taglib
$ cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_RELEASE_TYPE=Release .; make; sudo make install
$ cd /tmp/1461468279 && g++ -g -I. -I/usr/local/include/taglib -L/usr/local/lib -ltag -lssl setcover.cpp -o setcover base64.o
# response
/usr/bin/ld: base64.o: undefined reference to symbol 'BIO_ctrl##libcrypto.so.10'
/usr/bin/ld: note: 'BIO_ctrl##libcrypto.so.10' is defined in DSO /lib64/libcrypto.so.10 so try adding it to the linker command line
/lib64/libcrypto.so.10: could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status

I think is missing -lcrypto on the command that you put

Related

Building Fiware Orion context broker on LinuxOne docker (s390x)

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).

How to install Adafruit-GPIO library in Docker

I'm new to Docker, so there could be something I'm doing wrong. I'm trying to install Adafruit-GPIO in a container, but I keep getting this error and I'm not sure how to solve it. I'm building the file locally on a Windows 10 pc, using Powershell.
I'v made sure that the GCC is installed correctly and it is. I've been searching online for an answer and there isn't much to go on.
Dockerfile:
FROM balenalib/raspberry-pi-debian-python:3.7.2
RUN pip3 install --upgrade pip
RUN sudo pip3 install --upgrade setuptools
RUN sudo apt-get update && apt-get -y install gcc
RUN pip3 install adafruit-gpio
I'm expecting the file to compile and work successfully. Instead I'm getting this,
ERROR: Complete output from command /usr/local/bin/python3.7 -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-qfol0jyh/spidev/setup.py'"'"';f=getattr(tokenize, '"'"'open'"
'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-i37a5wvt/install-record.txt -
-single-version-externally-managed --compile:
ERROR: running install
running build
running build_ext
building 'spidev' extension
creating build
creating build/temp.linux-armv6l-3.7
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/local/include/python3.7m -c spidev_module.c -o build/temp.linux-armv6l-3.7/spidev_module.o
In file included from /usr/lib/gcc/arm-linux-gnueabihf/6/include-fixed/syslimits.h:7:0,
from /usr/lib/gcc/arm-linux-gnueabihf/6/include-fixed/limits.h:34,
from /usr/local/include/python3.7m/Python.h:11,
from spidev_module.c:28:
/usr/lib/gcc/arm-linux-gnueabihf/6/include-fixed/limits.h:168:61: fatal error: limits.h: No such file or directory
#include_next <limits.h> /* recurse down to the real one */
^
compilation terminated.
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Command "/usr/local/bin/python3.7 -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-qfol0jyh/spidev/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);cod
e=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-i37a5wvt/install-record.txt --single-version-external
ly-managed --compile" failed with error code 1 in /tmp/pip-install-qfol0jyh/spidev/
Install build-essential to replace gcc could make you work, see official git.
In fact, when build some source code, always better to install build-essential because it will not only install gcc, but also some dev package. Your error fatal error: limits.h: No such file or directory just because miss these dev package.
In a word, next will works for you:
RUN sudo apt-get update && apt-get -y install build-essential

Docker Build SofteWare using Alphine Linux with Error 'install: unrecognized option: strip-program=strip'

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

Error cannot find -lz building MariaDB on a debian based container

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

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