Doxygen - Could NOT find FLEX (missing: FLEX_EXECUTABLE) - cmake

I know there are very similar worded questions on here, but I could not find an answer to my question there, so here we go:
I'm trying to see which of my C++ methods are called by others so I found Doxygen after googling.
On their page the installation seems pretty straightforward:
If you have the necessary build tools installed (i.e. g++, python,
cmake, flex, bison), you should do the following to get the initial
copy of the repository:
git clone https://github.com/doxygen/doxygen.git
cd doxygen
mkdir build
cd build
cmake -G "Unix Makefiles" ..
make
Until cmake -G "Unix Makefiles" .. everything goes well, then on that command following error occurs:
test#test-VirtualBox:~/doxygen/build$ cmake -G "Unix Makefiles" ..
CMake Error at /usr/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
Could NOT find FLEX (missing: FLEX_EXECUTABLE)
Call Stack (most recent call first):
/usr/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:388 (_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake-3.5/Modules/FindFLEX.cmake:230 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeLists.txt:84 (find_package)
I thought: No big deal, why should anything work out of the box...seems I have to install flex.
So I do:
sudo apt-get update
sudo apt-get install flex
sudo apt autoremove (because after installation the command line recommended me to do this)
Now it seems to me that flex has been installed, I try cmake -G "Unix Makefiles" .. again...same error. I close the command line, start it up again, try it again - same error...
So now I'm slowly gettin' pissed and turn to Stack Overflow for help :D
What am I doing wrong???
And because I saw someone asking this in the other question's comment, here's the output of flex:
test#test-VirtualBox:~/doxygen/build$ flex
The program 'flex' can be found in the following packages:
* flex
* flex-old
Try: sudo apt install <selected package>

It seems like apt autoremove really removed the package I just installed in the previous step.
So what worked for me was:
git clone https://github.com/doxygen/doxygen.git
cd doxygen
mkdir build
cd build
These are new:
sudo apt-get install flex
sudo apt-get install bison
cmake -G "Unix Makefiles" ..
make
...but of course the horror wouldn't end there, see my next question :D

Related

install problem: Cmake error : include could not find load file: yarpl-exports.cmake

I'm trying to install fbthrift for fb-python.
I followed the guides in
https://github.com/facebook/fbthrift and installed the dependencies needed.
but I got this error when running
cmake ..
in cmd:
-- Found folly: /usr/local
CMake Error at /home/xian/rsocket-cpp/build/yarpl/yarpl-config.cmake:31 (include):
include could not find load file:
/home/xian/lib/cmake/yarpl/yarpl-exports.cmake
Call Stack (most recent call first):
CMakeLists.txt:107 (find_package)
-- Found YARPL: /home/xian
-- Could NOT find rsocket (missing: rsocket_DIR)
-- Found fizz: /usr/local
CMake Error at CMakeLists.txt:110 (find_package):
Could not find a package configuration file provided by "fmt" with any of
the following names:
fmtConfig.cmake
fmt-config.cmake
Add the installation prefix of "fmt" to CMAKE_PREFIX_PATH or set "fmt_DIR"
to a directory containing one of the above files. If "fmt" provides a
separate development package or SDK, be sure it has been installed.
-- Configuring incomplete, errors occurred!
I tried to build the path doing:
sudo cmake .. -DCMAKE_PREFIX_PATH=/home/xian/rsocket-cpp/build/yarpl/CMakeFiles/Export/lib/cmake
but it doesn't work.
yarpl-exports.cmake is in
/home/xian/rsocket-cpp/build/yarpl/CMakeFiles/Export/lib/cmake/yarpl
and I'm pretty sure I have installed rsocket-cpp.
what should I do?
You have to install libfmt-dev package ...
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.1 LTS
Release: 22.04
Codename: jammy
$ sudo apt-get install libfmt-dev
$ cmake .
-- Configuring done
Try
git clone https://github.com/fmtlib/fmt.git
cd fmt
cmake CMakeLists.txt
make
sudo make install

Cmake can't find CMAKE_ROOT

Cmake throws an error
CMake Error: Could not find CMAKE_ROOT !!!
CMake has most likely not been installed correctly.
Modules directory not found in
CMake Error: Error executing cmake::LoadCache(). Aborting.`
Tried everything I could find out there to fix (Creating environment variable to path of installation, reinstalling, installing from source code) but none of these worked, I also tried running it on bash (I usually use zsh) but still no results
I had to re-install my cmake to correct this same error.
sudo apt-get remove cmake cmake-data
sudo -E add-apt-repository -y ppa:george-edison55/cmake-3.x
sudo -E apt-get update
sudo apt-get install cmake
Try the following command:
hash -r
It is ok under Ubuntu.

CMake not finding CMakeLists.txt

I am trying to install ants in Ubuntu 18 which requires a CMake step.
So far I have taken the following steps:
apt-get install ants
cd /tmp
git clone https://github.com/stnava/ANTs.git
mkdir /opt/ants
cd /opt/ants
cmake -c -g /tmp/ANTS
I keep getting the following error:
CMake Error: The source directory "/tmp/ANTS" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.
You apparently have a typo in the path (S should be lower case), try this:
cmake -c -g /tmp/ANTs

Running CMake on Amazon Linux

I am trying to build OpenJpeg on an AWS Amazon Linux EC2 instance. I installed cmake and gcc and had no issues during installation. When I try to cmake openjpeg I get the following error:
-- Check if the system is big endian
-- Searching 16 bit integer
CMake Error at /usr/share/cmake/Modules/TestBigEndian.cmake:44 (message):
no suitable type found
Call Stack (most recent call first):
CMakeLists.txt:164 (TEST_BIG_ENDIAN)
-- Configuring incomplete, errors occurred!
Checking the error logs it seems CMake is unable to determine the size of integers, shorts and longs. The full error log can be found in this gist
How can I work this out and make CMake work?
Amazon has a guide: Preparing to Compile Software, which proposes the following command to install a C compiler.
sudo yum groupinstall "Development Tools"
Next, you can download and build Cmake yourself: Install Cmake 3.
wget https://cmake.org/files/v3.18/cmake-3.18.0.tar.gz
tar -xvzf cmake-3.18.0.tar.gz
cd cmake-3.18.0
./bootstrap
make
sudo make install
Note: the last make actually needs sudo.
This works in the most recent Amazon Linux image (Nov 2021):
# Install sudo, wget and openssl, which is required for building CMake
yum install sudo wget openssl-devel -y
# Install development tools
sudo yum groupinstall "Development Tools" -y
# Download, build and install cmake
wget https://cmake.org/files/v3.18/cmake-3.18.0.tar.gz
tar -xvzf cmake-3.18.0.tar.gz
cd cmake-3.18.0
./bootstrap
make
sudo make install
Though this does not actually answer why the error was happening but I was able to build OpenJpeg by building CMake from source. So I just removed Cmake which was installed via yum and I believe was 2.8.12. Downloaded the latest CMake3 sources (v 3.10) built Cmake and openjpeg and all my other packages with no issues.
You could try to set up a Docker container to replicate correct environment. This way, you could form a container on your local machine, make sure it all builds on the container environment, and later use this environment on the EC2.
There is a project on Github that provides a Docker image which can be used to compile for Lambda and test stuff locally. Have a look: https://github.com/lambci/docker-lambda

Why is Travis not recognising installed CMake in script?

I'm trying to put together a Travis CI script for my application, which requires CMake 3.5 or greater. The entire Travis script can be found here. Following advice I found elsewhere, I use the following to install CMake:
install:
- DEPS_DIR="${TRAVIS_BUILD_DIR}/deps"
- mkdir -p ${DEPS_DIR} && cd ${DEPS_DIR}
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
CMAKE_URL="https://cmake.org/files/v3.7/cmake-3.7.2-Linux-x86_64.tar.gz";
mkdir cmake && travis_retry wget --no-check-certificate --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C cmake;
export PATH=${DEPS_DIR}/cmake/bin:${PATH};
else
brew outdated cmake || brew upgrade cmake;
fi
- cmake --version
Then I fill out the build matrix with various OS/compiler combinations, and finally I run a Python installation script (see here):
before_script:
- cd "${TRAVIS_BUILD_DIR}"
script:
- ./install.py --compiler=$COMPILER
The Python script essentially just calls cmake and make, the first CMakeLists.txt can be found here.
The OSX builds which install CMake using Homebrew works perfectly. However, all of the Linux builds fail at the script stage due to CMake not meeting the minimum requirement:
CMake Error at CMakeLists.txt:1 (cmake_minimum_required):
CMake 3.5 or higher is required. You are running version 3.2.2
Even though CMake 3.7 was successfully installed during install:
$ cmake --version
cmake version 3.7.2
What am I doing wrong?
This is strange, the preinstalled version of CMake (= v3.2 on Travis) is used instead of the newer one – but only when called from Python.
You can try these:
Solution 1: Remove the CMake shipped by Travis
This will prevent the usage of the older version. If this doesn't work (eg. maybe because "Cmake isn't found"), this will show the actual reason of the problem.
You can add this to your linux branch of the install step:
sudo apt-get purge cmake
Or:
sudo apt-get remove cmake
(Possible you need to add -y for confirmation, so it becomes remove -y).
Solution 2: Use the CMake installer
Installation through the CMake Installer is a much cleaner way. It turned out the be the faster one on Travis btw.
...
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
CMAKE_INSTALLER=install-cmake.sh
curl -sSL https://cmake.org/files/v3.7/cmake-3.7.2-Linux-x86_64.sh -o ${CMAKE_INSTALLER}
chmod +x ${CMAKE_INSTALLER}
sudo ./${CMAKE_INSTALLER} --prefix=/usr/local --skip-license
else
...
I'm using curl instead of wget + travis_retry, but this doesn't matter. You can still use them as before.
If both don't work, you should check where the Python script looks for executables.