Error in Cmake "The CUDA compiler identification is unknown" while creating the docker build - dockerfile

I am trying to create a docker build in Xavier. When I run my piece of code without docker it works smooth and I got The CUDA compiler identification. But when I am trying to make a build with dockerfile it gave me an error of CUDA compiler identification is unknown.
Below is my dockerfile steps:
FROM nvcr.io/nvidia/l4t-base:r32.3.1
RUN apt-get update && apt-get install -y --no-install-recommends make g++ && apt-get install -y cmake gcc libopenblas-dev build-essential
WORKDIR /home/username/docker_fc/tensorrt_l2norm_helper
CMD ["python3", "./step01_pb_to_uff.py"]
COPY . /home/username/docker_fc/
RUN cmake --version
RUN nvcc --version
RUN mkdir build && cd build && pwd && cmake .. && make
I got error in the last step with cmake.
my mvcc version is release 10.0, V10.0.326.
my cmake version is 3.10.2
Can anyone tell me what is missing in Dockerfile?

The base image of l4t does not load the runtime components of nvidia by default. They only have the stubs. If you want to do this, you will need to enable the default-runtime nvidia in the /etc/docker/daemon.json file. This will load all the runtime components such as nvcc.
{
"default-runtime": "nvidia",
"runtimes": {
"nvidia": {
"path": "/usr/bin/nvidia-container-runtime",
"runtimeArgs": []
}
},
}
Just take note that if you do this, the size of your built docker will be larger

Related

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

Could NOT find Protobuf (missing: Protobuf_PROTOC_EXECUTABLE)

When I am doing a cmake in the build directory of the project I am getting this error. Initially I got a
protobuf-config.cmake not found
error. So I gave a path of the protobuf-config.cmake file to Protobuf_DIR. Later it started to show this new error:
CMake Error at
/opt/cmake/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:137
(message): Could NOT find Protobuf (missing:
Protobuf_PROTOC_EXECUTABLE)
(found suitable version "3.6.1", minimum required is "3.0.0")
I am also attaching the error log file:
https://drive.google.com/open?id=1y7BZ6lDBtxvla7r-o188xM_FjwLqwhCx
I am doing this on Ubuntu-18 with cmake version: 3.13 and protobuf version: 3.6.1
You probably don't have the Protobuf compiler and development files installed. To fix that, run this command:
sudo apt-get install protobuf-compiler libprotobuf-dev
Alternatively, if you're building Protobuf by hand, you can't build it with the build type as RelWithDebInfo because that causes issues with the library and CMake.
Installed from apt on Ubuntu 20.04, dont have permissions to /usr/include/google
To fix: sudo chmod +Xr -R /usr/include/google
Default repositories usually contain outdated protobuf version. It is best to install it manually, from sources:
git clone --progress -b v3.10.0 https://github.com/protocolbuffers/protobuf && \
( \
cd protobuf; \
mkdir build; \
cd build; \
cmake ../cmake \
-DCMAKE_BUILD_TYPE=Release \
-Dprotobuf_BUILD_SHARED_LIBS=ON \
-Dprotobuf_BUILD_TESTS=OFF; \
make -j4 install; \
) && \
rm -rf protobuf
Quickly adding here that after installing Protobuf following this answer, I had to delete the build folder in my workspace to get cmake to run without this error :)
Hy,
list your protobuf libraries with sudo apt list | grep protobuf it should tell you what it will install by default. Run protoc --version so that you see what is recognized by default now. And after that get a version from github if needed build it and install it (this should not take to long). Then run protoc --version again.

What are the steps to build LLVM from source for Ubuntu Bionic Beaver?

