Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
dev:eclipse [2014/12/17 15:13]
tedfelix Add QT_FATAL_WARNINGS info
dev:eclipse [2024/01/05 00:38] (current)
tedfelix [Include Files and Symbols]
Line 1: Line 1:
 ====== Using the Eclipse IDE to work on Rosegarden ====== ====== Using the Eclipse IDE to work on Rosegarden ======
  
-===== Get Rosegarden Source From SVN =====+===== Older Versions =====
  
-To get started we'll need the source code for Rosegarden.  We can get a copy of it from sourceforge using subversion (svn).  Since we are going to use the source with Eclipse, we'll need to make sure that we set up the directories in a way that will make Eclipse happy.+These instructions are for the cmake build system introduced November 2015.
  
-Eclipse likes to have a directory for its "workspace" and a directory within the workspace for the "project" So I usually create a workspace directory like this:+Instructions for working with older versions of Rosegarden can be found on these pages:
  
-  $ mkdir rosegarden-workspace+  * [[dev:eclipse-201510|Instructions for the autotools build system prior to November 2015]]
  
-Then I get the source into a directory within the workspace dir:+===== Building Rosegarden from Source =====
  
-  $ cd rosegarden-workspace +Follow the steps on the [[dev:Building Rosegarden from Source]] page to get a copy of the source to work with.
-  $ svn checkout svn+ssh://userid@svn.code.sf.net/p/rosegarden/code/trunk/rosegarden rosegarden-svn +
-  $ cd rosegarden-svn+
  
-Replace "userid" with your sourceforge user ID.  See the [[dev:subversion|subversion quick start]] for more ways to download.+===== Install Eclipse =====
  
-===== Get Dependencies ===== +The Eclipse IDE can be downloaded here: http://www.eclipse.org/
-In order to successfully build Rosegarden, there are a number of libraries you'll need If you are using a distro with apt (Ubuntu, Debian...), you can try getting the build-dep's for Rosegarden.  This might work for you, so try it first:+
  
-  $ sudo apt-get build-dep rosegarden+I download the Linux C/C++ version which is usually called something like "Eclipse IDE for C/C++ Developers" It's just a tarball you can expand and then look for the "eclipse" directory with the "eclipse" binary.  That's pretty much it.
  
-In Ubuntu I get this error because I am using jack2:+//NOTEIf you upgrade your OS, it's a good idea to wipe out your Eclipse install and start fresh.  There are config files within the Eclipse install directory that can get out of sync and cause trouble with a new OS.//
  
-  The following packages have unmet dependencies: +===== Set Up Rosegarden Source Under Eclipse =====
-   libjack-dev : Depends: libjack0 (1:0.124.1+20140122git5013bed0-3) but it is not going to be installed +
-  E: Build-dependencies for rosegarden could not be satisfied.+
  
-If you get the same, try this:+//NoteThese instructions were developed using Eclipse 2021-03 (4.19.0).//
  
-  $ sudo apt-get install libjack-jackd2-dev +Eclipse prefers a directory structure with a top level for the workspace and a lower level for the project.  Something like this:
-  $ sudo apt-get build-dep rosegarden+
  
-...and you should be ready to build.+  rosegarden-workspace/rosegarden-git
  
-===== Configure and Build ===== +So, you'll want to create a new rosegarden-workspace directory and move rosegarden-git into it.  Assuming you are in rosegarden-git:
-Now it's time to try configuring the Rosegarden source.  First we need to get everything set up to run configure:+
  
-  $ make distclean+  $ pwd 
 +  /home/ted/rosegarden-git 
 +  $ cd .. 
 +  $ mkdir rosegarden-workspace 
 +  $ mv rosegarden-git rosegarden-workspace
  
-It's ok if you get an error about "no makefile" on the previous step.+Unfortunately, that makes a mess of cmake, so we'll need to delete any build directory and re-run cmake...
  
-  $ sh ./bootstrap.sh+  $ cd rosegarden-workspace/rosegarden-git 
 +  $ rm -rf build 
 +  $ mkdir build 
 +  $ cd build 
 +  $ cmake .-DCMAKE_BUILD_TYPE=Debug
  
-Now we should be able to run configure Here's how I run it with 32-bit (i386) versions of Ubuntu.  I need the "--with-qtlibdir" option because Ubuntu puts the Qt libraries in an architecture-specific location:+And now we are ready to create an Eclipse workspace and project around this directory structure.
  
