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
Next revision Both sides next revision
dev:eclipse [2013/12/17 00:23]
tedfelix [Ubuntu 12.04-13.04 Issues] Expand to 13.10
dev:eclipse [2018/07/01 23:29]
tedfelix [Auto-Save Before Build]
Line 1: Line 1:
 ====== Using the Eclipse IDE to work on Rosegarden ====== ====== Using the Eclipse IDE to work on Rosegarden ======
 +
 +===== Older Versions =====
 +
 +These instructions are for the cmake build system introduced November 2015.
 +
 +Instructions for working with older versions of Rosegarden can be found on these pages:
 +
 +  * [[dev:eclipse-201510|Instructions for the autotools build system prior to November 2015]]
  
 ===== Get Rosegarden Source From SVN ===== ===== Get Rosegarden Source From SVN =====
Line 18: Line 26:
  
 ===== Get Dependencies ===== ===== Get Dependencies =====
-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 should get you very close to being able to build.+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.
  
 +For build-dep's to work, you'll need to add the appropriate source repo URIs to your sources.list.  The easiest way is to use synaptic.
 +
 +  - Launch synaptic.  Install it if you need to.
 +  - Go to Settings > Repositories
 +  - Click the Source Code checkbox.  It will display a dash.
 +  - Close.
 +
 +//Note: Ubuntu 17.10 required "xhost +si:localuser:root" before synaptic would run as root.//
 +
 +At this point the instructions are slightly different for jack1 vs. jack2.
 +
 +If you are using jack2:
 +
 +  $ sudo apt-get install libjack-jackd2-dev
   $ sudo apt-get build-dep rosegarden   $ sudo apt-get build-dep rosegarden
  
-===== Configure and Build ===== +If you are using jack1, this should work: 
-Now it's time to try configuring the Rosegarden source.  First we need to get everything set up to run configure:+ 
 +  $ sudo apt-get build-dep rosegarden 
 + 
 +...and you should be ready to build. 
 + 
 +===== Build =====
  
-  $ make distclean+//Note 11/21/2015: For the cmake build system prior to r14351, you must run the make-lrelease script manually at this point://
  
-It's ok if you get an error about "no makefile" on the previous step.+  $ scripts/make-lrelease
  
-  $ sh ./bootstrap.sh+//See [[https://sourceforge.net/p/rosegarden/mailman/message/34620543/|cmake and *.qm files]] on the dev mailing list.  The message you might see if this step is forgotten: "No rule to make target '../data/./locale/ca.qm', needed by 'src/qrc_data.cxx' Stop."//
  
-Now we should be able to run configure.  Here'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:+Now it'time to try building the Rosegarden source with cmake.  First, create a build directory and switch into it:
  
-  $ ./configure --enable-debug --with-qtlibdir=/usr/lib/i386-linux-gnu+  $ mkdir build 
 +  $ cd build
  
-With 64-bit (amd64) versions of Ubuntu:+Then run cmake:
  
-  $ ./configure --enable-debug --with-qtlibdir=/usr/lib/x86_64-linux-gnu+  $ cmake .. -DCMAKE_BUILD_TYPE=Debug
  
-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:+There may be errors when you run cmake due to missing libraries.  You'll need to track those down and re-run cmake.  Once cmake has run successfully to completion, you can build Rosegarden with make:
  
   $ make   $ make
Line 47: Line 75:
   $ ./rosegarden   $ ./rosegarden
  
-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 simulataneously:+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:
  
   export MAKEFLAGS="-j `nproc`"   export MAKEFLAGS="-j `nproc`"
Line 53: Line 81:
 This will take effect the next time you start a terminal.  It should speed up the build significantly. This will take effect the next time you start a terminal.  It should speed up the build significantly.
  
-If you just need to build Rosegarden, you can stop here.  Otherwise, if you are interested in doing some development with Eclipseread on....+If you are doing a lot of development, consider adding this to your .bashrc file:
  
 +  export QT_FATAL_WARNINGS=1
 +
 +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.
 +
 +If you just need to build Rosegarden, you can stop here.  Otherwise, if you are interested in doing some development with Eclipse, read on....
 ===== Install Eclipse ===== ===== Install Eclipse =====
 The Eclipse IDE can be downloaded here: http://www.eclipse.org/ The Eclipse IDE can be downloaded here: http://www.eclipse.org/
