The following contains answers to typical questions from developers about OpenMS.
The following section provides general information to new contributors.
I am new to OpenMS. What should I do first?#
I have written a class for OpenMS. What should I do?#
Follow the OpenMS coding conventions.
Coding style (brackets, variable names, etc.) must conform to the conventions.
The class and all the members should be properly documented.
Check your code with the tool
php tools/checker.phpfor detailed instructions.
Please open a pull request and follow the pull request guidelines.
Can I use QT designer to create GUI widgets?#
Yes. Create a class called
Widget: Create .ui-File with
QT designer and store it as
Widget.ui., add the class to
sources.cmake. From the .ui-File the file
include/OpenMS/VISUAL/UIC/ClassTemplate.h is generated by the build
Do not check in this file, as it is generated automatically when needed.
Derive the class
WidgetTemplate. For further details, see the
Can the START_SECTION-macro not handle template methods that have two or more arguments?#
Insert round brackets around the method declaration.
Where can I find the binary installers created?#
View the binary installers at the build archive. Please verify the creation date of the individual installers, as there may have been an error while creating the installer.
The following section provides information about how to troubleshoot common OpenMS issues.
OpenMS complains about boost not being found but I’m sure its there#
CMake got confused. Set up a new build directory and try again. If you build from source (not recommended), deleting
cmake directory might help.
The following questions are related to the build system.
What is CMake?#
CMake builds BuildSystems for different platforms, e.g. VisualStudio Solutions on Windows, Makefiles on Linux etc.
This allows to define in one central location (namely
CMakeLists.txt) how OpenMS is build and have the platform
specific stuff handled by
View the cmake website for more information.
How do I use CMake?#
See Installation instructions for your platform.
In general, call
CMake(.exe) with some parameters to create the native build-system.
ccmake is mentioned in this document, substitute this by
CMake-GUI if your OS is Windows. Edit the
CMakeCache.txt file directly.
How do I generate a build-system for Eclipse, KDevelop, CodeBlocks etc?#
cmake into a console. This will list the available code generators available on your platform; use them with
CMake using the
What are user definable CMake cache variables?#
They allow the user to pass options to
CMake which will influence the build system. The most important option which
should be given when calling
CMAKE_FIND_ROOT_PATH, which is where
CMake will search for additional libraries if they are not found in the default
system paths. By default we add
If you have installed all libraries on your system already, there is no need to change
contrib libraries, set the variable
contrib folder is required, as there are no system developer packages. To pass this variable to
CMake use the
-D switch e.g.
cmake -D CMAKE_FIND_ROOT_PATH:PATH="D:\\somepath\\contrib".
Everything else can be edited using
The following options are of interest:
CMAKE_BUILD_TYPETo build Debug or Release version of OpenMS. Release is the default.
CMAKE_FIND_ROOT_PATHThe path to the
Provide more then one value here (e.g.,
-D CMAKE_FIND_ROOT_PATH="/path/to/contrib;/usr/"will search in your
contribpath and in
/usrfor the required libraries)
STL_DEBUGEnables STL debug mode.
DB_TEST(deprecated) Enables database testing.
QT_DB_PLUGIN(deprecated) Defines the db plugin used by Qt.
View the description for each option by calling
Can I use another solver other than GLPK?#
Other solvers can be used, but by default, the build system only links to GLPK (this is how OpenMS binary packages must
be built). To to use another solver, use
cmake ... -D USE_COINOR=1 .... and refer to the documentation of the
How do I switch to debug or release configuration?#
For Makefile generators (typically on Linux), set the
CMAKE_BUILD_TYPE variable to either Debug or Release by
ccmake. For Visual Studio, this is not necessary as all configurations are generated and choose the one you
like within the IDE itself. The ‘Debug’ configuration enabled debug information. The ‘Release’ configuration disables
debug information and enables optimisation.
I changed the
contrib path, but re-running
CMake won’t change the library paths?#
Once a library is found and its location is stored in a cache variable, it will only be searched again if the corresponding entry in the cache file is set to false.
If you delete the
CMakeCache.txt, all other custom settings will be lost.
The most useful targets will be shown to you by calling the targets target, i.e. make targets.
CMake can’t seem to find a
Qt library (usually
QtCore). What now?#
QT by looking for
qmake in your
PATH or for the Environment Variable
QTDIR. Set these accordingly.
Make sure there is no second installation of Qt (especially the MinGW version) in your local environment.
This might lead
CMake to the wrong path (it’s searching for the
You should only move or delete the offending
Qt version if you know what you are doing!
A save workaround is to edit the
CMakeCache file (e.g. via
ccmake) and set all paths relating to
(Windows) What version of Visual Studio should I use?#
It is recommended to use the latest version. Get the latest
CMake, as its generator needs to support your VS. If
your VS is too new and there is no
CMake for that yet, you’re gonna be faced with a lot of conversion issues.
This happens whenever the Build-System calls
CMake (which can be quite often, e.g., after changes to
How do I add a new class to the build system?#
Create the new class in the corresponding sub-folder of the sub-project. The header has to be created in
Add both to the respective
sources.cmakefile in the same directory (e.g.,
Add the corresponding class test to
Add the test to the
executables.cmakefile in the test folder (e.g.,
Add them to git by using the command
How do I add a new directory to the build system?#
Create two new
sources.cmakefiles (one for
src/<sub-project>/include/OpenMS/MYDIR, one for
src/<sub-project>/source/MYDIR), using existing
sources.cmakefiles as template.
Add the new
If you created a new directory directly under
src/openms/source, then have a look at
Add a new section that makes the unit testing system aware of the new (upcoming) tests.
Look at the very bottom and augment
Add a new group target to
How can I speed up the compile process of OpenMS?#
To speed up the compile process of OpenMS, use several threads. If you have several processors/cores, build OpenMS
TOPP tools in several threads. On Linux, use the
make option -j: make -j8 OpenMS TOPP test_build.
On Windows, Visual Studio solution files are automatically build with the
/MP flag, such that Visual Studio uses all
available cores of the machine.
View preparation of a new OpenMS release to learn more about contributing to releases.
Working in Integrated Development Environments (IDEs)#
Why are there no
All source files added to an IDE are associated with their targets. Find the source files for each test within
its own subproject. The same is true for the
I’m getting the error “Error C2471: cannot update program database”#
This is a bug in Visual Studio and there is a bug fix Only apply it if you encounter the error. The bug fix might have unwanted side effects!
Visual Studio can’t read the clang-format file.#
Depending on the Visual Studio version it might get an error like
Error while formating with ClangFormat.
This is because Visual Studio is using an outdated version of clang-format. Unfortunately there is no easy way to update
this using Visual Studio itself. There is a plugin provided by LLVM designed to fix this problem, but the plugin doesn’t
work with every Visual Studio version. In that case, update clang-format manually using the pre-build clang-format
binary. Both the binary and a link to the plugin can be found here.
To update clang-format download the binary and exchange it with the clang-format binary in your Visual Studio folder.
For Visual Studio 17 and 19 it should be located at:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\Llvm\bin.
The indexer gets stuck at some file which
It seems that SeqAn code is just too confusing for older eclipse C++ indexers. You should upgrade to eclipse galileo
(CDT 6.0.x). Also, increase the available memory limit in
-Xmx1024m for one gig.
The parser is confused after OPENMS_DLLAPI and does not recognize standard C++ headers#
Project -> Properties -> C/C++ Include Paths and Preprocessor Symbols -> Add Preprocessor symbol -> "OPENMS_DLLAPI=".
This tells eclipse that the macro is defined empty. In the same dialog add an external include path to
/usr/include/c++/4.3.3/, etc. The issue with C++ headers was fixed in the latest galileo release.
Hints to resolve the OPENMS_DLLAPI issue using the
cmake generator are welcome!
The following section provides information about how to debug your code.
How do I debug uncaught exceptions?#
Dump a core if an uncaught exception occurs, by setting the environment variable
Each time an uncaught exception occurs, the
OPENMS_DUMP_CORE variable is checked and a segmentation fault is caused,
if it is set.
(Linux) Why is no core dumped, although a fatal error occured?#
ulimit -c unlimited command. It sets the maximum size of a core to unlimited.
We observed that, on some systems, no core is dumped even if the size of the core file is set to unlimited. We are not sure what causes this problem.
(Linux) How can I set breakpoints in gdb to debug OpenMS?#
Imagine you want to debug the TOPPView application and you want it to stop at line 341 of SpectrumMDIWindow.C.
Enter the following in your terminal:
Run gdb: shell> gdb TOPPView
Start the application (and close it):
gdb> run [arguments]
Set the breakpoint:
gdb> break SpectrumMDIWindow.C:341
Start the application again (with the same arguments):
OpenMS runs on three major platforms… Here are the most prominent causes of “it runs on Platform A, but not on B. What now?”
Reading or writing binary files#
Reading or writing binary files causes different behaviour. Usually Linux does not make a difference between text-mode
and binary-mode when reading files. This is quite different on Windows as some bytes are interpreted as
lead might to a premature end of the reading process.
If reading binary files, make sure that you explicitly state that the file is binary when opening it.
During writing in text-mode on Windows a line-break (
\n) is expanded to (
\r\n). Keep this in mind or use the
eol-style property of subversion to ensure that line endings are correctly checked out on non-Windows systems.
Paths and system functions#
Avoid hardcoding e.g.
String tmp_dir = "/tmp";. This will fail on Windows. Use Qt’s
QDir to get a path to the systems
temporary directory if required.
Avoid names like uname which are only available on Linux.
When working with files or directories, it is usually safe to use “/” on all platforms. Take care of spaces in directory names though. Quote paths if they are used in a system call to ensure that the subsequent interpreter takes the spaced path as a single entity.
Where can I find the definition of the main page?#
Find a definition of the main page here.
Where can I add a new module?#
Add a new module here.
How is the parameter documentation for classes derived from DefaultParamHandler created?#
Add your class to the program
OpenMS/doc/doxygen/parameters/DefaultParamHandlerDocumenter.cpp. This program
generates a html table with the parameters. This table can then be included in the class documentation using the
@htmlinclude OpenMS_<class name>.parameters.
Parameter documentation is automatically generated for
TOPP included in the static
ToolHandler.cpp tools list.
To include TOPP parameter documentation use following
@htmlinclude TOPP_<tool name>.parameters
Test if everything worked by calling
make doc_param_internal. The parameters documentation is written to
How is the command line documentation for TOPP tools created?#
OpenMS/doc/doxygen/parameters/TOPPDocumenter.cpp creates the command line documentation for all classes
that are included in the static
ToolHandler.cpp tools list. It can be included in the documentation using the
@verbinclude TOPP_<tool name>.cli
Test if everything worked by calling
make doc_param_internal. The command line documentation is written to
How to contribute a bug fix?#
How can I profile my code?#
IBM’s profiler, available for all platforms (and free for academic use): Purify(Plus) and/or Quantify.
Windows: this is directly supported by Visual Studio (Depending on the edition: Team and above). Follow their documentation.
Build OpenMS in debug mode (set
Call the executable with valgrind:
Other processes running on the same machine can influence the profiling. Make sure your application gets enough resources (memory, CPU time).
Start and stop the profiling while the executable is running e.g. to skip initialization steps:
Start valgrind with the option
callgrind -i [on|off]to start/stop the profiling.
The output can be viewed with
(Linux) How do I check my code for memory leaks?#
Build OpenMS in debug mode (set
Call the executable with
valgrind: valgrind --suppressions=OpenMS/tools/valgrind/openms_external.supp –leak-check=full <executable> <parameters>.
Common errors are:
'Invalid write/read ...'- Violation of container boundaries.
'... depends on uninitialized variable'- Uninitialized variables:
'... definitely lost'- Memory leak that has to be fixed
'... possibly lost'- Possible memory leak, so have a look at the code
For more information see the
valgrind documentation .