cmake error when i have tried to build a compilining? - c++

i have tried to compline a repository via "https://github.com/giglio0/DRAGON-G4-LaBr3.git" but while the compiling, i have taken a error. I don't Know why it is? i am not a coder. Just i want to build this repository and run the simulation with changing some parameters. The error output is;
Scanning dependencies of target LaBr3_v4
[ 9%] Building CXX object CMakeFiles/LaBr3_v4.dir/LaBr3_v4.cc.o
[ 18%] Building CXX object CMakeFiles/LaBr3_v4.dir/src/DetectorConstruction.cc.o
[ 27%] Building CXX object CMakeFiles/LaBr3_v4.dir/src/DetectorMessenger.cc.o
[ 36%] Building CXX object CMakeFiles/LaBr3_v4.dir/src/EventAction.cc.o
[ 45%] Building CXX object CMakeFiles/LaBr3_v4.dir/src/HistoManager.cc.o
/home/cancan/Gatev9/example_Geant4/LaBr/LaBr3/src/HistoManager.cc:29:10: fatal error: TH1D.h: No such file or directory
29 | #include <TH1D.h>
| ^~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/LaBr3_v4.dir/build.make:134: CMakeFiles/LaBr3_v4.dir/src/HistoManager.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:95: CMakeFiles/LaBr3_v4.dir/all] Error 2
make: *** [Makefile:149: all] Error 2
can anybody help me?

Apparently you need to install the ROOT library, see: https://root.cern.ch/doc/master/classTH1.html
BTW, the READ.me of the application you want to compile, DRAGON-G4-LaBr3, is awful.

After your advice, i install root-6.22.06 again with use this command;
cmake -DCMAKE_INSTALL_PREFIX=/home/cancan/Gatev9/root-6.22.06-install /home/cancan/Gatev9/root-6.22.06 -Dall=ON
i learned from somewhere if i use "-Dall=ON", i can install all libraries of root but it has not still worked.

Related

Cannot find lpublic library

Trying to compile my project on Centos 8.2 using cmake 3.12, im facing with the following error:
cannot find -lpublic
here is full log:
[ 20%] Building CXX object CMakeFiles/ .cpp.o
[ 40%] Building CXX object CMakeFiles/ .cpp.o
[ 60%] Linking CXX shared library .so
[ 60%] Built target myproj
Scanning dependencies of target nist01
[ 80%] Building CXX object CMakeFiles/ .cpp.o
[100%] Linking CXX executable
/usr/bin/ld: cannot find -lpublic
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/nist01.dir/build.make:85: ...] Error 1
make[1]: *** [CMakeFiles/Makefile2:105: CMakeFiles/...] Error 2
make: *** [Makefile:84: all] Error 2
Tried to find something on the internet, but nothing shown up.
Thanks for your help.
That seems like you try to link against the target "public", which is a suspicious target name. It might be target_link_libraries command with lowercase public instead of uppercase one, like target_link_libraryies(nist01 public something) instead of target_link_libraries(nist01 PUBLIC something).

"Conversion to non-scalar type is requested" error on linux terminal using cmake

I faced an issue when i try to generate CodeLite using CMake. I encountered it during 'make -j4' step. it shows "Conversion to non-scalar type is requested".
'''
[ 68%] Built target codelitephp
[ 68%] Built target codelite-make
[ 69%] Built target codelite-terminal
[ 83%] Built target wxCrafter
[ 83%] [ 83%] [ 83%] Building CXX object LiteEditor/CMakeFiles/codelite.dir/CompilerMainPage.cpp.o
Building CXX object LiteEditor/CMakeFiles/codelite.dir/CompilersFoundDlgBase.cpp.o
Building CXX object LiteEditor/CMakeFiles/codelite.dir/CompilersFoundDlg.cpp.o
[ 83%] Building CXX object LiteEditor/CMakeFiles/codelite.dir/CompilersFoundDlg_liteeditor_bitmaps.cpp.o
[ 83%] Building CXX object LiteEditor/CMakeFiles/codelite.dir/CompilersModifiedDlg.cpp.o
/home/osboxes/Desktop/codelite-13.0/LiteEditor/CompilerMainPage.cpp: In member function ‘void CompilerMainPage::InitializeTools()’:
/home/osboxes/Desktop/codelite-13.0/LiteEditor/CompilerMainPage.cpp:543:76: error: conversion from ‘wxPGIterator<wxPGProperty,wxPropertyGridPageState>’ to non-scalar type ‘wxPGIterator<const wxPGProperty,const wxPropertyGridPageState>’ requested
wxPropertyGridConstIterator iter = m_pgMgrTools->GetGrid()->GetIterator();
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
[ 83%] Building CXX object LiteEditor/CMakeFiles/codelite.dir/ConfigManagerBaseDlg.cpp.o
make[2]: *** [LiteEditor/CMakeFiles/codelite.dir/CompilerMainPage.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [LiteEditor/CMakeFiles/codelite.dir/all] Error 2
make: *** [all] Error 2
'''
Anyone can help me resolve the issue? I followed this GitHub link. It seems like there might be something wrong with the 'cmake' step. Greatly appreciate it if anyone can help me solve it!
This problem doesn't seem to be related to CMAKE rather than to the actual compilation.
I don't know the library personally but as far as I can tell from the wiki page you shared, it seems maybe those instructions might be outdated because it's dated from 2018 but there's recent changes in the library.
I would check the dependencies versions to see if they match with the one that the maintainer specifies in the README.md
I had similar problem when trying to compile CodeLite 13 on CentOS 7.6 clone OS. Manage to solve it by replacing following code string on line 543 of CompilerMainPage.cpp file,
located in "LiteEditor" subfolder:
wxPropertyGridConstIterator iter = m_pgMgrTools->GetGrid()->GetIterator();
by following code statement:
const wxPropertyGrid* pgrid = m_pgMgrTools->GetGrid();
wxPropertyGridConstIterator iter = pgrid->GetIterator();
Save that file and repeat compilation. In my case issue was solved and I could use now CodeLite 13 for my development projects (unfortunately CodeLite not available in rpm format for CentOS 7.x)

