Monthly Archives: June 2012

You are browsing the site archives by month.

Building Android: error: passing ‘const android::RefBase::weakref_impl’

If you are building android in ubuntu >10.04 you are gonna get this awesome error:

:0:0: warning: “_FORTIFY_SOURCE” redefined [enabled by default]
:0:0: note: this is the location of the previous definition
frameworks/base/libs/utils/RefBase.cpp: In member function ‘void android::RefBase::weakref_type::trackMe(bool, bool)’:
frameworks/base/libs/utils/RefBase.cpp:483:67: error: passing ‘const android::RefBase::weakref_impl’ as ‘this’ argument of ‘void android::RefBase::weakref_impl::trackMe(bool, bool)’ discards qualifiers [-fpermissive]
make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libutils_intermediates/RefBase.o] Error 1

Like the error itself tell us, the fix is to add the flag fpermissive, so let’s edit frameworks/base/libs/utils/ and change:




And let the compiler do its job.

Building Android: error: “_FORTIFY_SOURCE” redefined [-Werror]

If you are building an old version of android probably you’ll have this error

host C++: obbtool <= frameworks/base/tools/obbtool/Main.cpp :0:0: error: “_FORTIFY_SOURCE” redefined [-Werror]
:0:0: note: this is the location of the previous definition
cc1plus: all warnings being treated as errors

To fix this, edit build/core/combo/ and replace:




And that’s it.

Split huge Innodb data file into several ones

Hi, I’m MySQL and I’m greedy, I WANNA ALL YOUR BYTES.

If you have a huge ibdata1 file (/var/lib/mysql/ibdata1) probably is because you don’t have innodb_file_per_table option in your my.cnf. To fix this follow this simple method (it requires to have free disk space):

  1. Add innodb_file_per_table to your my.cnf and restart MySQL
  2. Create list of innodb tables to migrate (all of them!)

  3. For each table execute this:
    ALTER TABLE `table_name` ENGINE=InnoDB
    With that the table will be regenerated in its own file. But ibdata1 won’t shrink because MySQL is greedy and will keep that (empty) space for him
  4. Free space deleting ibdata1
  5. Profit