Compile OpenCV 2.4.2 for Debian Lenny - unix

To keep the Q&A aspect:
I got a strange problem with the latest (v.2.4.2) OpenCV version, which failed to install with the following error:
In file included from /OpenCV-2.4.2/modules/core/src/system.cpp:460:
/OpenCV-2.4.2/release/modules/core/version_string.inc:37:1:
warning: missing terminating " character In file included from
/OpenCV-2.4.2/modules/core/src/system.cpp:460:
/OpenCV-2.4.2/release/modules/core/version_string.inc:37: error:
missing terminating " character
So what went wrong? Take a look at my answer.

As mentioned in this bug report the problem is an old version (2.8.2) of cmake. So the solution was to grab a fresh copy of the cmake source, compile it and use it to install OpenCV.
Note 18/09/2012: This also works on Ubuntu 12.04 with cmake 2.8.9!
# get the cmake src
wget http://www.cmake.org/files/v2.8/cmake-2.8.8.tar.gz
# extract archive
tar xfvz cmake-2.8.8.tar.gz
# build the new version
cd cmake-2.8.8
cmake .
make
sudo make install
# get the OpenCV src
wget -O OpenCV-2.4.2.tar.bz2 http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.4.2/OpenCV-2.4.2.tar.bz2/download
# extract it …
tar -xvf OpenCV-2.4.2.tar.bz2
# build it
mkdir build
cd build
/usr/local/bin/cmake -D CMAKE_BUILD_TYPE=RELEASE ..
make
sudo make install
# setup OpenCV
sudo echo “/usr/local/lib” >> /etc/ld.so.conf
sudo ldconfig
That's it.

Unfortunately newer cmake depends on newer cmake than the outdated cmake 2.6-patch 0 in lenny. To compile cmake 2.8.8 as mentioned above, first you have to compile CMake 2.6.3 or above which builds with lenny outdated cmake 2.6-patch 0.

Related

Can't build project on Ubuntu using QT6.4 and CMake

I installed a fresh new copy of QTCreator on a Ubuntu VM. It is a clean virtual machine. Then I create a dummy QTQuick project with almost nothing in it. But creator fails to compile, saying CMAKE_CXX_COMPILER not found. See message below:
error: No CMAKE_CXX_COMPILER could be found. 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.
Am I missing the compiler? This is a fresh install and I don't understand. Creator is showing the only compiler option. See the screen shot below:
Any ideas why it does not compile from a clean install, using all default option? The compiler must be there.
thank you.
I followed these instructions and it worked finally.
sudo apt-get update && sudo apt-get upgrade
sudo apt-get -y install build-essential openssl libssl-dev libssl1.0 libgl1-mesa-dev libqt5x11extras5
downloaded the install and made it executable
chmod +x qt*.run
then it worked.
Here is the page with more explanations:
https://web.stanford.edu/dept/cs_edu/resources/qt/install-linux

Build project in Qt Creator using CMake from snap

Ubuntu 20.04
I just want to use default snap and apt versions
Qt Creator 4.11.0 from apt:
sudo apt install qtcreator qt5-default
CMake 3.24.0 from snap:
sudo snap install cmake --classic
If I open the project, it gives an error:
Running /usr/bin/snap /home/fresh/Downloads/test -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_CXX_COMPILER:STRING=/usr/bin/g++ -DCMAKE_C_COMPILER:STRING=/usr/bin/gcc -DCMAKE_PREFIX_PATH:STRING=/usr -DQT_QMAKE_EXECUTABLE:STRING=/usr/bin/qmake in /tmp/QtCreator-BsxNPO/qtc-cmake-BcKQdVpk.
error: unknown command "/home/fresh/Downloads/test", see 'snap help'.
CMake process exited with exit code 64.
Any change to make it work properly without building CMake from source or installing newer version of Qt Creator?
Solution:
sudo ln -s /snap/cmake/current/bin/cmake /usr/bin/cmake
sudo ln -s /snap/cmake/current/bin/ccmake /usr/bin/ccmake
sudo ln -s /snap/cmake/current/bin/cpack /usr/bin/cpack
In Qt go to Tools > Options > Kits > CMake in Manual set Path:
/usr/bin/cmake
Go back to Kits tab, in CMake Tool choose added new CMake
Relaunch Qt. It works

CMake cannot find Qt5LinguistTools in Docker / Ubuntu 18.04

