I'm confused about how find_library is supposed to work, and I don't know if this could be a CMake bug, or a misuse or misconfiguration on my part. I have installed both GCC and PGI compilers, and when I try this simple CMakeLists.txt file (with both 2.8.11 and 3.5.1):
cmake_minimum_required(VERSION 2.8.11)
find_library( LIBdl dl )
message("LIBdl ${LIBdl}")
I get the following:
$ CC=gcc CXX=g++ cmake .
-- The C compiler identification is GNU 4.8.4
-- The CXX compiler identification is GNU 4.8.4
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/g++
-- Check for working CXX compiler: /usr/bin/g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
LIBdl /usr/lib/x86_64-linux-gnu/libdl.so
-- Configuring done
-- Generating done
-- Build files have been written to: /home/molcas-test/test/cmake
That's OK, but:
$ CC=pgcc CXX=pgc++ cmake .
-- The C compiler identification is PGI 17.1.0
-- The CXX compiler identification is PGI 17.1.0
-- Check for working C compiler: /opt/pgi/linux86-64/17.1/bin/pgcc
-- Check for working C compiler: /opt/pgi/linux86-64/17.1/bin/pgcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /opt/pgi/linux86-64/17.1/bin/pgc++
-- Check for working CXX compiler: /opt/pgi/linux86-64/17.1/bin/pgc++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
LIBdl LIBdl-NOTFOUND
-- Configuring done
-- Generating done
-- Build files have been written to: /home/molcas-test/test/cmake
Note dl was not found.
Leaving out either pgcc or pgc++ causes the library to be found, so it must be something in how the compilers are configured. And yet just compiling from the command line finds dl without complain:
$ pgcc -ldl hello_world.c -o hello_world
$ ./hello_world
Hello world!
So I believe something's not right if pgcc can find the library and CMake can't. I could of course set LIB=/usr/lib/x86_64-linux-gnu before running cmake, to force a search in that directory, but that doesn't feel right.
It seems the problem is with gcc. I get /lib/x86_64-linux-gnu included in CMAKE_C_IMPLICIT_LINK_DIRECTORIES, so CMAKE_LIBRARY_ARCHITECTURE is set. But with pgcc this directory is absent and CMAKE_LIBRARY_ARCHITECTURE is empty.
And the directory is missing with pgcc, because pgcc -v doesn't include a -L/lib/x86_64-linux-gnu flag, while gcc -v does. However, ld finds libraries in the directory in either case.
So CMake is not searching libraries in the same places as ld. Should it? Is there an easy way to change this, other than, e.g., manually inspecting all files in /etc/ld.so.conf.d and setting the LIB environment variable?
Related
I'm trying to build CMake 3.15.5 on a 20.04 xubuntu machine (but I also tried 18.04 and 20.10 with the same results).
The error is as follows:
loading initial cache file /home/max/Lavori/nova/src/repos/dep-startup/buildroot-output/buildroot-2020.02.1/output/build/host-cmake-3.15.5/Bootstrap.cmk/InitialCacheFlags.cmake
-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 9.3.0
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/g++
-- Check for working CXX compiler: /usr/bin/g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Checking if compiler supports C11 _Thread_local
-- Checking if compiler supports C11 _Thread_local - yes
-- Checking if compiler supports needed C++17 constructs
-- Checking if compiler supports needed C++17 constructs - yes
-- Checking if compiler supports C++ make_unique
-- Checking if compiler supports C++ make_unique - no
-- Checking if compiler supports C++ unique_ptr
-- Checking if compiler supports C++ unique_ptr - no
CMake Error at CMakeLists.txt:92 (message):
The C++ compiler does not support C++11 (e.g. std::unique_ptr).
-- Configuring incomplete, errors occurred!
See also "/home/max/Lavori/nova/src/repos/dep-startup/buildroot-output/buildroot-2020.02.1/output/build/host-cmake-3.15.5/CMakeFiles/CMakeOutput.log".
See also "/home/max/Lavori/nova/src/repos/dep-startup/buildroot-output/buildroot-2020.02.1/output/build/host-cmake-3.15.5/CMakeFiles/CMakeError.log".
---------------------------------------------
Error when bootstrapping CMake:
Problem while running initial CMake
I am absolutely sure that g++ 9.3.0 supports C++11, so where could the problem be?
(EDIT: added CMakeError.log)
Here is the CMakeError.log file:
Determining if compiler supports C++ make_unique failed with the following output:
Change Dir: /home/max/Lavori/nova/srcs/repo/dep-startup/buildroot-output/buildroot-2020.02.1/output/build/host-cmake-3.15.5/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/make cmTC_f5a77/fast && make[2]: Entering directory '/home/max/Lavori/nova/srcs/repo/dep-startup/buildroot-output/buildroot-2020.02.1/output/build/host-cmake-3.15.5/CMakeFiles/CMakeTmp'
make[2]: Warning: File 'Makefile' has modification time 0,27 s in the future
make -f CMakeFiles/cmTC_f5a77.dir/build.make CMakeFiles/cmTC_f5a77.dir/build
make[3]: Entering directory '/home/max/Lavori/nova/srcs/repo/dep-startup/buildroot-output/buildroot-2020.02.1/output/build/host-cmake-3.15.5/CMakeFiles/CMakeTmp'
make[3]: Warning: File 'CMakeFiles/cmTC_f5a77.dir/flags.make' has modification time 0,26 s in the future
Building CXX object CMakeFiles/cmTC_f5a77.dir/cm_cxx_make_unique.cxx.o
/usr/bin/g++ -O2 -std=gnu++17 -o CMakeFiles/cmTC_f5a77.dir/cm_cxx_make_unique.cxx.o -c /home/max/Lavori/nova/srcs/repo/dep-startup/buildroot-output/buildroot-2020.02.1/output/build/host-cmake-3.15.5/Source/Checks/cm_cxx_make_unique.cxx
Linking CXX executable cmTC_f5a77
/home/max/Lavori/nova/srcs/repo/dep-startup/buildroot-output/buildroot-2020.02.1/output/build/host-cmake-3.15.5/Bootstrap.cmk/cmake -E cmake_link_script CMakeFiles/cmTC_f5a77.dir/link.txt --verbose=1
/usr/bin/g++ -O2 -L/home/max/Lavori/nova/srcs/repo/dep-startup/buildroot-output/buildroot-2020.02.1/output/host/lib -Wl,-rpath,/home/max/Lavori/nova/srcs/repo/dep-startup/buildroot-output/buildroot-2020.02.1/output/host/lib CMakeFiles/cmTC_f5a77.dir/cm_cxx_make_unique.cxx.o -o cmTC_f5a77
make[3]: warning: Clock skew detected. Your build may be incomplete.
make[3]: Leaving directory '/home/max/Lavori/nova/srcs/repo/dep-startup/buildroot-output/buildroot-2020.02.1/output/build/host-cmake-3.15.5/CMakeFiles/CMakeTmp'
make[2]: warning: Clock skew detected. Your build may be incomplete.
make[2]: Leaving directory '/home/max/Lavori/nova/srcs/repo/dep-startup/buildroot-output/buildroot-2020.02.1/output/build/host-cmake-3.15.5/CMakeFiles/CMakeTmp'
Determining if compiler supports C++ unique_ptr failed with the following output:
Change Dir: /home/max/Lavori/nova/srcs/repo/dep-startup/buildroot-output/buildroot-2020.02.1/output/build/host-cmake-3.15.5/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/make cmTC_02c6e/fast && make[2]: Entering directory '/home/max/Lavori/nova/srcs/repo/dep-startup/buildroot-output/buildroot-2020.02.1/output/build/host-cmake-3.15.5/CMakeFiles/CMakeTmp'
make[2]: Warning: File 'Makefile' has modification time 0,27 s in the future
make -f CMakeFiles/cmTC_02c6e.dir/build.make CMakeFiles/cmTC_02c6e.dir/build
make[3]: Entering directory '/home/max/Lavori/nova/srcs/repo/dep-startup/buildroot-output/buildroot-2020.02.1/output/build/host-cmake-3.15.5/CMakeFiles/CMakeTmp'
make[3]: Warning: File 'CMakeFiles/cmTC_02c6e.dir/flags.make' has modification time 0,26 s in the future
Building CXX object CMakeFiles/cmTC_02c6e.dir/cm_cxx_unique_ptr.cxx.o
/usr/bin/g++ -O2 -std=gnu++17 -o CMakeFiles/cmTC_02c6e.dir/cm_cxx_unique_ptr.cxx.o -c /home/max/Lavori/nova/srcs/repo/dep-startup/buildroot-output/buildroot-2020.02.1/output/build/host-cmake-3.15.5/Source/Checks/cm_cxx_unique_ptr.cxx
Linking CXX executable cmTC_02c6e
/home/max/Lavori/nova/srcs/repo/dep-startup/buildroot-output/buildroot-2020.02.1/output/build/host-cmake-3.15.5/Bootstrap.cmk/cmake -E cmake_link_script CMakeFiles/cmTC_02c6e.dir/link.txt --verbose=1
/usr/bin/g++ -O2 -L/home/max/Lavori/nova/srcs/repo/dep-startup/buildroot-output/buildroot-2020.02.1/output/host/lib -Wl,-rpath,/home/max/Lavori/nova/srcs/repo/dep-startup/buildroot-output/buildroot-2020.02.1/output/host/lib CMakeFiles/cmTC_02c6e.dir/cm_cxx_unique_ptr.cxx.o -o cmTC_02c6e
make[3]: warning: Clock skew detected. Your build may be incomplete.
make[3]: Leaving directory '/home/max/Lavori/nova/srcs/repo/dep-startup/buildroot-output/buildroot-2020.02.1/output/build/host-cmake-3.15.5/CMakeFiles/CMakeTmp'
make[2]: warning: Clock skew detected. Your build may be incomplete.
make[2]: Leaving directory '/home/max/Lavori/nova/srcs/repo/dep-startup/buildroot-output/buildroot-2020.02.1/output/build/host-cmake-3.15.5/CMakeFiles/CMakeTmp'
I cannot figure out wath is wrong.
I thought it could be a clock skew problem but I tried also outside a virtual machine with identical results.
I also tried to compile and link by hand without any errors or warnings.
/usr/bin/g++ -O2 -std=gnu++17 -o cm_cxx_make_unique.cxx.o -c /home/max/Lavori/nova/srcs/repo/dep-startup/buildroot-output/buildroot-2020.02.1/output/build/host-cmake-3.15.5/Source/Checks/cm_cxx_make_unique.cxx
/usr/bin/g++ -O2 -L/home/max/Lavori/nova/srcs/repo/dep-startup/buildroot-output/buildroot-2020.02.1/output/host/lib -Wl,-rpath,/home/max/Lavori/nova/srcs/repo/dep-startup/buildroot-output/buildroot-2020.02.1/output/host/lib cm_cxx_make_unique.cxx.o -o cmTC_f5a77
I also tried to run the binary without errors.
So even more 'I can not figure out what is wrong
Has same error when use Linux virtual machine (VMware) and when sources placed in shared folder. When move sources to user folder all configured successfully.
I'm having lots of difficulties just building VTK examples - can someone help please?
I've downloaded and installed VTK-9.0.1 on my ubuntu 18.04.4 system. Now I want to install and run the VTK examples at this link., so I clone that repo. Then I follow the instructions to "Build all of the examples" at this link.. So I do this:
% mkdir VTKExamples-build
% cd VTKExamples-build
% cmake ../VTKExamples
cmake outputs these messages:
-- The C compiler identification is GNU 7.5.0
-- The CXX compiler identification is GNU 7.5.0
-- 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
-- Detecting C compile features
-- Detecting C compile features - 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
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- VTKWikiExamples: Building VTKWikiExamples stand-alone
-- VTKWikiExamples: Building VTKWikiExamples stand-alone - yes
-- VTKWikiExamples: Setting executables prefix
-- VTKWikiExamples: Setting executables prefix - no
-- VTKWikiExamples: VTK VERSION: 9.0.1(OpenGL2)
-- VTKWikiExamples: Example executables are stored in /home/oreilly/VTKExamples-build/bin
-- VTKWikiExamples: Tests will not be built
CMake Warning (dev) at /usr/local/lib/cmake/vtk-9.0/vtkModule.cmake:2847 (message):
No `MODULES` passed to `vtk_modules_autoinit`.
Call Stack (most recent call first):
src/Cxx/DataStructures/CMakeLists.txt:48 (vtk_module_autoinit)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at /usr/local/lib/cmake/vtk-9.0/vtkModule.cmake:2847 (message):
No `MODULES` passed to `vtk_modules_autoinit`.
src/Cxx/DataStructures/CMakeLists.txt:48 (vtk_module_autoinit)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at /usr/local/lib/cmake/vtk-9.0/vtkModule.cmake:2847 (message):
No `MODULES` passed to `vtk_modules_autoinit`.
Call Stack (most recent call first):
src/Cxx/DataStructures/CMakeLists.txt:48 (vtk_module_autoinit)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at /usr/local/lib/cmake/vtk-9.0/vtkModule.cmake:2847 (message):
No `MODULES` passed to `vtk_modules_autoinit`.
Call Stack (most recent call first):
src/Cxx/DataStructures/CMakeLists.txt:48 (vtk_module_autoinit)
This warning is for project developers. Use -Wno-dev to suppress it.
The "No MODULES passed to vtk_modules_autoinit" error message is repeated over 400 times, and no Makefile is generated.
What am I doing wrong???
Thanks!
I'm trying to build the OpenVAS-SMB plugin on Debian Stretch from source, but it fails, although it builds successfully with the same prerequisites on Debian Jessie.
CMake confirms all required dependencies before starting to build:
root#xxxx:/home/xxxx/openvas-smb-1.0.2# cmake . && make
-- The C compiler identification is GNU 6.3.0
-- The CXX compiler identification is GNU 6.3.0
-- 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
-- Detecting C compile features
-- Detecting C compile features - 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
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Perl: /usr/bin/perl (found version "5.24.1")
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29")
-- Checking for module 'popt'
-- Found popt, version 1.16
-- Found Popt: /usr/lib/x86_64-linux-gnu/libpopt.so
-- Found GSSAPI: /usr/lib/x86_64-linux-gnu/libcom_err.so
-- Install prefix: /usr/local
-- Checking for module 'gnutls>=3.2.15'
-- Found gnutls, version 3.5.8
-- Checking for module 'glib-2.0'
-- Found glib-2.0, version 2.50.3
-- Found GnuTLS: /usr/lib/x86_64-linux-gnu/libgnutls.so (found version "3.5.8")
-- Looking for xmltoman...
-- Looking for xmltoman... /usr/bin/xmltoman
-- Looking for xmlmantohtml... /usr/bin/xmlmantohtml
-- Found Doxygen: /usr/bin/doxygen (found version "1.8.13")
-- Configuring done
-- Generating done
It builds samba and the libs correctly, but fails when it comes to winexe:
../samba/libsamba-static.a(kerberos.c.o): In function `kerberos_kinit_password_cc':
kerberos.c:(.text+0x124): undefined reference to `krb5_get_init_creds_opt_init'
kerberos.c:(.text+0x133): undefined reference to `krb5_get_init_creds_opt_set_default_flags'
kerberos.c:(.text+0x153): undefined reference to `krb5_get_init_creds_password'
kerberos.c:(.text+0x182): undefined reference to `krb5_cc_initialize'
kerberos.c:(.text+0x196): undefined reference to `krb5_cc_store_cred'
kerberos.c:(.text+0x1d2): undefined reference to `krb5_free_cred_contents'
kerberos.c:(.text+0x1e7): undefined reference to `krb5_free_cred_contents'
collect2: error: ld returned 1 exit status
winexe/CMakeFiles/winexe.dir/build.make:186: recipe for target 'winexe/winexe' failed
make[2]: *** [winexe/winexe] Error 1
CMakeFiles/Makefile2:145: recipe for target 'winexe/CMakeFiles/winexe.dir/all' failed
make[1]: *** [winexe/CMakeFiles/winexe.dir/all] Error 2
Makefile:149: recipe for target 'all' failed
make: *** [all] Error 2
I'm guessing that there's an issue with either heimdal-dev or the libglib2.0-dev causing this.
These are the requirements for building OpenVAS-SMB besides the typical build tools: gcc-mingw-w64 libgnutls28-dev perl-base heimdal-dev heimdal-multidev libpopt-dev libglib2.0-dev
Anyone know of any differences between the libs that could make the build fail on Stretch, but work on Jessie? Or maybe can provide a hint on how to do further troubleshooting?
Thanks!
I am trying to install kdev-executebrowser from https://github.com/KDE/kdev-executebrowser into kdevelop.
So I cloned the plugin from git hub and tried to cmake and got an error (please check the quote below).
I can't figure how how to solve this. Please help
I also attached my system info and hope it might help
System Info
waleed#waleed-Dell-System-Inspiron-N411Z:~/Downloads/kdev-executebrowser$
cmake .
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- 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
-- Detecting C compile features
-- Detecting C compile features - 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
-- Detecting CXX compile features
-- Detecting CXX compile features - done CMake Error at /usr/share/cmake-3.5/Modules/FindKDE4.cmake:111
(message):
ERROR: cmake/modules/FindKDE4Internal.cmake not found in
/home/waleed/.kde/share/apps;/usr/share/kubuntu-default-settings/kde4-profile/default/share/apps;/usr/share/kde4/apps Call Stack (most recent call first):
CMakeLists.txt:6 (find_package)
-- Configuring incomplete, errors occurred! See also
"/home/waleed/Downloads/kdev-executebrowser/CMakeFiles/CMakeOutput.log".
FindKDE4Internal.cmake
http://packages.ubuntu.com/search?searchon=contents&keywords=FindKDE4Internal.cmake&mode=exactfilename&suite=saucy&arch=any
The missing package is usually kdelibs5-dev.
I am trying to install the tool bam-window but I am getting cmake error. I downloaded the bam-window-master.zip in linux. The link of the tool is hosted in git https://github.com/genome-vendor/bam-window. I downloaded and follow the below commands.
unzip bam-window-master.zip
cd bam-window-master
mkdir build
cd build
cmake ..
On doing cmake .. After compiling I for a while I get an error
-- The C compiler identification is GNU 4.7.2
-- The CXX compiler identification is GNU 4.7.2
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- 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
-- Found Git: /usr/bin/git (found version "1.7.10.4")
CMake Error at cmake/GitHelper.cmake:15 (message):
Failed to get git revision, abort: fatal: Not a git repository (or any
parent up to mount point /scratch/GT)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
!
Call Stack (most recent call first):
CMakeLists.txt:9 (get_git_version_info)
How do I get rid of this and make the installation proper?
The CMakeLists.txt for this project assumes (unfortunately) that the source code is not downloaded as a zip file, but instead cloned from github.
So instead of using "Dowload ZIP" link, just clone it using regular GIT commands:
git clone https://github.com/genome-vendor/bam-window.git