How to recover default boost installation on ubuntu? - c++

I was trying to compile boost 1.62 from source on ubuntu 12.04 where the default version is 1.48. During the course of trying everything, I removed boost from /usr/include/boost and libboost* from /usr/lib using the following commands
sudo rm -r /usr/include/boost
sudo rm -r /usr/include/libboost*
I have realized that now I need the default version (1.48) for my program to work. But when I use the following command
sudo apt-get install libboost-dev-all
it seems to install the libboost, but I am not able to see any boost directory in /usr/include. Moreover, I tried compiling a few programs with cmake and it also doesn't seem to find any boost library on the system.
Is it not possible to reinstall libboost if the libraries and headers have been removed manually ?

from the ubuntu forums :
choices:
sudo apt-get install --reinstall mypackage
sudo dpkg-reconfigure mypackage
( or if the other solutions have failed:
sudo apt-get purge mypackage && sudo apt-get install mypackage
and logout/in )
give it a shot !
also if you don't see any librarie after installing one you can run :
sudo ldconfig
The above command will make ld (the dynamic libraries loader) aware of the new libraries.

Related

installation error: 'Unable to locate package g++-4.8'

I am trying to install gcc and g++ version 4.8 to run a specific software in Ubuntu 22.04.1
when I perform
sudo apt-get install g++-4.8
it says
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package g++-4.8
E: Couldn't find any package by glob 'g++-4.8'
E: Couldn't find any package by regex 'g++-4.8'
and When I perform
sudo apt-get install gcc-4.8
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'gcc-4.8-hppa64' for regex 'gcc-4.8'
The following packages were automatically installed and are no longer required:
chromium-codecs-ffmpeg-extra gstreamer1.0-vaapi i965-va-driver intel-media-va-driver libaacs0 libaom3 libass9 libavcodec58 libavformat58 libavutil56 libbdplus0 libbluray2
libbs2b0 libchromaprint1 libcodec2-1.0 libdav1d5 libflashrom1 libflite1 libftdi1-2 libgme0 libgsm1 libgstreamer-plugins-bad1.0-0 libigdgmm12 liblilv-0-0 libmfx1 libmysofa1
libnorm1 libopenmpt0 libpgm-5.3-0 libpostproc55 librabbitmq4 librubberband2 libserd-0-0 libshine3 libsnappy1v5 libsord-0-0 libsratom-0-0 libsrt1.4-gnutls libssh-gcrypt-4
libswresample3 libswscale5 libudfread0 libva-drm2 libva-wayland2 libva-x11-2 libva2 libvdpau1 libvidstab1.1 libx265-199 libxvidcore4 libzimg2 libzmq5 libzvbi-common libzvbi0
mesa-va-drivers mesa-vdpau-drivers pocketsphinx-en-us va-driver-all vdpau-driver-all
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
What could be done?
You could possibly recompile gcc 4.8.5 with the following script. However there is a lot that can go wrong depending on the machine that you are compiling it since the compiler itself depends on a large set of utilities - called the toolchain and they are tightly coupled with the machine's own system libraries, in particular the C standard library.
sudo dpkg --add-architecture i386
sudo apt update
sudo apt upgrade
sudo apt-get install gcc-multilib libstdc++6:i386
wget https://ftp.gnu.org/gnu/gcc/gcc-4.8.5/gcc-4.8.5.tar.bz2 --no-check-certificate
tar xf gcc-4.8.5.tar.bz2
cd gcc-4.8.5
./contrib/download_prerequisites
cd ..
sed -i -e 's/__attribute__/\/\/__attribute__/g' gcc-4.8.5/gcc/cp/cfns.h
sed -i 's/struct ucontext/ucontext_t/g' gcc-4.8.5/libgcc/config/i386/linux-unwind.h
mkdir xgcc-4.8.5
pushd xgcc-4.8.5
$PWD/../gcc-4.8.5/configure --enable-languages=c,c++ --prefix=/usr --enable-shared --enable-plugin --program-suffix=-4.8.5
make MAKEINFO="makeinfo --force" -j
sudo make install -j

conan system_requirements auto install

