Debian Codegraph @

hugo/content/howto/troubleshooting/_index.md

raw
1 +++
2 title = "Solve known problems"
3 weight = 60
4 +++
5
6 ## How to solve known problems
7
8 * [Windows specific](#windows-specific)
9 * [Missing api-ms-win-crt-runtime-l1-1-0.dll](#missing-win-crt-runtime)
10 * [MacOS specific](#macos-specific)
11 * [Incompatible library version of libgsl.0.dylib](#a-incompatible-gsl)
12 * [Building from source on Linux](#building-from-source-on-linux)
13 * [Configuration (cmake) fails](#configuration-cmake-fails)
14 * [Compilation (make) fails](#compilation-make-fails)
15 * [Common](#common)
16 * [Functional test (ctest) fails](#functional-test-ctest-fails)
17 * [Fatal Python error: PyThreadState_Get: no current thread](#a-no-current-thread)
18
19 <hr>
20
21 ### Windows specific
22
23 #### Missing api-ms-win-crt-runtime-l1-1-0.dll {{% anchor "missing-win-crt-runtime" %}}
24
25 On some Windows machines, you might get the message "The program can't start because api-ms-win-crt-runtime-l1-1-0.dll is missing from your computer". You then have to install the Visual C++ Redistributable for Visual Studio 2015. See for example the discussion at [stackoverflow](http://stackoverflow.com/questions/33265663/api-ms-win-crt-runtime-l1-1-0-dll-is-missing-when-open-office-file).
26
27 Before installing the Visual C++ Redistributable, install all Windows updates. Then download and install the [Visual C++ Redistributable from Microsoft](https://www.microsoft.com/en-us/download/details.aspx?id=48145).
28
29 <hr>
30
31 ### MacOS specific
32
33 {{% anchor "a-incompatible-gsl" %}}
34
35 ##### Incompatible library version of libgsl.0.dylib
36
37 When Mantid is installed on the system, BornAgain might conflict with its libraries if the path to Mantid is specified in the `DYLD_LIBRARY_PATH` and/or `PYTHONPATH` environment variables. This conflict can occur while running any of the BornAgain Python examples or just during the import of BornAgain into Python, with an error message similar to:
38
39 ```bash
40 $ python -c "import bornagain"
41
42 Incompatible library version: libBornAgainSim.so requires
43 version 18.0.0 or later, but libgsl.0.dylib provides version 16.0.0
44 ```
45
46 Make sure that the path to the Mantid folders is not defined in your `DYLD_LIBRARY_PATH` and/or `PYTHONPATH` variables by running the commands `echo $DYLD_LIBRARY_PATH` and `echo $PYTHONPATH`. If this is the case, unset the given variables to prevent the MacOS loader from loading Mantid
47
48 ```bash
49 $ unset DYLD_LIBRARY_PATH; unset $PYTHONPATH
50 ```
51
52 This should resolve the issue.
53
54 {{< notice tip >}}
55 To see which libraries get loaded by the MacOS loader during the import of BornAgain, use
56
57 ```bash
58 $ export DYLD_PRINT_LIBRARIES=1
59 $ python -c "import bornagain"
60 ```
61 {{< /notice >}}
62
63 <hr>
64
65 ### Building from source on Linux
66
67 ##### CMake configuration phase fails
68
69 To accelerate the build process, `cmake` maintains a cache. The downside is that this cache can cause false positives (erroneous error reports) and false negatives (`cmake` overlooking missing dependencies). Unless `cmake` has been run for the first the time in a fresh build directory, troubleshooting should start by removing the cache
70
71 ```bash
72 $ rm CMakeCache.txt
73 ```
74
75 and running `cmake` anew. If that does not help, then empty the build directory completely, and run `cmake` yet again.
76
77 Next, carefully read the error message, which will have the following form:
78
79 ```
80 CMake Error at [cmake module]:[line number] (message):
81 [specific error message]
82 Call Stack (most recent call first):
83 [cmake module]:[line] ([command])
84 ...
85 -- Configuring incomplete, errors occurred!
86 See also "[build_dir]/CMakeFiles/CMakeOutput.log".
87 See also "[build_dir]/CMakeFiles/CMakeError.log".
88 ```
89
90 The most frequent error is a missing dependence because a third party library not installed on the system, or not found by `cmake`.
91
92 If you require our support, then please rerun `cmake` in an empty build directory and provide a full copy of its output, most easily generated by output redirection
93
94 ```bash
95 $ cmake [<options>] <source_dir> >& my_cmake.log
96 ```
97
98 Besides the so obtained my_cmake.log also send us three other log files produced by `cmake` in the build directory:
99
100 ```
101 CMakeCache.txt
102 CMakeFiles/CMakeOutput.log
103 CMakeFiles/CMakeError.log
104 ```
105
106 <hr>
107
108 #### Compilation phase fails
109
110 In the case of a complex system setup, with libraries of different versions scattered across multiple places, `cmake` might fail in identifying the correct paths to the libraries or include directories. This might lead at some point to a compilation failure. Please send us the build log generated by running the following make command
111
112 ```bash
113 $ make VERBOSE=1 >& my_build.log
114 ```
115
116 <hr>
117
118 ### Common
119
120 #### Functional test (ctest) fails
121
122 {{< notice note >}}
123 A frequent cause for errors at this stage is a conflict with older versions of `BornAgain` installed on the system. Make sure the `LD_LIBRARY_PATH` and `PYTHONPATH` variables do not contain the older installation location and run `ctest` again.
124 {{< /notice >}}
125
126 If `ctest` fails, then rerun it without the multi-core option `-j[N]`. This yields clearer, sorted output, and allows to rule out errors due to thread-safety violations.
127
128 Error messages from `ctest` have the form
129
130 ```
131 The following tests FAILED:
132 53 - CoreSuite/HexParacrystal (Failed)
133 123 - PySuite/HexParacrystal (Failed)
134 For details, see the log files in Testing/Temporary/
135 More info at ...
136 Errors while running CTest
137 ```
138
139 To analyse these errors one by one, it is convenient to run `ctest` on a single test:
140
141 ```bash
142 $ ctest -V -R PySuite/HexParacrystal
143 ```
144
145 Then analyse the output in `Testing/Temporary/LastTest.log`. Alternatively, set the environment variable `CTEST_OUTPUT_ON_FAILURE=1` to get full terminal output from the failed tests. Yet another alternative would be to run the test binary directly from `<build_dir>/bin`.
146
147 When reporting errors to us, please run just the plain `ctest` without options `-j` or `-R`, and submit `Testing/Temporary/LastTest.log`.
148
149 <hr>
150
151 {{% anchor "a-no-current-thread" %}}
152 #### "Fatal Python error: PyThreadState_Get: no current thread"
153
154 This error shows up when a Python module tries to use a Python library that is different than the one the interpreter uses. This might happen if the user's system contains several Python installations.
155
156 For example, BornAgain was compiled against `/usr/lib64/libpython3.10.so` and then used by mistake with a Python interpreter from another installation. This interpreter might depend on his own version of `libpython3.10.so` located, for example, at `/usr/local`. Importing of the bornagain module into this interpreter will cause the loading of two different `libpython3.10.so` libraries: one will be loaded by the bornagain module, the other will be loaded by the interpreter itself. This will cause the given fatal Python error. Make sure you are running the correct Python interpreter and that your `PYTHONPATH` and `DYLD_LIBRARY_PATH` doesn't contain the old BornAgain installation.