Education Project/Effort/Various adaptations on Sugar/Work In Progress

From Apache OpenOffice Wiki
Jump to: navigation, search

@Adbdelkader and Thomas, please add there what you are currently doing

Means :

  • a list of tasks
  • the history
  • a planning
  • whatever information needed for the current work in progress, and who will be removed once put in a better shape elsewhere


First Objective : Compilation of OOo and OOo4Kids

After four days of desperate struggles with Ubuntu, packages and lack of space on the hard drive, both Abdelkader and myself have been able to generate and launch the makefile of OOo this afternoon. This will last the whole night, hopefully void of compilation error.

After 8 hours, the compilation ended for both of us.

Then, we had to compile OOo4Kids. We had a tough time getting past some errors, but they were almost all caused by using a wrong version of the sources so we had to apply a patch. After this, we had to build && deliver from the *new* scp2 directory but not to forget to make an "export PKGFORMAT="installed" (we went through some errors forgetting this). Then all we had to do was to make a dmake.

Then, we worked on a small installation problem on Linux. In fact, the installation directory have the pref, and it shouldn't. In the common_brand.scp (which is located in scp2/sources/ooo/) from line 829 to 843 we can see few conditions, depending the system, to put the things on the good place. It works well on Macsosx and Windows but it goes in the wrong place for linux, it hits the "StandaloneValue = "$ORIGIN/..". We don't really understand why yet but we will work on this later. Then, we tried some tests on OOo4Kids with valgrind, we saw some memory leaks and we will see about this.

The next step is for me to work on building OOo4Kids for Windows and work on the wiki page for this step and for Thomas to build OOo4Kids on Sugar.


IRC meeting / 17th July 2009

Attendees : Thomas Fontenay, Abdelkader Bellabes, Eric Bachard

Point 1 : what has been done

  • OOO build on Linux : verified OK
  • OOo4Kids build on Linux : verified OK
  • First steps in the source code
  • Started with Valgrind ( log of the leak ?)

Point 2 : Planning for the two coming weeks 30 and 31 ( 17th to 31st July) :

Action Items :

  • document the use of Valgrind
  • document the memory leak (supposed)

Objectives for the next two weeks are :

  • ( Abdelkader) setup Windows install set, and build OOo4Kids + complete the wiki page (OOo4Kids wiki page, Windows dedicated)
  • ( Thomas ): setup a Sugar set, and do the same

Objective : complete two builds in 2 differents OS's

  • start documenting Valgrind use
  • start working with gdb, in particular, be able to set breakpoints in 3 cases :
  1. at a given line
  2. using a given method
  3. when a condition is true

+ providing examples

(if time allows) Case study : catch and trace what happens when changing some color. e.g. changing the color of the background in a Writer document

Objective : trace and document

Scheduled : IRC meeting to make a point around the 3rd August

20/07/09-HOW TO : Crash OOo4Kids

Today, we have been working on watching when OOo4Kids was using a lot of the CPU's power. Going with this, we saw a few cases when it was maybe overdooing and some times crashed:

  -Using a special character and pasting it recklessly would end up with a crash.
  -On the same way, but without special chars (so that may be linked in a way), OOo4Kids is in some cases stopping and you have to go to the next line to be able to put an other char, or in other cases, it's not responding anymore.

Some other cases of huge delay/crashes:

   -In OOo4Kids Writer : fill one page of text, copy it. Paste it, again, again, ag... Around page 15, pasting will stop and the user is unable to write anymore. From this point on, OOo4Kids become extremely unstable, and will crash if you erase the last character written and try to write something else, select a different font...
   -Everything that is "drag'n'droppable" may be victim of extreme delay (and CPU overuse) if you try to be too fast. Same thing goes with the "draw line" in the writer. Moreover, if you draw a huge pack of lines in the writer, trying to type text will make the CPU skyrocket to 95%+ usage (whereas without lines, it won't go over 30-35%). Same goes with scrolling up and down on a filled page.

IRC meeting / 5th August 2009

Agenda

Attendees : Thomas Fontenay, Abdelkader Bellabes, Eric Bachard

Agenda :

1) Make a point about work in progress :

- build OOo4Kids on Windows, Linux and Sugar

2) A point about the current Action Items :

- document the use of Valgrind
- document the memory leak (supposed)

Question : Validate the current documentation ?

3) A point about the current Wiki page


4) misc questions


Log of the meeting

Log IRC Meeting 5th August

Work in progress

