Developing Giac with Qt Creator
About one year ago I managed to find a way to debug the computer algebra system Giac by using a modern IDE. The only problem was that CLion is not free software, you need to pay for it if you want to use it regularly.
While working hard on preparing XaoS 4.0 I learned a lot about Qt Creator, another modern IDE. Luckily, it can be configured to import Giac's source code in a quite convenient way. In this blog entry I give summary on the required steps.
From now on, debugging is very simple, in the Debug menu all usual tasks can be simply performed, also shortcuts are working, e.g. F10 for Step Over, F11 for Step Into and so on.
While working hard on preparing XaoS 4.0 I learned a lot about Qt Creator, another modern IDE. Luckily, it can be configured to import Giac's source code in a quite convenient way. In this blog entry I give summary on the required steps.
- Start Qt Creator.
- Click on +New Project, choose the template Import Project and choose Subversion Checkout.
- Set Location > Repository to https://dev.geogebra.org/svn/trunk/geogebra. Set an existing path at Path (say, /home/YOUR_USERNAME) and give a name for a newly created folder (say, geogebra). Then check out the sources. Qt Creator will complain about a problem that it is impossible open the project. Simply ignore it, we managed to download the sources, that's OK. (In fact, the sources can be downloaded simply by running a Subversion command, so we actually do not need steps 2 and 3, they can be substituted by another tool.)
- Click on Open Project and open /home/YOUR_USERNAME/geogebra/giac/CMakeLists.txt. Then simply click on Configure Project.
- Click on Projects > Build & Run > Desktop > Run and tick Run in terminal. Now you should be able to run the project by pressing Ctrl-R.
- The compilation may take a while. You can see the progress when clicking on the Issues tab at the bottom. When the compilation finishes a terminal window will be opened and you can type 1+2 Return and then get the output 3. Ctrl-D and then Return will close the window.
- To debug your code go to Projects > Build & Run > Desktop > Build and select Edit build configuration > Debug. Now you are ready to set a breakpoint somewhere, e.g. on line 25 in minigiac.cc, press F5 and start a build that enables debugging.
From now on, debugging is very simple, in the Debug menu all usual tasks can be simply performed, also shortcuts are working, e.g. F10 for Step Over, F11 for Step Into and so on.
Comments