Line 63: Line 96:
  
 ===== Set Up Rosegarden Source Under Eclipse ===== ===== Set Up Rosegarden Source Under Eclipse =====
-//Note: These instructions were developed using Eclipse 4.(Kepler).//+//Note: These instructions were developed using Eclipse 4.(Oxygen).//
  
-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.  On the far right is a button for the "Workbench" Click it.+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.
  
-Go to File > New > Makefile Project with Existing Code.  In the "Project Name" field type rosegarden-svn.  For the "Existing Code Location" provide 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).+Go to File > New > Makefile Project with Existing Code.  In the "Project Name" field type rosegarden-svn.  For the "Existing Code Location" provide the path to the rosegarden-svn directory.  In the Toolchain list, select "Linux GCC" Click Finish.
  
-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" 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.+Next, Eclipse needs to know where the build directory is.  Select the project (rosegarden-svn) 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-svn 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: 
 + 
 +  ${workspace_loc:/rosegarden-svn}/build 
 + 
 +Click "Apply and Close" to close the project properties dialog. 
 + 
 +You should now be able to build with Project > Build All (Ctrl+B). 
 + 
 +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-svn" In the C/C++ Application field, use the Search Project... button to select "rosegarden".  "build/rosegarden" will appear in the field.  In the Environment tab, you'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. 
 + 
 +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. 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 =====+===== 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-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: 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:
  
Line 81: Line 124:
   /usr/include/qt4/QtXml   /usr/include/qt4/QtXml
  
-Click Ok.  When asked if you "wish to rebuild" the indexclick "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.+Note: For Qt5, the paths are slightly different: 
 + 
 +  /usr/include/x86_64-linux-gnu/qt5 
 +  etc... 
 + 
 +Next, click on the # Symbols tab.  Verify that "GNU C++is still selected.  In the Symbol boxadd the following symbols and values: 
 + 
 +  HAVE_ALSA     1 
 +  HAVE_LIBJACK 
 + 
 +Click "Apply and Close"
 + 
 +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-svn in the Project Explorer and select Index > Rebuild.  (This can also be accessed from the main menu: Project > C/C++ Index > Rebuild.) 
 + 
 +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 88: Line 145:
 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.
  
 ===== Faster Builds ===== ===== Faster Builds =====