While installing xorg with conan install .. command,
system requirements are checked in conan receipe using pkg-config tool.
Each missing system package raises an exception, and thus stop the conan install command.
ERROR: xorg/system: Error in package_info() method, line 97
self._fill_cppinfo_from_pkgconfig(name)
while calling '_fill_cppinfo_from_pkgconfig', line 24
if not pkg_config.provides:
ConanException: pkg-config command ['pkg-config', '--print-provides', 'xcb-renderutil', '--print-errors'] failed with error: Command 'pkg-config --print-provides xcb-renderutil --print-errors' returned non-zero exit status 1.
Package xcb-renderutil was not found in the pkg-config search path.
Perhaps you should add the directory containing `xcb-renderutil.pc'
to the PKG_CONFIG_PATH environment variable
No package 'xcb-renderutil' found
I cannot get those system packages to be installed by conan tool, am I missing a command line argument while invoking conan ?
you can ask conan to install binary packages into your system ( sudo apt-get install ... ) by himself. See my example:
sudo conan install /home/username/QtProj/console_test1/QCoreApplication_quit_example/conanfile.txt --build=qt -c tools.system.package_manager:mode=install
To use it your conan version must be installed using sudo. If you get:
sudo: conan: command not found
You should do:
pip uninstall conan
sudo pip install conan
There are usually distribution-specific package manager warnings listing what dependencies need to be installed above this line:
ERROR: xorg/system:...
For example, on Ubuntu 22.04 I got the following after adding opencv/4.5.5 to my conanfile.txt:
...
dpkg-query: no packages found matching libx11-xcb-dev
dpkg-query: no packages found matching libfontenc-dev
dpkg-query: no packages found matching libxaw7-dev
dpkg-query: no packages found matching libxkbfile-dev
dpkg-query: no packages found matching libxmu-dev
dpkg-query: no packages found matching libxmuu-dev
...
ERROR: xorg/system:...
You can resolve this by installing the listed dependencies. In my case this is what solved it:
sudo apt-get install -y xorg openbox xauth libx11-xcb-dev libx11-xcb-dev libfontenc-dev libxaw7-dev libxkbfile-dev libxmu-dev libxmuu-dev libxpm-dev libxres-dev libxss-dev libxt-dev libxtst-dev libxv-dev libxvmc-dev libxxf86vm-dev

Does OpenCV suppress OpenMP?

I got a question concerning OpenCV and OpenMP.
I used to parallelize my code using OpenMP, since I have to do some heavy computing on large images. Up to now (I did not use OpenCV so far) the parallelization worked fine for me.
Then I needed some functionality of the OpenCV library. Since I incorporated OCV in my code, the parallelization no longer works. Allthough I am NOT parallelizing any OCV functions. Moreover, even if I only link in the OCV libraries (core, imgproc, imgcodecs), parallelization does not work anymore.
So, how can that be? And how can I enable the parallelization (again)?
I use OpenCV 4.1 on a OpenSuSE 15.1 system. IDE is Code::Blocks. All libraries where installed from official repos (meaning: I have no clou how to work with cmake...).
Could anybody give me a hint, how to fix this?
Thank you
Phtagen
This installation guide assumes that the OS is Ubuntu. I post it because it will probably help solving your problem.
Install OpenCV dependencies.
sudo apt-get install build-essential
sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libdc1394-22-dev libv4l-dev
sudo apt-get install libcanberra-gtk-module libcanberra-gtk3-module
Download the source code of the OpenCV version you like with some extra modules.
CV_DISTRO=3.4.0
git clone --branch $CV_DISTRO https://github.com/opencv/opencv.git opencv_$CV_DISTRO --depth 1
git clone --branch $CV_DISTRO https://github.com/opencv/opencv_contrib.git opencv_contrib_$CV_DISTRO --depth 1
Then build OpenCV.
cd opencv_$CV_DISTRO
mkdir -p build
cd build/
cmake -D CMAKE_BUILD_TYPE=Release \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib_$CV_DISTRO/modules \
-D WITH_TBB=ON \
-D OPENCV_ENABLE_NONFREE=ON \
-D WITH_OPENMP=ON ..
make -j7
sudo make install
sudo ldconfig
Feel free to edit this post.

How to install Boost from source

I am trying to install the Boost C++ from source.
I first tried using yum to install them in (Amazon Linux AMI) but it installed a version that is too old. I need at least version 1.54
So I tried to follow the instructions here:
https://www.boost.org/doc/libs/1_70_0/more/getting_started/unix-variants.html
Once I downloaded the source, I tried symlinking the header files to /usr/include:
ln -s /root/boost_1_70_0/boost /usr/include/boost
Then I followed the instructions to try to build:
cd /root/boost_1_70_0
./bootstrap.sh
./b2 install
Then when I try to compile my program that needs boost libraries (happens to be OSRM), I get this error:
make[2]: *** No rule to make target `/usr/lib64/libboost_date_time-mt.so', needed by `osrm-components'. Stop.
So it seems somehow I need to build the boost .so files to go in /usr/lib64. But how do I do that?
I believe that you've already built the boost .so files but I don't know where. It normally tries to install them in /usr/local, see section 5.1 of the instructions you referenced.
You may be able to find them with locate, e.g.:
locate boost
Otherwise, you can call ./bootstrap.sh with a prefix indicating where you want it to build the libraries, e.g.:
./bootstrap.sh --prefix=/root/boost_1_70_0/stage
./b2 install
You can then copy the .so files together with with their symbolic links to /usr/lib64, e.g.:
cd /usr/lib64
rm -fr libboost*
cp -a /root/boost_1_70_0/stage/lib/libboost* .
chmod a+x libboost*
Note: the line rm -fr libboost* in /usr/lib64 is to remove the very old version of boost that you installed with yum.

