質問編集履歴

2

CMakeList.txtの書き換えに伴うエラー出力変更を反映 / 質問内容の追記

2022/06/21 06:42

投稿

pra
pra

スコア17

test CHANGED
@@ -1 +1 @@
1
- ROOT C++ : RooUnfoldのMacにおけるコンパイル
1
+ ROOT C++ : RooUnfoldのMacにおけるcmakeを用いたコンパイル
test CHANGED
@@ -7,7 +7,7 @@
7
7
  ### 背景 / 発生している問題・エラーメッセージ
8
8
  (1) MacにROOTをインストール。ROOT自体は起動した。
9
9
  (2) RooUnfoldを使用するためにhttps://gitlab.cern.ch/RooUnfold/RooUnfold からRooUnfold-master.zipをダウンロード・解凍し、同ページの "Building the Library"の記述通りに以下を実行:
10
- ```shell
10
+ ```bash
11
11
  cd RooUnfold-master
12
12
  mkdir build
13
13
  cd build
@@ -17,12 +17,12 @@
17
17
  source build/setup.sh
18
18
  ```
19
19
  (3) しかし、以下のようなエラーメッセージが出てきてコンパイルできない。
20
- ```shell
20
+ ```bash
21
21
  $ cd RooUnfold-master
22
22
  $ mkdir build
23
23
  $ cd build
24
24
  $ cmake ..
25
- CMake Deprecation Warning at CMakeLists.txt:9 (cmake_minimum_required):
25
+ CMake Deprecation Warning at CMakeLists.txt:10 (cmake_minimum_required):
26
26
  Compatibility with CMake < 2.8.12 will be removed from a future version of
27
27
  CMake.
28
28
 
@@ -30,72 +30,39 @@
30
30
  CMake that the project does not need compatibility with older versions.
31
31
 
32
32
 
33
- -- The C compiler identification is AppleClang 13.1.6.13160021
34
- -- The CXX compiler identification is AppleClang 13.1.6.13160021
35
- -- Detecting C compiler ABI info
36
- -- Detecting C compiler ABI info - done
37
- -- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - skipped
38
- -- Detecting C compile features
39
- -- Detecting C compile features - done
40
- -- Detecting CXX compiler ABI info
41
- -- Detecting CXX compiler ABI info - done
42
- -- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ - skipped
43
- -- Detecting CXX compile features
44
- -- Detecting CXX compile features - done
45
33
  Setup using plain ROOT
46
- -- Found Doxygen: /opt/homebrew/bin/doxygen (found version "1.9.3") found components: doxygen dot
47
34
  Doxygen build started
48
35
  -- Configuring done
49
- CMake Warning (dev):
50
- Policy CMP0042 is not set: MACOSX_RPATH is enabled by default. Run "cmake
51
- --help-policy CMP0042" for policy details. Use the cmake_policy command to
52
- set the policy and suppress this warning.
53
-
54
- MACOSX_RPATH is not specified for the following targets:
55
-
56
- RooUnfold
57
-
58
- This warning is for project developers. Use -Wno-dev to suppress it.
59
-
60
36
  -- Generating done
61
37
  -- Build files have been written to: /Users/XXXXXX/RooUnfold-master/build
62
38
 
63
-
64
- $ make
39
+ $ make -j4
65
- [ 2%] Generating G__RooUnfold.cxx, libRooUnfold_rdict.pcm,
40
+ [ 2%] Generating G__RooUnfold.cxx, libRooUnfold_rdict.pcm, libRooUnfold.rootmap
66
- libRooUnfold.rootmap
67
41
  Scanning dependencies of target RooUnfold
68
- Consolidate compiler generated dependencies of target RooUnfold
69
- [ 4%] Building CXX object CMakeFiles/RooUnfold.dir/G__RooUnfold.o
70
- In file included from /Users/XXXXXX/RooUnfold-master/build/G__RooUnfold.cxx:58:
71
- In file included from /Users/XXXXXX/RooUnfold-master/src/TUnfoldDensity.h:48:
72
- In file included from /Users/XXXXXX/RooUnfold-master/src/TUnfoldSys.h:54:
73
- /opt/homebrew/Cellar/root/6.26.04_1/include/root/TMap.h:145:30: warning: 'iterator<std::bidirectional_iterator_tag, TObject *, long, const TObject **, const TObject *&>' is deprecated [-Wdeprecated-declarations]
74
- public std::iterator<std::bidirectional_iterator_tag,
75
- ^
76
- /Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/include/c++/v1/__iterator/iterator.h:27:29: note: 'iterator<std::bidirectional_iterator_tag, TObject *, long, const TObject **, const TObject *&>' has been explicitly marked deprecated here
77
- struct _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 iterator
78
- ^
79
- /Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/include/c++/v1/__config:1066:39: note: expanded from macro '_LIBCPP_DEPRECATED_IN_CXX17'
80
- # define _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_DEPRECATED
42
+ [ 9%] Building CXX object CMakeFiles/RooUnfold.dir/src/RooUnfoldBayes.o
43
+ [ 9%] Building CXX object CMakeFiles/RooUnfold.dir/src/RooUnfold.o
44
+ [ 9%] Building CXX object CMakeFiles/RooUnfold.dir/src/RooFitUnfold.o
45
+ [ 12%] Building CXX object CMakeFiles/RooUnfold.dir/src/RooUnfoldBinByBin.o
46
+ In file included from /Users/XXXXXX/RooUnfold-master/src/RooUnfoldBinByBin.cxx:8:
47
+ /Users/XXXXXX/RooUnfold-master/src/RooUnfoldBinByBin.h:44:3: warning: 'CheckTObjectHashConsistency' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
48
+ ClassDefT (RooUnfoldBinByBinT, 1) // Bin-by-bin unfolding
49
+ ^
50
+ /opt/homebrew/Cellar/root/6.26.04_1/include/root/Rtypes.h:392:4: note: expanded from macro 'ClassDefT'
51
+ _ClassDefOutline_(name,id,virtual,) \
52
+ ^
53
+ /opt/homebrew/Cellar/root/6.26.04_1/include/root/Rtypes.h:300:4: note: expanded from macro '_ClassDefOutline_'
54
+ _ClassDefBase_(name,id, virtual_keyword, overrd) \
55
+ ^
81
56
 
82
57
  (中略)
83
58
 
84
- /opt/homebrew/Cellar/root/6.26.04_1/include/root/Rtypes.h:309:25: note: expanded from macro '_ClassDefOutline_'
85
- virtual_keyword void Streamer(TBuffer&) overrd;
86
- ^
87
59
  97 warnings generated.
88
60
  [ 63%] Linking CXX shared library libRooUnfold.dylib
89
- ld: warning: direct access in function 'ROOT::GenerateInitInstanceLocal(RooUnfoldResponseT<TH1, TH2> const*)' from file 'CMakeFiles/RooUnfold.dir/G__RooUnfold.o' to global weak symbol 'typeinfo for RooUnfoldResponseT<TH1, TH2>' from file 'CMakeFiles/RooUnfold.dir/src/RooUnfoldResponse.o' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
90
-
91
- (中略)
92
-
93
- ld: warning: direct access in function 'ROOT::GenerateInitInstanceLocal(RooUnfoldTUnfoldT<RooUnfolding::RooFitHist, RooUnfolding::RooFitHist> const*)' from file 'CMakeFiles/RooUnfold.dir/G__RooUnfold.o' to global weak symbol 'typeinfo for RooUnfoldTUnfoldT<RooUnfolding::RooFitHist, RooUnfolding::RooFitHist>' from file 'CMakeFiles/RooUnfold.dir/src/RooUnfoldTUnfold.o' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
94
61
  [ 63%] Built target RooUnfold
95
- [ 65%] Building CXX object CMakeFiles/RooUnfoldTest3D.dir/test/src/RooUnfoldTest3D.o
62
+ [ 73%] Building CXX object CMakeFiles/RooUnfoldTest3D.dir/test/src/RooUnfoldTest3D.o
96
- [ 73%] Building CXX object CMakeFiles/RooUnfoldTest.dir/test/src/RooUnfoldTest.o
97
63
  [ 73%] Building CXX object test/CMakeFiles/RooUnfoldTests.dir/src/generate_test.o
98
64
  [ 73%] Building CXX object CMakeFiles/RooUnfoldTest2D.dir/test/src/RooUnfoldTest2D.o
65
+ [ 73%] Building CXX object CMakeFiles/RooUnfoldTest.dir/test/src/RooUnfoldTest.o
99
66
  [ 75%] Building CXX object test/CMakeFiles/RooUnfoldTests.dir/src/response_test.o
100
67
  [ 78%] Linking CXX executable RooUnfoldTest
101
68
  ld: library not found for -lgcov
@@ -103,28 +70,18 @@
103
70
  make[2]: *** [RooUnfoldTest] Error 1
104
71
  make[1]: *** [CMakeFiles/RooUnfoldTest.dir/all] Error 2
105
72
  make[1]: *** Waiting for unfinished jobs....
106
- [ 80%] Linking CXX executable RooUnfoldTest2D
107
- [ 82%] Building CXX object test/CMakeFiles/RooUnfoldTests.dir/src/bayes_test.o
73
+ [ 80%] Building CXX object test/CMakeFiles/RooUnfoldTests.dir/src/bayes_test.o
74
+ [ 82%] Linking CXX executable RooUnfoldTest2D
108
75
  ld: library not found for -lgcov
109
76
  clang: error: linker command failed with exit code 1 (use -v to see invocation)
110
77
  make[2]: *** [RooUnfoldTest2D] Error 1
111
78
  make[1]: *** [CMakeFiles/RooUnfoldTest2D.dir/all] Error 2
79
+ [ 85%] Linking CXX executable RooUnfoldTest3D
112
- [ 85%] Building CXX object test/CMakeFiles/RooUnfoldTests.dir/src/RooUnfold_unit_tests.o
80
+ [ 87%] Building CXX object test/CMakeFiles/RooUnfoldTests.dir/src/RooUnfold_unit_tests.o
113
- [ 87%] Linking CXX executable RooUnfoldTest3D
114
81
  ld: library not found for -lgcov
115
82
  clang: error: linker command failed with exit code 1 (use -v to see invocation)
116
83
  make[2]: *** [RooUnfoldTest3D] Error 1
117
84
  make[1]: *** [CMakeFiles/RooUnfoldTest3D.dir/all] Error 2
118
- /Users/XXXXXX/RooUnfold-master/test/src/RooUnfold_unit_tests.cxx:29:62: warning: format specifies type 'unsigned int' but the argument has type 'std::vector<float>::size_type' (aka 'unsigned long') [-Wformat]
119
- check(n==r.size(), "error in bayes: %d bins is not %u",n,r.size());
120
- ~~ ^~~~~~~~
121
- %lu
122
- /Users/XXXXXX/RooUnfold-master/test/src/dbg.h:30:18: note: expanded from macro 'check'
123
- log_err(M, ##__VA_ARGS__); errno=0; goto error; }
124
- ~ ^~~~~~~~~~~
125
- /Users/XXXXXX/RooUnfold-master/test/src/dbg.h:20:26: note: expanded from macro 'log_err'
126
- clean_errno(), ##__VA_ARGS__)
127
- ^~~~~~~~~~~
128
85
  In file included from /Users/XXXXXX/RooUnfold-master/test/src/bayes_test.cxx:13:
129
86
  /Users/XXXXXX/RooUnfold-master/src/RooUnfoldBayes.h:45:17: warning: 'SetRegParm' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
130
87
  virtual void SetRegParm (Double_t parm);
@@ -156,8 +113,18 @@
156
113
  /Users/XXXXXX/RooUnfold-master/src/RooUnfold.h:129:8: note: overridden virtual function is here
157
114
  void Print(Option_t* opt="") const;
158
115
  ^
116
+ /Users/XXXXXX/RooUnfold-master/test/src/RooUnfold_unit_tests.cxx:29:62: warning: format specifies type 'unsigned int' but the argument has type 'std::vector<float>::size_type' (aka 'unsigned long') [-Wformat]
117
+ check(n==r.size(), "error in bayes: %d bins is not %u",n,r.size());
118
+ ~~ ^~~~~~~~
119
+ %lu
120
+ /Users/XXXXXX/RooUnfold-master/test/src/dbg.h:30:18: note: expanded from macro 'check'
121
+ log_err(M, ##__VA_ARGS__); errno=0; goto error; }
122
+ ~ ^~~~~~~~~~~
123
+ /Users/XXXXXX/RooUnfold-master/test/src/dbg.h:20:26: note: expanded from macro 'log_err'
124
+ clean_errno(), ##__VA_ARGS__)
125
+ ^~~~~~~~~~~
126
+ 4 warnings generated.
159
127
  1 warning generated.
160
- 4 warnings generated.
161
128
  [ 90%] Linking CXX static library libRooUnfoldTests.a
162
129
  [ 90%] Built target RooUnfoldTests
163
130
  make: *** [all] Error 2
@@ -165,6 +132,16 @@
165
132
 
166
133
  ### 質問内容
167
134
  以上のエラーを解消し、Macで正常にRooUnfoldを使用するにはどうすれば良いでしょうか?
135
+ 特に
136
+ ```bash
137
+ ld: library not found for -lgcov
138
+ clang: error: linker command failed with exit code 1 (use -v to see invocation)
139
+ ```
140
+ のようなlikerのエラーと
141
+ ```bash
142
+ warning: 'SetRegParm' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
143
+ ```
144
+ のようなoverridesのエラーを理解・解決したいと思っています。
168
145
  ROOTやC++を使ったことがほとんどなく、初心者質問で大変恐縮ですが、よろしくお願いします。
169
146
 
170
147
  ### 環境

1

タイトル/shellがzshであることを追記

2022/06/21 02:23

投稿

pra
pra

スコア17

test CHANGED
@@ -1 +1 @@
1
- ROOT : RooUnfoldのMacにおけるコンパイル
1
+ ROOT C++ : RooUnfoldのMacにおけるコンパイル
test CHANGED
@@ -185,4 +185,5 @@
185
185
  Thread model: posix
186
186
  InstalledDir: /Library/Developer/CommandLineTools/usr/bin
187
187
  ```
188
+ shellはzshです
188
189