NetBeans

From Apertium
Jump to: navigation, search

If you want to work with the Apertium native core tools, but you really don't want to go through the arduous process of command line debugging, you can instead use a combination of initial command line setup and then have NetBeans take over.

Paths are going to reference /home/tino/Desktop as that is where I tested this. Substitute with your own paths.

[edit] NetBeans

First thing you need is to install NetBeans from somewhere. If on Debian/Ubuntu, sudo apt-get install netbeans will do. Once installed, you probably need to add the C/C++ plugin.

From Tools → Plugins:

  • In the Settings tab, enable all Update Centers.
  • Then in Available Plugins, hit "Check for Newest" and find the C/C++ plugin.
  • Then in Updates, hit "Check for Updates" and update all available plugins.

[edit] Lttoolbox

Initial command line setup:

svn co https://svn.code.sf.net/p/apertium/svn/trunk/lttoolbox
cd lttoolbox
autoreconf -fi
./configure --enable-debug

Then from NetBeans, File → New Project → C/C++ → C/C++ Project with Existing Sources:

Netbeans-20-new.png

Next, Browse to the folder that has the project's configure.ac file. Leave everything else as-is and Finish:

Netbeans-30-new.png

From Project Properties, in the Build → Make foldout, adjust the Build Command with more -j if you want, and set the Build Result to the executable you want to debug. Make sure to select the actual binary from .libs and not the wrapper script:

Lttoolbox-20-make.png

Then from Run, adjust the Environment by adding LD_LIBRARY_PATH pointing to the .libs folder that has the built libraries:

Lttoolbox-30-run.png

Also adjust the Run Command to pass it the arguments and files you need. In order to echo input directly to the command, instead append to the Run Command as a redirect file like <(echo "input goes here")

And you're good to go. You should now be able to run, debug, set breakpoints, inspect state, and everything else you expect from working with an IDE.

[edit] Apertium

Initial command line setup. Since we do not make install anything, we need to define the APERTIUM_* envvars manually:

svn co https://svn.code.sf.net/p/apertium/svn/trunk/apertium
cd apertium
autoreconf -fi
export 'APERTIUM_CFLAGS=-I/home/tino/Desktop/lttoolbox/ -I/usr/include/libxml2/'
export 'APERTIUM_LIBS=-L/home/tino/Desktop/lttoolbox/lttoolbox/.libs/ -llttoolbox3'
./configure --enable-debug

Proceed similarly to lttoolbox by creating the project with existing sources, and selecting the binary to debug.

Apertium-20-make.png

Then from Run, adjust the Environment by adding LD_LIBRARY_PATH pointing to both the lttoolbox and apertium .libs folder that has the built libraries, and setting LC_ALL to a UTF-8 capable locale:

Apertium-40-env.png

Also adjust the Run Command to what you actually want to debug:

Apertium-30-run.png
Personal tools