fatal error: hdf5.h: No such file or directory [duplicate]

I am having trouble when installing Caffe Deep Learning Framework on Python:
When I run make command at caffe directory, it says
hdf5.h:no such directory
The steps I have done:
Update and upgrade my Ubuntu Server
Install Python 2.7
Having all of the dependencies base on http://caffe.berkeleyvision.org/install_apt.html
Run cp cp Makefile.config.example Makefile.config
Uncomment cpu_only = 1 in Makefile.config
I will be grateful if someone can help me.
Error message:
CXX src/caffe/util/hdf5.cpp
in file include from src/caffe/util/hdf5.cpp:1:0:
./include/caffe/util/hdf5.hpp:6:18: fatal error: hdf5.h: No such file or directory
compilation terminated
Makefile:572 recipe for target '.build_release/src/caffe/util/hdf5.o'
failed Make:*** [.build_release/src/caffe/util/hdf5.o] Error 1
What is the version of your Ubuntu install? Try this. In your Makefile.config try to append /usr/include/hdf5/serial/ to INCLUDE_DIRS:
--- INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include
+++ INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial/
and rename hdf5_hl and hdf5 to hdf5_serial_hl and hdf5_serial in the Makefile:
--- LIBRARIES += glog gflags protobuf boost_system boost_filesystem m hdf5_hl hdf5
+++ LIBRARIES += glog gflags protobuf boost_system boost_filesystem m hdf5_serial_hl hdf5_serial
More about the bug fix here.
This solution worked for me on the Ubuntu16.04LTS
sudo apt-get install libhdf5-10
sudo apt-get install libhdf5-serial-dev
sudo apt-get install libhdf5-dev
sudo apt-get install libhdf5-cpp-11
find /usr -iname "*hdf5.h*"
/usr/include/hdf5/serial/hdf5.h
export CPATH="/usr/include/hdf5/serial/"
Another case I've experienced with:
I was using Ubuntu 14.04 and installing hdf5-1.10.0.
I found hdf5.h was located in /usr/local/hdf5/include. Thus, I modified Makefile.config file by adding that location to INCLUDE_DIRS.
# Whatever else you find you need goes here.
INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include \
/usr/local/hdf5/include
I didn't rename anything in Makefile. It worked fine.
It did not work for me on Ubuntu16.04 LTS.
So I had to
sudo apt-get install libhdf5-10
sudo apt-get install libhdf5-serial-dev
sudo apt-get install libhdf5-dev
sudo apt-get install libhdf5-cpp-11
find /usr -iname "*hdf5.h*"
/usr/include/hdf5/serial/hdf5.h
Now do this
export CPATH="/usr/include/hdf5/serial/"
On RHEL7, I got tired of hunting for specific hdf5 RPMs and ran:
sudo yum install *hdf5*
and these are what I have:
hdf5-openmpi3-static-1.8.12-11.el7.x86_64
hdf5-1.8.12-11.el7.x86_64
hdf5-openmpi-static-1.8.12-11.el7.x86_64
hdf5-openmpi3-devel-1.8.12-11.el7.x86_64
hdf5-openmpi3-1.8.12-11.el7.x86_64
hdf5-mpich-devel-1.8.12-11.el7.x86_64
hdf5-devel-1.8.12-11.el7.x86_64
hdf5-openmpi-devel-1.8.12-11.el7.x86_64
hdf5-mpich-static-1.8.12-11.el7.x86_64
hdf5-mpich-1.8.12-11.el7.x86_64
hdf5-openmpi-1.8.12-11.el7.x86_64
Thanks to #loretoparisi, I was able to figure out where I had the header file I was missing and the problem went away.
$ find /usr -iname "*hdf5.h*"
/usr/include/openmpi-x86_64/hdf5.h
/usr/include/hdf5.h
/usr/include/mpich-x86_64/hdf5.h
/usr/include/openmpi3-x86_64/hdf5.h