21/07/09-HOW TO : Use Gdb

Few subtle experimentations on a simple C++ program to learn how to break :

-at a given line:

(gdb) attach #processnumber

{Loading...}

(gdb) break 7

Breakpoint 1 at 0x8048918: file zzz.cpp, line 7.

(gdb) run


Observations : I'm yet to fine how to select the correct file. This syntax will break line number 'x' in the file containing the main.


-using a given methode

(gdb) attach #processnumber

{Loading...}

(gdb) break Class::method

Breakpoint 1 at 0x8048932: file Test.cpp, line 18.

(gdb) run


Observations : just like setting the breakpoint for a function, except you have to precise which class the method belongs to. Breakpoint will occur each time the method is called.


-when a condition is true

(gdb) attach #processnumber

{Loading...}

(gdb) break randomfunction

Breakpoint #brkpoint at 0x8048757: file main.cpp, line 9.

(gdb) condition #brkpoint i==5

(gdb) continue


Observations: #brkpoint is the breakpoint number that will be associated with the condition. In this case, the breakpoint will only occur when the variable i equals 5. Of course, trying to set a wrong condition is not possible.


Using gdb, one of the crashes has been localized !

Here is how I proceeded:

(gdb) attach #OOo4kidsPID

{Loading...}

(gdb) continue

Continuing.

..


From this point on, using OOo4Kids, I go to one the crash point I mentioned few days ago (the one about copying and pasting a whole page). Just as planned, OOo4Kids crashes. I go back on the terminal.

^C Program received signal SIGINT, Interrupt. [Switching to Thread 0xb5a93920 (LWP 5391)] 0xaeb1eb30 in ?? ()

from /home/twarz/OOo/DEV300_m52/instsetoo_native/unxlngi6.pro/OOo4Kids/installed/install/fr/ooo4kids0.4/program/../basis-link/program/libswli.so

(gdb)

The interesting thing is that the execution apparently stopped in the "libswli.so" library. Therefore, there is a good probability that the problem is located here. Time to build the library with the debugging symbols...


*Building OOo4Kids on Sugar

... was going smoothly until I typed "make" in the terminal. Few things to know: I'm using the Sugar on a Stick "Strawberry" version of Sugar on a 4GB USB flash device, which is way too little to contain the sources of OOo4Kids. Therefore, I stocked them on an external drive for the time being. The configure was successfully passed, but a little problem came up when trying to launch the compilation:

"tar : [pretty much every file from the boost_1_34_1 directory]  : Cannot change ownership to uid 501, gid 501 : operation not permitted"

This line repeated for many if not all the files from the boost_1_34_1 directory. Still trying to find a correction, though I suspect the source of the problem is that I use this external drive to stock the sources...

*Building OOo4Kids at Home

I tried building OOo4Kids on a more recent computer than the first time. Compiling OOo was okay, but when I apply the patch for OOo4Kids, run the configure / bootstrap / everything, the compilation will always send this error line: "dmake: /home/twarz/OOo/OpenOfficeSrc/DEV300_m52/solenv/inc/unxlngx6.mk: line 142: Error: -- Expecting macro or rule defn, found neither"

I'm still trying to fix this issue, but I'm a bit at a loss of words: I even tried to copy/paste the solenv directory from the working OOo4Kids build and it still doesn't work.

Edit: in the solenv/inc/unxlngx6.mk, starting from line 139: comment the ".IF... .ENDIF", and add the modules that were in the ".ELSE" just before the comments. Compilation for OOo4Kids then goes normaly for some time before encountering some new errors.

Edit: build is now fonctionnal. Here is the list of what has been modified:

-File framework/source/services/backingwindow.cxx wasn't compiling because of undeclared variables. Said variables were located in conditions depending specifically on a build of OOo4Kids or OOo. Solution: commenting the problematic lines. WARNING: to be used only for the compilation of OOo4Kids. Things might go wrong if you try to build OOo with those comments...

Precise location of the comments: line 305, 309, 459, 462.

-File svx/source/cui/treeopt.cxx : same problem as above.

Precise location of the comments : line 2166.

-File scp2/source/calc/calc_module.scp :

Starting from line 95 should be:

 #ifndef OOo4Kids
 gid_File_Res_Analysis,
 #endif

Line 44:

 .IF "$(OOo4Kids)"=="YES"
 SCPDEFS+=-DOOo4Kids
 .ENDIF


-File scp2/source/math/makefile.mk