Installing LibTorch on OSX: unsupported option fopenmp

I'm trying to follow the instructions (here https://pytorch.org/cppdocs/installing.html) to install LibTorch on OSX. I was all going well up until the "make" command, which returned
Scanning dependencies of target example-app
[ 50%] Building CXX object CMakeFiles/example-app.dir/example-app.cpp.o
clang: error: unsupported option '-fopenmp'
make[2]: *** [CMakeFiles/example-app.dir/example-app.cpp.o] Error 1
make[1]: *** [CMakeFiles/example-app.dir/all] Error 2
make: *** [all] Error 2
Any ideas how I can fix this issue?
By the way, in the earlier cmake step, it seems like the compiler Cmake found was the default system compiler on Mac:
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works

No rule to make target 'TBB_ENV_LIB_DEBUG-NOTFOUND', needed by 'lib/libopencv_core.so.3.2.0

I'm trying to build opencv with the following CMAKE options:
cmake -D CMAKE_BUILD_TYPE=DEBUG -D CMAKE_INSTALL_PREFIX=/home/luca/Dropbox/SURFSPM/opencvInstall -D OPENCV_EXTRA_MODULES_PATH=/home/luca/ParallelOpenCV/opencv_contrib/modules -D WITH_TBB=ON -D WITH_OPENMP=ON -D ENABLE_PROFILING=ON ..
Notice that in RELEASE mode OpenCV is correctly compiled with all the other options. However, at 43% it returns this error:
[ 42%] Built target pch_Generate_opencv_perf_optflow
[ 42%] Built target pch_Generate_opencv_test_optflow
[ 43%] Generating precomp.hpp.gch/opencv_structured_light_DEBUG.gch
Scanning dependencies of target opencv_core
[ 43%] Built target pch_Generate_opencv_test_phase_unwrapping
make[2]: *** No rule to make target 'TBB_ENV_LIB_DEBUG-NOTFOUND', needed by 'lib/libopencv_core.so.3.2.0'. Stop.
make[2]: *** Waiting for unfinished jobs....
[ 43%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/system.cpp.o
cc1plus: warning: /home/luca/ParallelOpenCV/opencv/build/modules/core/precomp.hpp.gch/opencv_core_Release.gch: created with -gnone, but used with -gdwarf-2
[ 43%] Built target pch_Generate_opencv_test_stitching
[ 43%] Built target pch_Generate_opencv_phase_unwrapping
[ 43%] Built target pch_Generate_opencv_test_structured_light
[ 43%] Built target pch_Generate_opencv_perf_stitching
[ 43%] Built target pch_Generate_opencv_stitching
[ 43%] Built target pch_Generate_opencv_structured_light
CMakeFiles/Makefile2:2161: recipe for target 'modules/core/CMakeFiles/opencv_core.dir/all' failed
make[1]: *** [modules/core/CMakeFiles/opencv_core.dir/all] Error 2
Makefile:160: recipe for target 'all' failed
make: *** [all] Error 2
I think that this is Intel TBB related, but I've installed it (in fact it works with the RELEASE version and I don't know how to solve this.
Like #Tsyvarev's comment hints, indeed the configuration phase fails to pickup a debug library version.
I've gotten success setting the original setting:
TBB_ENV_LIB_DEBUG:FILEPATH=TBB_ENV_LIB_DEBUG-NOTFOUND
To the same value as TBB_ENV_LIB:FILEPATH
//Path to a library.
TBB_ENV_LIB:FILEPATH=/usr/lib/x86_64-linux-gnu/libtbb.so
//Path to a library.
TBB_ENV_LIB_DEBUG:FILEPATH=/usr/lib/x86_64-linux-gnu/libtbb.so

How to run googletest in CLion?

I want to use Googletest in my CLion Project.
So here is what I did:
I copied my googletest folder into the lib folder of my project.
I changed my CMakeLists.txt files like described in that Video: https://youtu.be/8Up5eNZ0FLw
and created that simple test:
#include "gtest/gtest.h"
TEST(basic_check, test_eq){
EXPECT_EQ(1,0);
}
I tried to run the test by pressing Shift + Ctrl + F10 and I got the following error:
"F:\Programs\CLion 2016.3\bin\cmake\bin\cmake.exe" --build C:\Users\Christian\ClionProjects\Geldautomat\cmake-build-debug --target runBasicTests -- -j 4
[ 16%] Building CXX object Tests/lib/googletest/CMakeFiles/gtest.dir/src/gtest-all.cc.obj
In file included from C:/Users/Christian/ClionProjects/Geldautomat/Tests/lib/googletest/include/gtest/internal/gtest-internal.h:40:0,
from C:/Users/Christian/ClionProjects/Geldautomat/Tests/lib/googletest/include/gtest/gtest.h:58,
from C:\Users\Christian\ClionProjects\Geldautomat\Tests\lib\googletest\src\gtest-all.cc:39:
C:/Users/Christian/ClionProjects/Geldautomat/Tests/lib/googletest/include/gtest/internal/gtest-port.h: In function 'int testing::internal::posix::StrCaseCmp(const char*, const char*)':
C:/Users/Christian/ClionProjects/Geldautomat/Tests/lib/googletest/include/gtest/internal/gtest-port.h:2328:25: error: '_stricmp' was not declared in this scope
return _stricmp(s1, s2);
^
mingw32-make.exe[3]: *** [Tests/lib/googletest/CMakeFiles/gtest.dir/src/gtest-all.cc.obj] Error 1
mingw32-make.exe[2]: *** [Tests/lib/googletest/CMakeFiles/gtest.dir/all] Error 2
mingw32-make.exe[1]: *** [Tests/basic_tests/CMakeFiles/runBasicTests.dir/rule] Error 2
mingw32-make.exe: *** [runBasicTests] Error 2
Tests\lib\googletest\CMakeFiles\gtest.dir\build.make:62: recipe for target 'Tests/lib/googletest/CMakeFiles/gtest.dir/src/gtest-all.cc.obj' failed
CMakeFiles\Makefile2:162: recipe for target 'Tests/lib/googletest/CMakeFiles/gtest.dir/all' failed
CMakeFiles\Makefile2:267: recipe for target 'Tests/basic_tests/CMakeFiles/runBasicTests.dir/rule' failed
Makefile:200: recipe for target 'runBasicTests' failed
My CMakeLists.txt in this directory is:
include_directories(${gtest_SOURCE_DIR}/include ${gtest_SOURCE_DIR})
add_executable(runBasicTests
basic_check.cpp)
target_link_libraries(runBasicTests gtest gtest_main)
target_link_libraries(runBasicTests src)
Where my Source Code can be found in directory src.
My main.cpp is in the root directory and my Basic Test is in Tests/basic_tests
Tried the same on my Linux Notebook with CLion. Got the Error:
/home/christian/Downloads/clion-2016.3/bin/cmake/bin/cmake --build /home/christian/ClionProjects/Geldautomat/cmake-build-debug --target runBasicTests -- -j 4
Scanning dependencies of target gtest
[ 16%] Building CXX object Tests/lib/googletest/CMakeFiles/gtest.dir/src/gtest-all.cc.o
[ 33%] Linking CXX static library libgtest.a
[ 33%] Built target gtest
Scanning dependencies of target gtest_main
[ 50%] Building CXX object Tests/lib/googletest/CMakeFiles/gtest_main.dir/src/gtest_main.cc.o
[ 66%] Linking CXX static library libgtest_main.a
[ 66%] Built target gtest_main
Scanning dependencies of target runBasicTests
[ 83%] Building CXX object Tests/basic_tests/CMakeFiles/runBasicTests.dir/basic_check.cpp.o
[100%] Linking CXX executable runBasicTests
/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld: cannot find -lsrc
collect2: error: ld returned 1 exit status
Tests/basic_tests/CMakeFiles/runBasicTests.dir/build.make:97: recipe for target 'Tests/basic_tests/runBasicTests' failed
gmake[3]: *** [Tests/basic_tests/runBasicTests] Error 1
CMakeFiles/Makefile2:256: recipe for target 'Tests/basic_tests/CMakeFiles/runBasicTests.dir/all' failed
gmake[2]: *** [Tests/basic_tests/CMakeFiles/runBasicTests.dir/all] Error 2
CMakeFiles/Makefile2:268: recipe for target 'Tests/basic_tests/CMakeFiles/runBasicTests.dir/rule' failed
gmake[1]: *** [Tests/basic_tests/CMakeFiles/runBasicTests.dir/rule] Error 2
Makefile:201: recipe for target 'runBasicTests' failed
gmake: *** [runBasicTests] Error 2
It would be fine if my Project runs on Linux..
Any suggestions?
-ChrizZ
You can follow this link ->
https://www.youtube.com/channel/UCvHU1FkIE-ogFTtXnKZsqWA
There are 2 videos. Both are helpful. I set up googleTest in my CLion yesterday following the 8:19 long video.