My simple Dockerfile:
FROM ubuntu:18.04
RUN apt update && apt upgrade -y
RUN apt install build-essential cmake qt5-default -y
RUN apt install qttools5-dev-tools -y
When I check linguist inside the container it's there:
root#9087245330a7:/# which linguist
/usr/bin/linguist
...but when I configure my app inside the container:
CMake Error at CMakeLists.txt:72 (find_package):
By not providing "FindQt5LinguistTools.cmake" in CMAKE_MODULE_PATH this
project has asked CMake to find a package configuration file provided by
"Qt5LinguistTools", but CMake did not find one.
Could not find a package configuration file provided by "Qt5LinguistTools"
(requested version 5.5.1) with any of the following names:
Qt5LinguistToolsConfig.cmake
qt5linguisttools-config.cmake
Add the installation prefix of "Qt5LinguistTools" to CMAKE_PREFIX_PATH or
set "Qt5LinguistTools_DIR" to a directory containing one of the above
files. If "Qt5LinguistTools" provides a separate development package or
SDK, be sure it has been installed.
What is going on? This works on Ubuntu 16.04 just fine.
The problem was that in Ubuntu 18.04+ you need to install also qttools5-dev in order to get /usr/lib/x86_64-linux-gnu/cmake/Qt5LinguistTools/Qt5LinguistToolsConfig.cmake.

Project ERROR: Unknown module(s) in QT: multimedia

I am trying to compile qGo, after installing qt5
git clone https://github.com/pzorin/qgo.git
cd qgo
qmake
make
sudo make install
Right now the latest error is saying it can't find multimedia
# make
cd src/ && ( test -e Makefile || /usr/lib/x86_64-linux-gnu/qt5/bin/qmake /home/jdm/Downloads/qgo/src/src.pro -o Makefile ) && make -f Makefile
Project ERROR: Unknown module(s) in QT: multimedia
make: *** [sub-src-make_first] Error 3
I guessed the library libqt5multimedia5 based on this question, but the computer it says its already there and the error persists.
libqt5multimedia5 is already the newest version.
There is another similar question but the user answered his own question. I am not sure how it applies here:
"Project ERROR: Unknown module(s) in QT: multimedia" when building my project with fresh static Qt5.3.0
I'm not able to post a comment, so I will write it as an answer. Your problem has been solved here:
https://forum.qt.io/topic/27608/unknown-module-multimedia/6
In order to handle the issue you should try installing packages that are absent:
sudo apt-get install qtmultimedia5-dev libqt5multimediawidgets5 libqt5multimedia5-plugins libqt5multimedia5
and restart your Qt Creator after that.
Cheers.
UPDATE. If it will not work, try another solution:
sudo apt-get update
sudo apt-get build-dep qtmultimedia5-dev
sudo apt-get source --compile qtmultimedia5-dev
UPDATE 2 For me the solution was the following:
Download sources from http://download.qt.io/development_releases/qt/5.4/5.4.0-rc/submodules/
Build them, add the library manually.

Undefined reference to QIconvCodec during Qt embedded make?

I'm trying to configure my Qt for Embedded Linux with a virtual framebuffer according to these instructions. From the Qt for Embedded source folder, I'm trying:
./configure -embedded -opensource -confirm-license -verbose -qvfb
make
I get the following error which prevents me from doing make install:
.obj/release-shared-emb-x86/qtextcodec.o: In function `setup()':
qtextcodec.cpp:(.text+0x23cc): undefined reference to `QIconvCodec::QIconvCodec()'
collect2: ld returned 1 exit status
make[1]: *** [../../lib/libQtCore.so.4.8.4] Error 1
make[1]: Leaving directory `/home/cstjean/qt/src/corelib'
make: *** [sub-corelib-all-ordered] Error 2
If I do:
./configure -embedded -opensource -confirm-license -verbose -qvfb
make -no-iconv
sudo make install -no-iconv
...This works. But when I go into QtCreator, Tools > Options > Build & Run > Qt Versions, I try to select qmake for Qt Embedded (for me it's in /home/cstjean/qt/bin/qmake) and it tells me:
Qt version is not properly installed, please run make install
I've tried googling this like crazy. There are a lot of suggestions to download various libraries, which I've tried to no avail, but perhaps I'm missing something because this is a pretty fresh installation of Ubuntu I'm using.
Thanks.
I solved this problem by installing Gnome and starting over from scratch for my Qt Embedded for Linux installation.
I googled gnome for ubuntu 12.04 and found these instructions. You'll have to see which version of Ubuntu you have and search for that of course. You can see which version you have by typing into a command line:
lsb_release -a
Once I had gnome installed, I restarted my computer and signed in using Gnome.
Then I completely uninstalled and removed all traces of Qt Embedded:
cd yourQtEmbeddedDir
sudo make uninstall
cd ..
rm -r yourQtEmbeddedDir sourceFileTarYouHadDownloaded.tar.gz
I redownloaded the source file tar for Qt Embedded for Linux (from here) and proceeded to install according to these instructions after extracting the source files from the tar:
./configure -embedded -opensource -confirm-license -verbose -qvfb
make
sudo make install
Now, if you tell QtCreator about qmake from this installation, then QtCreator will no longer complain about a bad installation! Ta da!
Note: If you're attempting to the do the Virtual Framebuffer business too, then this is not the end of the road. You need to have Qt for X11 installed as well in order to compile qvfb.
Long story short: You need Gnome if you're trying to install Qt Embedded for Linux with a Virtual Framebuffer on Ubuntu!

Resources