Just add:

 .IF "$(OOo4Kids)"=="YES"
 SCPDEFS+=-DOOo4Kids
 .ENDIF

Build at least fonctionnal. :)


*Buildind OOo4Kids on Windows Vista

Building OOo4Kids on Windows Vista is not that hard, but there is still some trouble to go through this process. Actually, until using CPAN on Cygwin. Until then, this is going smoothly but i had some trouble installing Archive::Zip and URI modules, after many unsucsessful try, it worked suddenly: i just made a reboot. Then applying the patch, the configure and all the other things went smoothly till the build. I tried on different version of OOo4Kids and even on OOo and there is still the same building problem that i don't know how to go through:

echos: Command not found. d:/OOo4Kids/DEV300_m52/solver/300/wntnsci12.pro/bin: Permission denied. dmake: Error code 1, while making '../wntmsci12.pro/obj/wrap_hidclex.obj' dmake: '../wntmsci12.pro/obj/wrap_hidclex.obj' removed. runnid processes: 0

3 module(s): hsqldb stax soltools need(s) to be rebuilt

Reasons:

ERROR: error 65280 occured while making /cygdrive/d/OOo4Kids/DEV300_m52/stax ERROR: error 65280 occured while making /cygdrive/d/OOo4Kids/DEV300_m52/soltools/support ERROR: error 65280 occured while making /cygdrive/d/OOo4Kids/DEV300_m52/soltools/HIDCompiler ERROR: error 65280 occured while making /cygdrive/d/OOo4Kids/DEV300_m52/hsqld

I'm still trying to go through this.

