lpereira / hardinfo

System profiler and benchmark tool for Linux systems
http://hardinfo.org
GNU General Public License v2.0
770 stars 130 forks source link

CMake Error: install TARGETS given no RUNTIME DESTINATION for executable target "hardinfo" #617

Open LapinFou opened 3 years ago

LapinFou commented 3 years ago

Hi Folks,

I'm trying to build hardinfofor RedHat 7. Here are the commands I used on one of our compute server:

yum install glib-devel gtk+-devel zlib-devel libsoup-devel json-glib-devel
git clone https://github.com/lpereira/hardinfo.git
cd hardinfo
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=/cad/tools/hardinfo -DCMAKE_BUILD_TYPE=Release

Unfortunately, I got the following errors:

[cad@compute01 build]$ cmake .. -DCMAKE_INSTALL_PREFIX=/cad/tools/hardinfo -DCMAKE_BUILD_TYPE=Release
-- The C compiler identification is GNU 4.8.5
-- The CXX compiler identification is GNU 4.8.5
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
CMake Error: Error in cmake code at
/home/cad/tmp/hardinfo/cmake/GNUInstallDirs.cmake:6:
Parse error.  Expected "(", got newline with text "
".
CMake Error at CMakeLists.txt:11 (include):
  include could not find load file:

    /home/cad/tmp/hardinfo/cmake/GNUInstallDirs.cmake

-- LOCALEDIR = 
-- Building HardInfo for architecture: linux-x86
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.27.1") 
-- Building for GTK2
-- checking for modules 'gtk+-2.0>=2.10;glib-2.0>=2.10;gthread-2.0>=2.10;gmodule-export-2.0>=2.10'
--   found gtk+-2.0, version 2.24.31
--   found glib-2.0, version 2.56.1
--   found gthread-2.0, version 2.56.1
--   found gmodule-export-2.0, version 2.56.1
-- checking for module 'libsoup-2.4>=2.42'
--   found libsoup-2.4, version 2.62.2
-- checking for module 'json-glib-1.0'
--   found json-glib-1.0, version 1.4.2
-- checking for module 'x11'
--   found x11, version 1.6.7
-- Found ZLIB: /usr/lib64/libz.so (found version "1.2.7") 
CMake Error at CMakeLists.txt:371 (install):
  install TARGETS given no RUNTIME DESTINATION for executable target
  "hardinfo".

-- Configuring incomplete, errors occurred!
See also "/home/cad/tmp/hardinfo/build/CMakeFiles/CMakeOutput.log".

Off course the cmake .. command without any arguments gives the same result and the file /home/cad/tmp/hardinfo/cmake/GNUInstallDirs.cmake does exist.

I tried few things, however I'm not a dev, thus I'm short of ideas. Any help would be very very welcome. 😊

Here are the details of our Linux server:

[cad@compute01 build]$ lsb_release -a
LSB Version:    :core-4.1-amd64:core-4.1-ia32:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-ia32:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-ia32:desktop-4.1-noarch:languages-4.1-amd64:languages-4.1-ia32:languages-4.1-noarch:printing-4.1-amd64:printing-4.1-ia32:printing-4.1-noarch
Distributor ID: RedHatEnterpriseServer
Description:    Red Hat Enterprise Linux Server release 7.9 (Maipo)
Release:    7.9
Codename:   Maipo

Seb

lpereira commented 3 years ago

What's the CMake version you're using? It's very likely it's too old and incompatible with the current GNUInstallDirs.cmake we're shipping.

LapinFou commented 3 years ago

@lpereira First of all, thanks a lot for helping me. 👍 I think it is cmake version 2.8.12. I well check tomorrow morning when I will be back at the office. What would be the minimum required version? Maybe , I can install and use cmake3 from the EPEL repo instead `cmake?

LapinFou commented 3 years ago

@lpereira Indeed, it was an issue with cmake being too old (version 2.8.12.2). It is unbelievable that CentOS7/RHEL7 are packed with this "jurassic" version.... 😖

To summarize, here is the procedure for CentOS7/RHEL7 system:

## Install EPEL
sudo yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
## Install cmake3 from EPEL repo
sudo yum install cmake3
## Install required source code:
sudo yum install glib-devel gtk+-devel zlib-devel libsoup-devel json-glib-devel
## Prepare the build folder:
git clone https://github.com/lpereira/hardinfo.git
cd hardinfo
mkdir build
cd build

## Compile and install hardinfo to a dedicated path:
cmake3 .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=[YOURCUSTOM_PATH]/hardinfo/[VERSION]
make
make install

## Compile and install hardinfo to the default path:
cmake3 ..  -DCMAKE_BUILD_TYPE=Release
make
sudo make install

Maybe this procedure could be added in your Wiki page?

Just a suggestion; maybe a cmake version check could be added in the makefile?

Gismo1337 commented 2 years ago

I ran into the same issue @ ubuntu 21.10 impish. cmake version 3.18.4 was checked. needed to run make install command as root. For beginners like me it is not a matter of course.

sudo make install instead of make install after this, Alt+F2 write hardinfo press enter

have fun