PX4/Firmware make error - c++

Question: When I run make px4fmu-v2_default, I get this:
rootroot:~/Firmware$ make px4fmu-v2_default
Makefile:44: Not a valid CMake version or CMake not installed.
Makefile:45: On Ubuntu, install or upgrade via:
Makefile:46:
Makefile:47: 3rd party PPA:
Makefile:48: sudo add-apt-repository ppa:george-edison55/cmake-3.x -y
Makefile:49: sudo apt-get update
Makefile:50: sudo apt-get install cmake
Makefile:51:
Makefile:52: Official website:
Makefile:53: wget https://cmake.org/files/v3.3/cmake-3.3.2-Linux-x86_64.sh
Makefile:54: chmod +x cmake-3.3.2-Linux-x86_64.sh
Makefile:55: sudo mkdir /opt/cmake-3.3.2
Makefile:56: sudo ./cmake-3.3.2-Linux-x86_64.sh --prefix=/opt/cmake-3.3.2 --exclude-subdir
Makefile:57: export PATH=/opt/cmake-3.3.2/bin:$PATH
Makefile:58:
Makefile:59: *** Fatal。 停止。
My CMAKE version
root#root:~/Firmware$ cmake --version
cmake version 3.0.2
CMake suite maintained and supported by Kitware (kitware.com/cmake).
Why?

https://github.com/PX4/Firmware/blob/master/Tools/check_cmake.sh:
if [[ $cmake_ver == *" 2.8"* ]] || [[ $cmake_ver == *" 2.9"* ]] || [[ $cmake_ver == *" 3.0"* ]] || [[ $cmake_ver == *" 3.1"* ]]
then
exit 1;
fi
The code explicitly rejects cmake versions 2.8, 2.9, 3.0 (including your 3.0.2), 3.1.
You need to upgrade your cmake to at least version 3.2.

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

Could NOT find Glog (missing: GLOG_INCLUDE_DIR GLOG_LIBRARY)