"""""""""""""""""

I think I already read something about that. Are there space in the paths, or did you really keep the filetype set to “Unix/binary” ? (that's a cygwin option)

IMHO, the answer is given at Building on Windows

Ericb 13:28, 2 August 2009 (UTC)

Information for the task : Sugarize OOo4Kids

From #sugar channel ( irc.freenode.net )

[14:58] * ericb2 searching information on how to sugarize an application. Is there the right channel ?

[14:59] <ericb2> with students, we'd like to understand how to prepare an application to be packaged, and thus to be able to be installed, optionaly

[14:59] <ericb2> on Sugar, that is

[14:59] <walterbender> ericb2: Gary Martin did those icons, as I recall...

[15:00] <ericb2> walterbender: hello :) Thanks for the information

[15:00] <walterbender> ericb2: there is info on adding a Sugar wrapper around existing apps in the wiki...

[15:00] * walterbender searches for the ref.

[15:01] <ericb2> walterbender: ok. I'm currently at http://wiki.sugarlabs.org/go/0.82/Source_Code step

[15:02] <walterbender> ericb2: a good place to start in general is http://wiki.sugarlabs.org/go/Activity_Team

[15:02] <tomeu> I think the getting involved icons are based on the fedora ones

[15:03] <tomeu> ericb2: which application is that?

[15:03] <ericb2> tomeu: OOo4Kids, a light version of OpenOffice.org (no Java, no Base, adapted to 7-12 )

[15:03] <ericb2> tomeu: works on Celeron 500 / 128MB of Ram

[15:03] <tomeu> ericb2: ok, a first step would be to make it recognized by the shell as an activity

[15:04] <tomeu> ericb2: here are the details:

[15:04] <tomeu> http://wiki.laptop.org/go/Low-level_Activity_API#X_Properties

[15:05] <ericb2> tomeu: thanks a lot

[15:05] <ericb2> !

[15:05] <tomeu> ericb2: this is how I do it in python using only xlib: http://git.sugarlabs.org/projects/hellow-world-qt/repos/mainline/blobs/master/qtactivity.py#line694

[15:05] <tomeu> so if you are doing c/c++, should be even easier

[15:06] tarbo tinker-f595_ tmu tomeu turn-omg

[15:06] <ericb2> tomeu: indeed, we can both C and/or C++

[15:07] <sdziallas> sorry, was running around, am back now...

[15:07] * ericb2 to log the discussion on the OpenOffice.org wiki, as reminder for the tudents

[15:07] <ericb2> s/tudents/students/


(second part ... later)

[15:43] <tomeu> nice :)

[15:43] <ericb2> is there information (excepted in the code) somewhere on how activities are "shared" from several IP addresses ? I'd like to understand whether the feature is managed by the application, or whether it is a Sugar feature

[15:43] * ericb2 thinking to several people writing on a same Writer document e.g.

[15:45] <sdziallas> tomeu: done!

[15:45] <tomeu> ericb2: from the application, though there's a dbus service that helps with presence and creating the channels, etc

[15:45] <tomeu> sdziallas: nice!

[15:46] <ericb2> tomeu: ok, thanks a lot one more time :)

[15:46] <tomeu> ericb2: http://blog.tomeuvizoso.net/2009/07/telepathy-developers-manual.html

[15:46] <tomeu> ericb2: there's some documentation about implementing collaboration in python activities, some would apply to c++ as well

[15:47] <tomeu> ericb2: look in the laptop.org and sugarlabs.org wikis

[15:48] * meaton2veggies has quit ("Leaving")

[15:49] <tomeu> hmm, takes a while for ACLs to be applied...

[15:49] <sdziallas> tomeu: ...usually < 1 hour, afaik

[15:50] * ericb2 reading


Ericb 13:36, 2 August 2009 (UTC)


DEV300_m54: built correctly, still had to change a few things to complete the build (see Building OOo4Kids at home, I encountered the same problems in solenv/inc/unxlngx6.mk, svx/source/cui/treeopt.cxx and framework/source/services/backingwindow.cxx). The binary in itself works fine and I've been able to reproduce some crashes I found on the m52 versions. Valgrind logs will follow during this week.

Twarz 18:13, 5 August 2009 (UTC)

DEV300_m54: first steps using Valgrind. Clear problems are reported on the OOo4Kids wiki : http://wiki.ooo4kids.org/index.php/KnowIssues. I will update my personnal page (http://wiki.ooo4kids.org/index.php/User_talk:Twarz) with misc documentation of the use of valgrind during the day with examples, types of problems, etc etc.

Twarz 13:00, 6 August 2009 (UTC)


  • COPY/PASTE CRASH: POSSIBLE CAUSE


file: sw/source/core/text/txtfrm.cxx

method: xub_StrLen SwTxtFrm::FindBrk(const XubString &, const xub_StrLen, const xub_StrLen) const

line: 665-666 :

       while( nFound <= nEndLine && ' ' != rTxt.GetChar( nFound ) )
               ++nFound;

What is exactly happening ?

This file contain two very similar "while"s :

       while( nFound <= nEndLine && ' ' == rTxt.GetChar( nFound ) )
                ++nFound;        
       while( nFound <= nEndLine && ' ' != rTxt.GetChar( nFound ) )
               ++nFound;

In every case, the first one goes on correctly. The second one, though, is the compromised one.When the crash is happening, nEndLine value is set to 65535. The program skips the first while and directly start processing the second one. nFound initial value is set to 65463. The while goes on until nFound reaches 65534... And suddenly see it's value reinitialised to 0. The problem seems to be located in the rTxt.GetChar method. When nFound reaches 65534 or 65535, this function seems to put back it's value to 0, therefore blocking the program in this "while" (0->65535->0->65535->...)

The function that needs attention is XubString::GetChar . If, of course, I didn't do anything wrong, which is still highly possible.

Twarz 11:22, 10 August 2009 (UTC)

This problem (^) has been half solved. The crash indeed was caused by nFound who switched back to 0 once he reached 65535. A problem of type. Therefore, here is my proposition to start fixing the issue. Here is what the compromised function should look like:

 xub_StrLen SwTxtFrm::FindBrk( const XubString &rTxt,
                                                   const xub_StrLen nStart, const xub_StrLen nEnd ) const
 {
         xub_StrLen nFound = nStart;
         const xub_StrLen nEndLine = Min( nEnd, rTxt.Len() );
         unsigned int nF = (unsigned int)nFound;
         unsigned int nEL = (unsigned int)nEndLine;  
                                                                       
         while( nF <= nEL && ' ' == rTxt.GetChar( (xub_StrLen)nF ) )
                  ++nF;                                                                                                                                     
         while( nF <= nEL && ' ' != rTxt.GetChar( (xub_StrLen)nF ) )
                 ++nF;
         return ((xub_StrLen)nF);
 }


This does fix the crash: an unsigned int won't reset reaching 65535. But there is another problem: in the very same conditions where the crash would have occurred and these modifications have been added, the user is unable to write anything anymore. He is stuck at the point when the paste stopped. This problem seems quite unrelated, though, more researches will be needed to find the why of this problem. Well, It's half-solved, so it's still a little progress.

Twarz 15:15, 10 August 2009 (UTC)

Personal tools