Development/IDE

From The Document Foundation Wiki
Jump to: navigation, search

Introduction

You can use several IDEs to work on LibreOffice. This page describes how to use them.

The script to generate these IDE projects is in bin/gbuild-to-ide. You are welcome to adopt the script to support more IDEs!

Im-jabber.svg

Note:
Before using an IDE you need to do a complete build from a terminal with the usual "./autogen.sh && make check".

Visual Studio Code (VSCode)

  1. Install the C/C++ extension provided by Microsoft (ms-vscode.cpptools), see also.
  2. Add a new debug configuration by clicking Debug -> Add Configuration and select C++ (GDB/LLDB) as the environment.
  3. It will automatically create a launch.json configuration for debugging. we just have to adjust the paths a bit. It should look similar to this (adjusted to your system and setup):
    {
        "version": "0.2.0",
        "configurations": [
    
            {
                "name": "(gdb) Launch",
                "type": "cppdbg",
                "request": "launch",
                "program": "${workspaceRoot}/instdir/program/soffice.bin",
                "additionalSOLibSearchPath": "${workspaceRoot}/instdir/program",
                "args": [],
                "stopAtEntry": false,
                "cwd": "${workspaceRoot}/instdir/program",
                "externalConsole": true,
                "MIMode": "gdb",
                "miDebuggerPath": "/usr/bin/gdb",
                "setupCommands": [
                    {
                        "description": "Enable pretty-printing for gdb",
                        "text": "-enable-pretty-printing",
                        "ignoreFailures": true
                    }
                ]
            }
        ]
    }
    
  4. In case your desktop-environment is gnome, you may want to add this:
    "environment": [{"name":"SAL_USE_VCLPLUGIN","value":"gen"}]
    
    Look here for context.
  5. To get started with debugging, click Debug -> Start Debugging. Pretty printing should work, if you configured it for gdb in terminal correctly.

Note that the provided example configuration was created on a Linux-system, the steps to create a debug-configuration on Windows and macOS are very similar, as long as you use gdb/lldb. Furthermore read up on debugging C++ code with vscode and how to configure the launch.json configuration. For debugging with VSCode on Windows, see this paragraph.

KDevelop

make kdevelop-ide-integration

Then open one of the *.kdev4 projects with KDevelop.

The following video explains the KDevelop IDE Integration:

A shorter teaser version of this video (for sharing on social media etc.) is also available.

Qt Creator

make qtcreator-ide-integration

Microsoft Visual Studio

Im-jabber.svg

Note:
You need to build with --enable-debug in order to generate the Visual Studio IDE integration.

Im-jabber.svg

Note:
Some problems with some "make" versions have been reported, it would be great if somebody had time to investigate that and figure out how it can be avoided and add instructions here: http://nabble.documentfoundation.org/Error-building-Visual-Studio-2013-project-file-for-LibreOffice-on-Windows-tp4140307p4140941.html

For Visual Studio 2013:

make vs2013-ide-integration

For Visual Studio 2015:

make vs2015-ide-integration

Vim

make vim-ide-integration

This generates a clang compilation database that can be used for YouCompleteMe.

Eclipse CDT

Work has started to generate Eclipse CDT project files, but not yet finished. Feel free to continue this.

In the meantime you can setup Eclipse CDT manually:

  1. Add new debug configuration (libreoffice).
  2. In Main tab-> C/C++ Application, browse soffice.bin file that should be in : {your build path}/libreoffice/instdir/program/soffice.bin. (Make sure you enabled debug in your build).
  3. In the project field, add libreoffice project.
  4. Click on "Select other" in the Debug configurations window.
  5. Check "Use configuration specific settings" and select "Standard Attach to Process Launcher".
  6. Make sure you have these parameters in the Debugger tab:
  • Debugger: gdb/mi
  • GDB debugger: gdb
  • GDB command file: .gdbinit.
  • GDB command set: Standard (Linux).
  • Protocol: mi.
  • Check "Use full file path to set breakpoints".
  1. Click on apply and close.
  2. Modify the debugger timeout to prevent this message when debugging: "Target is not responding (timed out)". Go to Window -> Preferences -> C/C++ -> Debug -> GDB MI and set the debugger timeout to 200000 ms and launch timeout to 300000 ms.
  3. If you're using Ubuntu, the last step before debugging libreoffice is modifying the ptrace_scope to make it less restrictive. That would prevent this message:

"Could not attach to process. If your uid matches the uid of the target process, check the setting of /proc/sys/kernel/yama/ptrace_scope, or try again as the root user. For more details, see /etc/sysctl.d/10-ptrace.conf". All you need is just setting ptrace_scope to 0 in /etc/sysctl.d/10-ptrace.conf.

  1. Enjoy the debug and add breakpoints in eclipse as well as you want.

XCode

make xcode-ide-integration

Others

There are other IDEs like Netbeans and CLion. Feel free to add support for them to gbuild-to-ide.

Debugging with a Graphical IDE on gnome

If you happen to work on Linux with gnome as your desktop environment and you are using a graphical IDE for debugging, you may run into the following issue: Gnome will popup a dialog, that LibreOffice has become unresponsive and present you with the option to either "Force Quit" or "Wait". However, after clicking "Wait", after a short time, the dialog will pop-up again. Additionally, the moment the dialog appears, your graphical IDE will become unresponsive to mouse-clicks until you click "Wait". This bug has been reported, but so far no fix has been provided, unfortunately. There is a little workaround, however:

Build LibreOffice with

--enable-dbgutil

and set

SAL_USE_VCLPLUGIN = gen

in your environment, before you start debugging. This should to the trick and let you debug to your heart's content.

Debugging the IDE Project Generator

You can dump the parse result of the the gbuild-to-ide script with:

make debug-ide-integration