I am trying to install openpose in Ubuntu 20.04 using CMAKE and I get the following error:
Could NOT find Glog (missing: GLOG_INCLUDE_DIR GLOG_LIBRARY)
I am following the instructions here (unfortunately, the screenshots are not available but I just followed the textual commands):
https://github.com/CMU-Perceptual-Computing-Lab/openpose/blob/master/doc/installation/README.md
I made a build folder in openpose folder and then ran the cmake-gui .. command.
A GUI opens with all these checked (I don't change anything):
and the error is:
GCC detected, adding compile flags
GCC detected, adding compile flags
Building with CUDA.
CUDA detected: 10.1
Added CUDA NVCC flags for: sm_75
cuDNN not found
Found gflags (include: /usr/include, library: /usr/lib/x86_64-linux-gnu/libgflags.so)
Could NOT find Glog (missing: GLOG_INCLUDE_DIR GLOG_LIBRARY)
CMake Warning at /usr/share/cmake-3.16/Modules/FindProtobuf.cmake:499 (message):
Protobuf compiler version 3.13.0 doesn't match library version 3.6.1
Call Stack (most recent call first):
CMakeLists.txt:429 (find_package)
Found Protobuf: /usr/lib/x86_64-linux-gnu/libprotobuf.so;-lpthread (found version "3.6.1")
Found OpenCV: /usr (found version "4.2.0")
cuDNN not found.
#!/bin/bash
echo "This script assumes Ubuntu 16 or 14 and Nvidia Graphics card up to 10XX. Otherwise, it will fail."
# Install cuDNN 5.1
if [[ $UBUNTU_VERSION == *"14."* ]] || [[ $UBUNTU_VERSION == *"15."* ]] || [[ $UBUNTU_VERSION == *"16."* ]]; then
CUDNN_URL="http://developer.download.nvidia.com/compute/redist/cudnn/v5.1/cudnn-8.0-linux-x64-v5.1.tgz"
wget -c ${CUDNN_URL}
sudo tar -xzf cudnn-8.0-linux-x64-v5.1.tgz -C /usr/local
rm cudnn-8.0-linux-x64-v5.1.tgz && sudo ldconfig
else
echo "cuDNN NOT INSTALLED! Ubuntu 16 or 14 not found. Install cuDNN manually from 'https://developer.nvidia.com/cudnn'."
fi
CMake Error at CMakeLists.txt:520 (message):
Install cuDNN using the above commands. or turn off cuDNN by setting
USE_CUDNN to OFF.
Configuring incomplete, errors occurred!
See also "/home/mona/research/code/openpose/build/CMakeFiles/CMakeOutput.log".
See also "/home/mona/research/code/openpose/build/CMakeFiles/CMakeError.log".
Then, I installed gflags using sudo apt-get install libgflags-dev command but I still get the same error. How could I fix this problem?
This is the git log to see which version of repo I am at for reproducing the error:
$ git log
commit a255747af22116ad76004437456bb531dc5d0b23 (HEAD -> master, origin/master, origin/HEAD)
Author: Wlad Meixner <9556979+gosticks#users.noreply.github.com>
Date: Mon Dec 21 22:01:10 2020 +0100
Fix possible typo (#1802)
The CMakeOutput.log and CMakeError.log can be found here https://github.com/CMU-Perceptual-Computing-Lab/openpose/issues/1814
$ sudo apt install libgoogle-glog-dev
Also,
$ sudo apt-get install libgflags-dev
$ sudo apt install libgoogle-glog-dev
$ sudo apt-get install protobuf-compiler libprotobuf-dev
since initially I didn't have any of them installed.
If you have run it from the command line you should have see them...
if (NOT GLOG_FOUND)
message(FATAL_ERROR "Glog not found. Install Glog from the command line using the command(s) -\
sudo apt-get install libgoogle-glog-dev")
endif (NOT GLOG_FOUND)
if (NOT GFLAGS_FOUND)
message(FATAL_ERROR "GFlags not found. Install GFlags from the command line using the command(s) --\
sudo apt-get install libgflags-dev")
endif (NOT GFLAGS_FOUND)
if (NOT OpenCV_FOUND)
message(FATAL_ERROR "OpenCV not found. Install OpenCV from the command line using the command(s) --\
sudo apt-get install libopencv-dev")
endif (NOT OpenCV_FOUND)
ref: https://github.com/CMU-Perceptual-Computing-Lab/openpose/blob/5a9acc730915f2171badcf10076aef9213f38e01/CMakeLists.txt#L523-L537
note: A better way, would be to use FetchContent() when third parties are missing (since they provide a CMake based build), also the command provided is ubuntu only...

How to install aclocal in ubuntu14.04

I want to install aclocal -I m4 in ubuntu 14.04 when i run the command its showing
First installed
sudo apt-get install autotools-dev
then,
sudo apt-get install aclocal
same error also getting.
I needed to install all of the following packages to get aclocal running:
apt install automake
apt install autoconf
apt install m4
apt install perl
apt install libtool
This was the error message that I received when I tried to install ssdeep:
WARNING: 'aclocal-1.13' is missing on your system.
You should only need it if you modified 'acinclude.m4' or
'configure.ac' or m4 files included by 'configure.ac'.
The 'aclocal' program is part of the GNU Automake package:
<http://www.gnu.org/software/automake>
It also requires GNU Autoconf, GNU m4 and Perl in order to run:
<http://www.gnu.org/software/autoconf>
<http://www.gnu.org/software/m4/>
<http://www.perl.org/>
Makefile:426: recipe for target 'aclocal.m4' failed
make: *** [aclocal.m4] Error 127
/bin/sh: 1: libtoolize: not found
/usr/bin/m4:aclocal.m4:1069: cannot open `m4/libtool.m4': No such file or directory
/usr/bin/m4:aclocal.m4:1070: cannot open `m4/ltoptions.m4': No such file or directory
/usr/bin/m4:aclocal.m4:1071: cannot open `m4/ltsugar.m4': No such file or directory
/usr/bin/m4:aclocal.m4:1072: cannot open `m4/ltversion.m4': No such file or directory
/usr/bin/m4:aclocal.m4:1073: cannot open `m4/lt~obsolete.m4': No such file or directory
autom4te: /usr/bin/m4 failed with exit status: 1
automake: error: autoconf failed with exit status: 1
Failed while building ssdeep lib with configure and make.
Retry with autoreconf ...
Failed to reconfigure the project build.
Install it from source, you avoid a lot of troubles compiling other software in the future. aclocal package does NOT exist, and is part of automake package.
$ sudo apt-get install automake
Will install aclocal
I recommend compiling from script, it will update to the latest version
#!/bin/bash
VERSION=1.15
wget ftp://ftp.gnu.org/gnu/automake/automake-${VERSION}.tar.gz &> /dev/null
if [ -f "automake-${VERSION}.tar.gz" ]; then
tar -xzf automake-${VERSION}.tar.gz
cd automake-${VERSION}/
./configure
make && make install
echo -e "\e[1;39m[ \e[1;32mOK\e[39m ] automake-${VERSION} installed\e[0;39m"
else
echo -e "\e[1;39m[ \e[31mError\e[39m ] cannot fetch file from ftp://ftp.gnu.org/gnu/automake/ \e[0;39m"
exit 1
fi

make not found with Dockerfile and centos:7 image

I have a very basic Dockerfile which uses FROM centos:7, then downloads Python-2.7.9.tar.xz, and attempts to ./configure && make && make altinstall.
I get the following error upon make:
creating Makefile
/bin/sh: make: command not found
The command '/bin/sh -c cd /root/Python-2.7.9 && ./configure -- prefix=/usr/local && make && make altinstall' returned a non-zero code: 127
I've installing the following libs prior to running make
yum install -y zlib-dev openssl-devel sqlite-devel bzip2-devel xz-libs gcc g++ build-essential kernel-headers kernel-devel
Yet error still persists. How can I resolve this?
A simple RUN yum -y install make solved the problem

clang 3.4 C++14 support

I am using travis.ci to do automated test builds of my git repositories.
For linux they use: Ubuntu 12.04
With clang 3.4
According to the clang page all C++ 14 language features are supported by Clang 3.4 (as long as you use the -std=c++1y flag).
So far so good:
I also need to use std::index_sequence<t0,...,tn> which is library feature N3658 not a language feature. But I can not find any specific documentation on updating the C++ standard library for clang to make sure this feature is supported (it is not supported out of the box).
TestCode:
#include <utility>
int main() {
std::index_sequence<1,2,3,4> seq;
}
TestBuild:
> clang++ -std=c++1y pl.cpp
pl.cpp:3:10: error: no member named 'index_sequence' in namespace 'std'
std::index_sequence<1,2,3,4> seq;
~~~~~^
pl.cpp:3:37: error: use of undeclared identifier 'seq'
std::index_sequence<1,2,3,4> seq;
^
2 errors generated.
Update:
Based on the suggestion below I tried to use libc++.
Pretty sure I did something wrong but I have never tried to use an alternative standard library so am not sure what is going wrong here. Will digg in tonight. But if you have a suggestion then please leave a comment.
> sudo apt-get install -qq libc++1 libc6 libc++-dev
> clang++ -stdlib=libc++ pl.cpp
pl.cpp:1:10: fatal error: 'utility' file not found
#include <utility>
^
1 error generated.
Well the answer seems to be to install g++-4.9
This will update the standard libraries already installed to a point where clang will be able to compile the code.
sudo apt-get install python-software-properties
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install g++-4.9
## Because I also use llvm-cov from my makefile
## I have to make sure it is in the path.
a=$(sudo find / -name llvm-cov | head -1)
sudo ln -s ${a} /usr/bin/llvm-cov
So this is what I added to travis.yml file
before_install:
- if [ "$TRAVIS_OS_NAME" == "linux" -a "$CXX" == "clang++" ]; then sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test;fi
- if [ "$TRAVIS_OS_NAME" == "linux" -a "$CXX" == "clang++" ]; then sudo apt-get update;fi
- if [ "$TRAVIS_OS_NAME" == "linux" -a "$CXX" == "clang++" ]; then sudo apt-get install g++-4.9;fi
- if [ "$TRAVIS_OS_NAME" == "linux" -a "$CXX" == "clang++" ]; then a=$(sudo find / -name llvm-cov | head -1);sudo ln -s ${a} /usr/bin/llvm-cov;fi
After I consolidate my g++ and clang++ pre-build code:
before_install:
- if [ "$TRAVIS_OS_NAME" == "linux"]; then sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y;fi
- if [ "$TRAVIS_OS_NAME" == "linux"]; then sudo apt-get update;fi
- if [ "$TRAVIS_OS_NAME" == "linux"]; then sudo apt-get install -qq g++-4.9;fi
- if [ "$TRAVIS_OS_NAME" == "linux" -a "$CXX" == "g++" ]; then sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 90;fi
- if [ "$TRAVIS_OS_NAME" == "linux" -a "$CXX" == "g++" ]; then sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 90;fi
- if [ "$TRAVIS_OS_NAME" == "linux" -a "$CXX" == "g++" ]; then sudo update-alternatives --install /usr/bin/gcov gcov /usr/bin/gcov-4.9 90;fi
- if [ "$TRAVIS_OS_NAME" == "linux" -a "$CXX" == "clang++" ]; then a=$(sudo find / -name llvm-cov | head -1);sudo ln -s ${a} /usr/bin/llvm-cov;fi
According to https://gcc.gnu.org/onlinedocs/libstdc++/manual/status.html, libstdc++ supports this at least given the most recent version. Ubuntu 12.04 contains GCC 4.4, where this is obviously not supported. precise-backports does not contain a newer version of libstdc++.
However, via https://launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/test, newer versions of GCC and with it, libstdc++, can be obtained. I don't know whether Travis supports installing from other repositories, or not, though.