Compiling VLC met undefined reference error - vlc

I tried to compile vlc on a ubuntu docker container.
(In host)
git clone --depth=1 vlc
docker run -v ~/vlc:/root/vlc -it ubuntu:17.04
(In container)
# install dependencies
apt update && apt upgrade
apt install git build-essential pkg-config libtool automake autopoint gettext
apt-get build-dep vlc
# install ffmpeg
cd /root
git clone --depth=1 https://github.com/FFmpeg/FFmpeg.git
cd FFmpeg
./configure
make
make install
# build vlc
cd /root/vlc
./configure --disable-wayland --disable-chromecast
make
Then this error
make[4]: Entering directory '/root/vlc/modules'
CCLD libavio_plugin.la
/usr/local/lib/libavutil.a(hwcontext_vaapi.o): In function `vaapi_device_free':
/root/FFmpeg/libavutil/hwcontext_vaapi.c:899: undefined reference to `XCloseDisplay'
....
I barely knows C. It seems that it has some problem with XCB, how do I proceed?

Related

Building Iroha in Docker with cmake

I try to build Iroha Hyperledger using Doker. after I clone the image and try to execute the build with CMake
cmake -H. -Bbuild -DCMAKE_TOOLCHAIN_FILE=/opt/dependencies/scripts/buildsystems/vcpkg.cmake -G "Ninja"
I got this error:
Could not find toolchain file:
/opt/dependencies/scripts/buildsystems/vcpkg.cmake
Call Stack (most recent call first):
CMakeLists.txt:12 (PROJECT)
I use CMake 3.16
Any help
You should build vcpkg and install vcpkg packages before building iroha. Please refer the docs.
Commands to do (as #kyb said) and according to instruction:
Installing dependencies:
apt-get update; \
apt-get -y --no-install-recommends install \
build-essential ninja-build \
git ca-certificates tar curl unzip cmake
Clonning iroha:
git clone https://github.com/hyperledger/iroha.git
Building dependencies:
iroha/vcpkg/build_iroha_deps.sh
vcpkg/vcpkg integrate install
As a result You will see command like:
-DCMAKE_TOOLCHAIN_FILE=/path/to/vcpkg/scripts/buildsystems/vcpkg.cmake
Finally You need to add the command to the CMake command (as You provided):
cmake -H. -Bbuild -DCMAKE_TOOLCHAIN_FILE=/opt/dependencies/scripts/buildsystems/vcpkg.cmake -G "Ninja"
Last step would be run ninja:
cmake --build . --target irohad -- -j<number of threads>
Optionally You can install the binaries:
cmake --install . --target irohad

OpenCV with libav for codecs on Amazon EC2 AMI

We have an application that requires opencv in a recent version with pkg-config visibility and shared libraries to build. However, the Amazon EC2 AMI instances we are deploying on does not include the yum packages for codecs nor the opencv package.
Other pages describe how to use centOS og rpm packages to get to a working installation. We need a clean install with no yum/rpm cross over.
These steps are most likely one of the shorter paths to the target. Starting directory location is irrelevant as first line ensures a sane (~/build) initial working directory:
cd ~/ && mkdir build && cd build/
sudo yum install git cmake gcc-c++
Build libav for the codecs (the --prefix option is probably not necessary, but this is the tested and working version)
wget https://libav.org/releases/libav-12.3.tar.xz
tar xzf libav-12.3.tar.gz
mkdir libav-12.3-build && cd libav-12.3-build
/home/ec2-user/build/libav-12.3/configure --prefix=/usr --enable-shared --disable-static
make && sudo make install
The amazon default pkg-config thing-a-magic does not look at all standard paths so the next lines symlinks the relevant *.pc files to a location where pkg-config (used by opencv) can find them.
cd /usr/share/pkgconfig
for t in `find /usr -name "libav*.pc"`; do sudo ln -s $t .; done
cd ~/build
The libav shared libraries have to be available to the linker as well
echo /usr/lib/ > libav.conf
sudo mv libav.conf /etc/ld.so.conf.d/
sudo ldconfig
Check the pkg-config libav availability by the command pkg-config --list-all and check that the libavcodec, libavformat, libav... etc. packages are listed.
At this point the opencv library can be built and installed with the default tooling
git clone https://github.com/Itseez/opencv.git
mv opencv opencv.git
cd opencv.git/
git branch -r
git checkout 3.4
cd .. && mkdir opencv && cd opencv
cmake ../opencv.git/ && make && sudo make install
cd ..
The final binary requires the linker path to contain the '''/usr/local/lib64''' path.
echo /usr/local/lib64 > opencv.conf
sudo mv opencv.conf /etc/ld.so.conf.d/
sudo ldconfig
The last trick is to enable pkg-config for opencv as well
cd /usr/share/pkg-config && ln -s `find /usr/local/ -name "opencv.pc"` . && cd ~/build
Check the pkg-config availability by the command
pkg-config --list-all
and check that opencv is listed.
Done

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.

Can't install s3fs-fuse(yum fuse-devel version issue) and can't install libfuse(./config missing issue)

I am trying to get s3fs-fuse installed on my Docker container. Here is my Dockerfile so far.
FROM centos:centos6
RUN yum -y update; yum clean all; \
yum groupinstall -y "Web Server" "MySQL Database" "PHP Support"; \
service httpd start; \
chkconfig httpd on;
RUN yum install -y openssh; \
yum install -y openssh-clients;
ADD ssh/ /root/.ssh/
RUN chmod 600 /root/.ssh/*; \
touch /root/.ssh/known_hosts; \
ssh-keyscan github.com >> /root/.ssh/known_hosts;
RUN yum install -y git;
RUN yum install -y autoconf libtool gcc libstdc++-devel curl-devel mailcap; \
yum install -y automake fuse-devel gcc-c++ git libcurl-devel libxml2-devel make openssl-devel;
Then after following the instructions at https://github.com/s3fs-fuse/s3fs-fuse I perform the following commands:
git clone https://github.com/s3fs-fuse/s3fs-fuse.git
cd s3fs-fuse
./autogen.sh
./configure
Then I get this:
checking s3fs build with NSS... no
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for common_lib_checking... configure: error: Package requirements (fuse >= 2.8.4 libcurl >= 7.0 libxml-2.0 >= 2.6) were not met:
Requested 'fuse >= 2.8.4' but version of fuse is 2.8.3
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables common_lib_checking_CFLAGS
and common_lib_checking_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
So, I presume I need to get the right fuse version as yum fuse-devel isn't cutting it. So I go to https://github.com/libfuse/libfuse and follow the instructions there with do the following:
git clone https://github.com/libfuse/libfuse.git;
cd libfuse;
./configure
Then I get this issue:
bash: ./configure: No such file or directory
I have been all around the internet and have tried the whole autoconf and autoreconf -i thing that lead to m4 directory missing errors. I have also tried adding the --prefix=/your/chosen/directory to the ./configure --prefix=/your/chosen/directory command that lead me no where. No luck with a super sad face.
Run makeconf.sh in your libfuse clone which creates configure.

Can ejabberd be installed on Google Compute Engine?

Can ejabberd be installed on Google Compute Engine? Will there be any issues with using ejabberd on Compute Engine? I have looked but cannot find any references to anyone trying this before. Grateful for any help.
Yes. Compute Engine gives you VMs. You can put whatever you want on them, such as Erlang and ejabberd.
Yes you can.
You can use the Vm with Debian Image and follow this intructions.
http://www.howtoforge.com/virtual-mail-jabber-server-xmpp-with-iredmail-and-ejabberd-on-ubuntu-9.10
dont forget open the ports in the firewall.
Sorry I didn't have much time to put together a cleaner "how to". I just copied and pasted from my personal archive.
Here's what you'd have to do to compile the source code on a Compute Engine. Please let me know if you have any questions.
Image: debian-7-wheezy-v20140408
sudo apt-get update
sudo apt-get install build-essential
sudo apt-get install libncurses5-dev
sudo apt-get install openssl libssl-dev
sudo apt-get install libexpat1-dev
sudo apt-get install unixodbc-dev
wget http://pyyaml.org/download/libyaml/yaml-0.1.5.tar.gz
tar tar -xvzf yaml-0.1.5.tar.gz
cd yaml-0.1.5
./configure
sudo make
sudo make install
sudo apt-get install xsltproc
sudo apt-get install fop
cd ..
wget http://www.erlang.org/download/otp_src_R16B03-1.tar.gz
gunzip -c otp_src_R16B03-1.tar.gz | tar -xf -
cd o....
./configure --with-odbc=/usr/lib/odbc
sudo make
sudo make install
[.. Install git and clone repo here.. ]
git clone git#github.com:processone/ejabberd.git
cd ejabberd
./configure --enable-odbc --enable-mysql
sudo make
sudo make install

Resources