-  $ ./configure --enable-debug --with-qtlibdir=/usr/lib/i386-linux-gnu+Launch Eclipse It will first ask for the location of your workspace.  Give it the rosegarden-workspace directory that we just created.  Since this is a new workspace, you'll get the Eclipse welcome screen.  In the upper right is a button that says "Hide" (formerly "Workbench").  Click it.
  
-With 64-bit (amd64) versions of Ubuntu:+Go to File > New > Makefile Project with Existing Code.  In the "Project Name" field type rosegarden-git.  For the "Existing Code Location" provide the path to the rosegarden-git directory.  In the Toolchain list, select "Linux GCC" Click Finish.
  
-  $ ./configure --enable-debug --with-qtlibdir=/usr/lib/x86_64-linux-gnu+Next, Eclipse needs to know where the build directory is Select the project (rosegarden-git) in the Project Explorer on the left side then go to Project > Properties.  (There's a bug in Eclipse where sometimes this menu item is disabled.  Right-clicking on rosegarden-git and picking Properties works too.)  Select "C/C++ Build" on the left side.  In the "Build directory:" field, add "build" to the end.  The final value should be:
  
-There may be errors when you run configure due to missing libraries.  You'll need to track those down and re-run configure.  Once configure has run successfully to completion, you can build Rosegarden with make:+  ${workspace_loc:/rosegarden-git}/build
  
-  $ make+Click "Apply and Close" to close the project properties dialog.
  
-To make sure the build was successful, try running it:+You should now be able to build with Project > Build All (Ctrl+B).
  
-  $ ./rosegarden+To run the program, you'll need to set up a Run Configuration Go to Run > Run Configurations.  Select "C/C++ Application" and hit the New button.  In the Project field, use the Browse... button to select "rosegarden-git" In the C/C++ Application field, use the Search Project... button to select "rosegarden" "build/rosegarden" will appear in the field.
  
-If you have a machine with multiple cores (who doesn't these days?) you probably want to add this to the end of your .bashrc file to tell make that it can run multiple jobs simultaneously:+In the Environment tab, you //may// want to add QT_FATAL_WARNINGS and set it to 1 so that Rosegarden will crash on signal/slot naming errors and other issues that can only be checked at runtime.  //[In Ubuntu 20.04 I'm getting harmless Xcb warnings in the Matrix editor that cause Rosegarden to crash.  Removing QT_FATAL_WARNINGS for now.  Retest at the next Ubuntu LTS release.]//
  
-  export MAKEFLAGS="-j `nproc`" +Click Run to test.  You should now be able to run with Run > Run (Ctrl+F11).  You should also be able to debug with F11 or Run > Debug.
-   +
-This will take effect the next time you start a terminal.  It should speed up the build significantly.+
  
-If you are doing a lot of developmentconsider adding this to your .bashrc file:+If you get an error about "The selection cannot be launched, and there are no recent launches," you need to go back into the Run Configuration and hit the Run button in there to establish the first run.  That will then be used each time F11 or Ctrl-F11 are pressed.
  
-  export QT_FATAL_WARNINGS=1+===== Include Files and Symbols ===== 
 +To make sure Eclipse is aware of the various Qt include files, we need to tell Eclipse where the Qt includes are located.  Select the "rosegarden-git" project in the Project Explorer and go to File > Properties.  In the "type filter text" box, type "paths" and hit enter.  This should get you quickly to Paths and Symbols.  Click on the "Includes" tab and then the "GNU C++" language.  In the "Include directories" box, add the following:
  
-This will make sure any Qt warnings stop the run so you will notice them and fix them.  This is really helpful when working with signals and slots since the compiler has no idea whether the names of signals and slots actually exist.  Downside: there is a slight chance that this will cause Qt apps (built in debug mode) to crash when run from the command line.+  /usr/include/x86_64-linux-gnu/qt5 
 +  /usr/include/x86_64-linux-gnu/qt5/QtCore 
 +  /usr/include/x86_64-linux-gnu/qt5/QtGui 
 +  /usr/include/x86_64-linux-gnu/qt5/QtNetwork 
 +  /usr/include/x86_64-linux-gnu/qt5/QtPrintSupport 
 +  /usr/include/x86_64-linux-gnu/qt5/QtTest 
 +  /usr/include/x86_64-linux-gnu/qt5/QtXml 
 +  /usr/include/x86_64-linux-gnu/qt5/QtWidgets
  
-If you just need to build Rosegarden, you can stop here.  Otherwise, if you are interested in doing some development with Eclipse, read on....+You'll likely also want to add this non-Qt5 path:
  
-===== Install Eclipse ===== +  /usr/include/lilv-0
-The Eclipse IDE can be downloaded here: http://www.eclipse.org/+
  
-I download the Linux C/C++ version which is usually called something like "Eclipse IDE for C/C++ Developers".  It's just a tarball you can expand and then look for the "eclipse" directory with the "eclipse" binary.  That's pretty much it.+Next, click on the # Symbols tab.  Verify that "GNU C++" is still selected.  In the Symbol box, add the following symbols and values:
  
-//NOTE: If you upgrade your OS, it's a good idea to wipe out your Eclipse install and start fresh.  There are config files within the Eclipse install directory that can get out of sync and cause trouble with a new OS.//+  HAVE_ALSA     1 
 +  HAVE_LIBJACK  1
  
-===== Set Up Rosegarden Source Under Eclipse ===== +Click "Apply and Close".
-//Note: These instructions were developed using Eclipse 4.4 (Luna).//+
  
-Since we set up the directory structure in a way that Eclipse likes, getting Eclipse to find the source and work with it is easy.  Launch Eclipse.  It will first ask for the location of your workspace.  Give it the rosegarden-workspace directory that we created earlier.  Since this is a new workspace, you'll get the Eclipse welcome screen.  In the upper right is a button for the "Workbench" Click it.+At this point you'll want to rebuild the index.  (Versions prior to Neon would prompt at this point.  In case yours doesn't... Right click on rosegarden-git in the Project Explorer and select Index > Rebuild.  (This can also be accessed from the main menu: Project > C/C++ Index > Rebuild.)
  
-Go to File > New > Makefile Project with Existing Code.  In the "Project Name" field type rosegarden-svn.  For the "Existing Code Locationprovide the path to the rosegarden-svn directory.  In the Toolchain list, select "Linux GCC" Click Finish.  You should now be able to build with Project > Build All (Ctrl+B).+It will take some time for Eclipse to rebuild the index.  The "C/C++ Indexerindicator at the bottom of the window will let you know how far along the process is.
  
-To run the program, you'll need to set up a Run Configuration.  Go to Run > Run Configurations.  Select "C/C++ Application" and hit the New button.  Verify that the C/C++ Application field says "rosegarden"and the Project field says "rosegarden-svn" In the Environment tabyou'll want to add QT_FATAL_WARNINGS and set it to 1 so that Rosegarden will crash on signal/slot naming errors and other issues that can only be checked at runtime. +//Note: Qt4 is deprecatedbut for reference, the include directories were://
- +
-Click Run to test.  You should now be able to run with Run > Run (Ctrl+F11).  You should also be able to debug with F11 or Run > Debug. +
- +
-If you get an error about "The selection cannot be launched, and there are no recent launches," you need to go back into the Run Configuration and hit the Run button in there to establish the first run.  That will then be used each time F11 or Ctrl-F11 are pressed. +
- +
-===== Include Files ===== +
-To make sure Eclipse is aware of the various Qt include files, we need to tell Eclipse where the Qt includes are located.  Select the "rosegarden-svn" project in the Project Explorer and go to File > Properties.  In the "type filter text" box, type "paths" and hit enter.  This should get you quickly to Paths and Symbols.  Click on the "Includes" tab and then the "GNU C++" language.  In the "Include directories" box, add the following:+
  
   /usr/include/qt4   /usr/include/qt4
Line 102: Line 101:
   /usr/include/qt4/QtXml   /usr/include/qt4/QtXml
  
-Click Ok.  When asked if you "wish to rebuild" the index, click "Yes" It will take some time for Eclipse to rebuild the index.  The "C/C++ Indexer" indicator at the bottom of the window will let you know how far along the process is. 
  
 ===== Configuring Tabs ===== ===== Configuring Tabs =====
Line 109: Line 107:
 First, the editor.  Go to Window > Preferences > General > Editors > Text Editors.  Here you will find an "Insert spaces for tabs" checkbox.  Make sure it is checked. First, the editor.  Go to Window > Preferences > General > Editors > Text Editors.  Here you will find an "Insert spaces for tabs" checkbox.  Make sure it is checked.
  
-Second, the code formatter.  Go to Window > Preferences > C/C++ > Code Style > Formatter.  Make sure the "Profile name" is "K&R [built-in]" Click on the "Edit..." button next to the profile name.  In the Indentation tab, set "Tab policy" to "Spaces only" Change the "Profile name" to "K&R with spaces" Click on Ok and Ok.+Second, the code formatter.  Go to Window > Preferences > C/C++ > Code Style > Formatter.  Make sure the "Profile name" is "K&R [built-in]" Click on the "Edit..." button next to the profile name.  In the Indentation tab, set "Tab policy" to "Spaces only" Change the "Profile name" to "K&R with spaces" Click on Ok and "Apply and Close".
  
 Now all your tabs will be spaces. Now all your tabs will be spaces.
Line 120: Line 118:
  
 ===== Auto-Save Before Build ===== ===== Auto-Save Before Build =====
-By default, Eclipse doesn't automatically save your files when you build.  If you would prefer that behavior, go to Window > Preferences > General > Workspace.  Set the "Save automatically before build" checkbox.  This avoids build errors if you forget to save a file that you've changed.+By default, Eclipse doesn't automatically save your files when you build.  If you would prefer that behavior, go to Window > Preferences > General > Workspace > Build.  Set the "Save automatically before manual build" checkbox.  This avoids build errors if you forget to save a file that you've changed.
  
-===== Unlimited Console Buffer =====+===== Unlimited Run Console Buffer =====
 By default, Eclipse limits debug console output to 80,000 bytes.  Rosegarden generates a lot of debug output.  It's a good idea to turn this limit off.  Go to Window > Preferences > Run/Debug > Console.  Uncheck "Limit console output". By default, Eclipse limits debug console output to 80,000 bytes.  Rosegarden generates a lot of debug output.  It's a good idea to turn this limit off.  Go to Window > Preferences > Run/Debug > Console.  Uncheck "Limit console output".
 +
 +===== Massive Build Console Buffer =====
 +By default, Eclipse limits build console output to 500 lines.  This is not sufficient when things go wrong in template-land.  Go to Window > Preferences > C/C++ > Build > Console.  In the "Limit console output (number of lines)" field, enter 50000.
 +
 +===== Search Editor Reuse =====
 +By default, Eclipse reuses the current editor window when you double-click on a search result.  That means you might lose what you were looking at.  To turn this off, go to Window > Preferences > General > Search.  Uncheck "Reuse editors to show matches".
  
 ===== Upgrade Notes ===== ===== Upgrade Notes =====
-When upgrading to a new version of eclipse, it's a good idea to delete all the Eclipse config files in your workspace and project so the new version can start fresh.  You'll have to go through all the configuration again, but things should be a bit more stable.  Key things to delete for the Indigo to Juno upgrade:+When upgrading to a new version of eclipse, it's a good idea to delete all the Eclipse config files in your workspace and project so the new version can start fresh.  You'll have to go through all the configuration again, but things should be a bit more stable.  Here's a list of key things to delete.  
 + Some of these might not exist depending on which version of Eclipse you are using.
  
   rosegarden-workspace/.metadata   rosegarden-workspace/.metadata
   rosegarden-workspace/RemoteSystemsTempFiles   rosegarden-workspace/RemoteSystemsTempFiles
-  rosegarden-workspace/rosegarden-svn/.cproject +  rosegarden-workspace/rosegarden-git/.cproject 
-  rosegarden-workspace/rosegarden-svn/.project +  rosegarden-workspace/rosegarden-git/.project 
- +  rosegarden-workspace/rosegarden-git/.settings
-Juno to Kepler had the same files and directories to delete along with a new one: +
- +
-  rosegarden-workspace/rosegarden-svn/.settings+
  
 ===== Ubuntu Unity Icon ===== ===== Ubuntu Unity Icon =====
Line 165: Line 167:
   * http://help.ubuntu.com/community/UnityLaunchersAndDesktopFiles   * http://help.ubuntu.com/community/UnityLaunchersAndDesktopFiles
   * http://askubuntu.com/questions/67753/how-do-i-add-an-application-to-the-dash   * http://askubuntu.com/questions/67753/how-do-i-add-an-application-to-the-dash
 +
 +===== High CPU Usage (Ubuntu 16.04 and Eclipse Mars) =====
 +
 +This is a known issue with gtk3.  Solution is to fall back to gtk2:
 +
 +https://bugs.launchpad.net/ubuntu/+source/java-common/+bug/1552764
  
 ===== Black on Black Tooltips (Ubuntu 11.10) ===== ===== Black on Black Tooltips (Ubuntu 11.10) =====
 
 
dev/eclipse.1418829223.txt.gz · Last modified: 2022/05/06 16:07 (external edit)
Recent changes RSS feed Creative Commons License Valid XHTML 1.0 Valid CSS Driven by DokuWiki