-If your machine has multiple cores and/or hyperthreading, you'll want to set up make for multiple jobs (make's -j option).  To do that within Eclipse, go to Window > Preferences > C/C++ > Build > Environment, add an environment variable MAKEFLAGS, and set it to "-j 4" (or whatever is best for your hardware, the nprocs command will tell you how many cores you've got).  This will tell make that it can run four simultaneous compiles.+If your machine has multiple cores and/or hyperthreading, you'll want to set up make for multiple jobs (make's -j option).  To do that within Eclipse, go to Window > Preferences > C/C++ > Build > Environment, add an environment variable MAKEFLAGS, and set it to "-j4" (or whatever is best for your hardware, the ''nproc'' command will tell you how many cores you've got).  This will tell make that it can run four simultaneous compiles.
  
 ===== Scalability Mode ===== ===== Scalability Mode =====
Line 99: Line 156:
  
 ===== 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 build" checkbox.  This avoids build errors if you forget to save a file that you've changed
 + 
 +===== Unlimited 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"
 + 
 +===== 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 =====
Line 113: Line 176:
   rosegarden-workspace/rosegarden-svn/.settings   rosegarden-workspace/rosegarden-svn/.settings
  
-===== Ubuntu 12.04-13.10 Issues =====+===== Ubuntu Unity Icon ===== 
 +There appear to be two main ways to create an application icon in the Unity dash.  The easiest is to create an eclipse.desktop file.  The other way involves installing a GUI tool and using it.
  
-==== Unity Icon ==== +==== eclipse.desktop ==== 
-It appears that adding an icon to the dash still requires gnome-desktop-item-edit.  See the "Unity Icon" section in the "Ubuntu 11.10 Issues" below for details.+Applications appear in the Unity dash based on .desktop files found in /usr/share/applications.  Here's a sample /usr/share/applications/eclipse.desktop file for Eclipse:
  
-===== Ubuntu 11.10 Issues =====+  [Desktop Entry] 
 +  Type=Application 
 +  Name=Eclipse CDT 
 +  Comment=Eclipse IDE for C/C++ 
 +  Icon=<path-to-eclipse>/icon.xpm 
 +  Exec=<path-to-eclipse>/eclipse 
 +  Terminal=false 
 +  Categories=Development 
 + 
 +You'll need to adjust the "<path-to-eclipse>" to point to where you expanded Eclipse. 
 + 
 +==== GUI ==== 
 +If you prefer a GUI, you can try the GNOME desktop item editor: 
 + 
 +  sudo apt-get install gnome-panel 
 +  sudo gnome-desktop-item-edit /usr/share/applications --create-new 
 + 
 +Give it the name "Eclipse" Point it to the eclipse binary in the eclipse install directory.  And finally, use the icon that is in the eclipse install directory.  Click close, and Eclipse will now appear in the dash. 
 + 
 +For more details, check out the following links: 
 +  * http://help.ubuntu.com/community/UnityLaunchersAndDesktopFiles 
 +  * 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 ====+===== Black on Black Tooltips (Ubuntu 11.10) =====
  
 When you hover over an identifier in Eclipse, you'll get a tooltip that provides some helpful information about that identifier.  However, with Ubuntu 11.10's Ambiance theme, the tooltip background color is black, and Eclipse doesn't handle this correctly.  It tries to display black-on-black text, which is just a little tough to read. When you hover over an identifier in Eclipse, you'll get a tooltip that provides some helpful information about that identifier.  However, with Ubuntu 11.10's Ambiance theme, the tooltip background color is black, and Eclipse doesn't handle this correctly.  It tries to display black-on-black text, which is just a little tough to read.
Line 142: Line 233:
   * http://askubuntu.com/questions/70599/how-to-change-tooltip-background-color-in-unity   * http://askubuntu.com/questions/70599/how-to-change-tooltip-background-color-in-unity
  
-==== Unity Icon ==== 
- 
-There appear to be two main ways to create a Unity icon for an application.  The first uses a GUI, and the second involves creating an eclipse.desktop file.  Apparently there is no native "Unity" way to add an icon to Unity. 
- 
-=== GUI === 
-The GUI approach uses the GNOME desktop item editor: 
- 
-  sudo apt-get install gnome-panel 
-  sudo gnome-desktop-item-edit /usr/share/applications --create-new 
- 
-Give it the name "Eclipse" Point it to the eclipse binary in the eclipse install directory.  And finally, use the icon that is in the eclipse install directory.  Click close, and Eclipse will now appear in the dash.  You can even drag and drop it onto the launcher if you wish. 
- 
-=== eclipse.desktop === 
-You can also just create an eclipse.desktop file in /usr/share/applications instead of installing all of the above GUI tools.  Here's mine: 
- 
-  [Desktop Entry] 
-  Type=Application 
-  Name=Eclipse CDT 
-  Comment=Eclipse IDE for C/C++ 
-  Icon=<path-to-eclipse>/icon.xpm 
-  Exec=<path-to-eclipse>/eclipse 
-  Terminal=false 
-  Categories=Development 
- 
-You'll need to adjust the "<path-to-eclipse>" to point to where you expanded Eclipse. 
- 
-=== More Ways === 
-There are several other ways to add an application to the dash.  See this page for more: 
- 
-http://askubuntu.com/questions/67753/how-do-i-add-an-application-to-the-dash 
 
 
dev/eclipse.txt · Last modified: 2024/01/05 00:38 by tedfelix
Recent changes RSS feed Creative Commons License Valid XHTML 1.0 Valid CSS Driven by DokuWiki