Not all Kaleidoscope examples compile. Some do.
In the build process of LLVM Cmake complains "- Failed to find LLVM FileCheck"
My interest is in developing a toy compiler using LLVM - on a Ubuntu Bionic Beaver laptop, 64 bit. Therefore I needed to compile LLVM from source. The documentation says Cmake, gcc/g++, clang and zlib are required for the build. Yes, that is true. I found out the hard way this list is incomplete.
sudo apt update
sudo apt upgrade
sudo apt install -y cmake gcc g++ python build-essential opam ocaml
sudo apt install -y checkinstall python-pygments python-yaml llvm
opam init /* and say yes to creating a profile
opam config env
opam install ctypes ctypes-foreign
opam depext conf-llvm.6.0.0 /* and said Y to install
opam depext conf-m4.1 /* and said Y to install
opam depext conf-pkg-config.1.1 /* and said Y to install
sudo apt install libxml2-dev libplist-dev
sudo apt install llvm-7-tools
/*the z3 package is outdated, need to build from source:
mkdir z3 /*somewhere
git clone https://github.com/Z3Prover/z3
python scripts/mk_make.py
cd build
make
sudo checkinstall /* y and enter
cd <to sourceroot of llvm>
git clone https://github.com/llvm/llvm-project.git
cd llvm-project
mkdir build; cd build
cmake -DLLVM_TARGETS_TO_BUILD="X86" -DCMAKE_BUILD_TYPE=Release ../llvm
make -j2
Kaleidoscope examples from Chapters 3 and 8 compile fine. The output from the toy compiler resulting from Chapter 8 even does compile and link to a working program. The examples from the Chapters 2, 4, 5, 6, 7 and 9 don't compile.
You also need googletest as a shared library with current source code (27-04-2019) for it to compile. It is not stated as a requirement which was very frustrating when I had errors building llvm, clang, lld and clang extra tools.
Best place for the current code is: github.com/google/googletest
The best answer for how to build googletest is here

Dlib installation python 2.7

Former marine grunt here! New to python and coding. Trying to install DLIB for python 2.7. I run the command pip install dlib and keep getting this error message:
Collecting dlib
Using cached dlib-19.1.0.tar.gz
Building wheels for collected packages: dlib
Running setup.py bdist_wheel for dlib ... error
Complete output from command c:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\pickfl~1\\appdata\\local\\temp\\pip-build-4qhao2\\dlib\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', \n');f.close();exec(compile(code, __file__, 'exec'))"
bdist_wheel -d c:\users\pickfl~1\appdata\local\temp\tmpcvgy9jpip-wheel- --python-tag cp27:
running bdist_wheel
running build
Detected Python architecture: 32bit
Detected platform: win32
Configuring cmake ...
-- Building for: NMake Makefiles
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error in CMakeLists.txt:
The CMAKE_C_COMPILER:
cl
is not a full path and was not found in the PATH.
To use the NMake generator with Visual C++, cmake must be run from a shell
that can use the compiler cl from the command line. This environment is
unable to invoke the cl compiler. To fix this problem, run cmake from the
Visual Studio Command Prompt (vcvarsall.bat).
Tell CMake where to find the compiler by setting either the environment
variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
the compiler, or to the compiler name if it is in the PATH.
CMake Error in CMakeLists.txt:
The CMAKE_CXX_COMPILER:
cl
is not a full path and was not found in the PATH.
To use the NMake generator with Visual C++, cmake must be run from a shell
that can use the compiler cl from the command line. This environment is
unable to invoke the cl compiler. To fix this problem, run cmake from the
Visual Studio Command Prompt (vcvarsall.bat).
Tell CMake where to find the compiler by setting either the environment
variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
to the compiler, or to the compiler name if it is in the PATH.
-- Configuring incomplete, errors occurred!
See also "C:/Users/Pickflickr1/AppData/Local/Temp/pip-build-4qhao2/dlib/tools/python/build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/Pickflickr1/AppData/Local/Temp/pip-build-4qhao2/dlib/tools/python/build/CMakeFiles/CMakeError.log".
error: cmake configuration failed!
---------------------------------------- Failed building wheel for dlib
Along with this:
Command "c:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\pickfl~1\\appdata\\local\\temp\\pip-build-4qhao2\\dlib\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install
--record c:\users\pickfl~1\appdata\local\temp\pip-l8pcsq-record\install-record.txt
--single-version-externally-managed --compile" failed with error code 1 in c:\users\pickfl~1\appdata\local\temp\pip-build-4qhao2\dlib\
Any feedback or help would be great! Former jarhead so bear with me, thanks.
Try this:
conda install -c menpo dlib=18.18
First Install all the dependencies for dlib library :->
sudo apt-get install python-dev python-pip
sudo apt-get install build-essential cmake pkg-config
sudo apt-get install libx11-dev libatlas-base-dev
sudo apt-get install libgtk-3-dev libboost-python-dev
Then Execute
pip install dlib
Enjoy computer-vision.....
“A lot of the future of search is going to be about pictures. Computer vision technology is going to be a big deal”
Ben Silbermann
First you need to have pip installed. Then you can download the dlib python 2.7 version from "https://pypi.python.org/pypi/dlib/18.17.100" website where you will get wheel of dlib. And then use normal procedure like pip install 'path to dlib wheel'.
For ex. f you have saved .whl file to downloads folder then type pip install C:\Users\XYZ\Downloads\dlib-18.17.100-cp27-none-win32.whl.
This will surely work. When I tried I didn't get any error and dlib got successfully installed.
Cheers
The pip package might be broken or might not be updated. Anyway, download the dlib_master from :https://github.com/davisking/dlib.git
After that there is an easy guide for installation in python. Go to the folder containing setup.py and then open terminal or whatever and type
sudo python setup.py install.

How to recover default boost installation on ubuntu?

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.