LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
check_libs.cc
Go to the documentation of this file.
1 //
2 // check_libs is a program that tries loading all types of libraries
3 // that the art LibraryManager works with, to help diagnose loading
4 // problems.
5 //
6 
7 #include <algorithm>
8 #include <iostream>
9 #include <string>
10 #include <vector>
11 
12 #include <regex>
13 
14 #include "cetlib/LibraryManager.h"
15 #include "cetlib_except/exception.h"
16 
17 using cet::LibraryManager;
18 using std::string;
19 using std::vector;
20 using std::cout;
21 using std::regex;
22 using std::regex_match;
23 
24 
25 void try_loading(LibraryManager& libs,
26  string const& path,
27  string const& expected_symbol)
28 {
29  void* sym = 0;
30  try
31  {
32  libs.getSymbolByPath(path, expected_symbol, sym);
33  if (sym)
34  cout << "... ok\n";
35  else
36  cout << "... symbol value was zero: report this to ART core team\n";
37  }
38  catch (cet::exception& e)
39  {
40  cout << "... FAILED:\n"
41  << e.what() << '\n';
42  }
43  catch (...)
44  {
45  cout << " ... FAILED: Loading threw an unidentified exception\n";
46  }
47 
48 }
49 
50 void checkLoadability(string const& type,
51  string const& expected_symbol)
52 {
53  static const regex system_service("libart_Framework_Services_System_[A-Za-z]+_service\\.dylib");
54 
55  vector<string> libraries;
56  LibraryManager libs(type);
57 
58  size_t numLibs = libs.getLoadableLibraries(libraries);
59  cout << " found "
60  << numLibs
61  << " libraries of type "
62  << type
63  << ", list follows...\n";
64 
66  it = libraries.begin(),
67  end = libraries.end();
68  it != end; ++it)
69  {
70  cout << " " << *it;
71  if (regex_search(*it, system_service))
72  cout << "... ok\n";
73  else
74  try_loading(libs, *it, expected_symbol);
75  }
76 
77 }
78 
79 int main()
80 {
81  checkLoadability("module", "make");
82  checkLoadability("service", "make");
83 
84  checkLoadability("map", "SEAL_CAPABILITIES");
85  checkLoadability("dict", "_init");
86 
87  return 0;
88 }
89 
90 // Local Variables:
91 // mode: c++
92 // End:
int main()
Definition: check_libs.cc:79
void checkLoadability(string const &type, string const &expected_symbol)
Definition: check_libs.cc:50
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:265
intermediate_table::const_iterator const_iterator
std::vector< evd::details::RawDigitInfo_t >::const_iterator end(RawDigitCacheDataClass const &cache)
void try_loading(LibraryManager &libs, string const &path, string const &expected_symbol)
Definition: check_libs.cc:25
Float_t e
Definition: plot.C:34
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33