Thursday, May 10, 2012

Mac OS X tar util adds files with "._"


So, if you got surprised after uncomressing the tar.gz file that was created on Mac OS X and finding a bunch of extra files starting with "._" for every file and directory, here is a solution for you.
To avoid these extra files to be added into tar.gz on Mac OS X, define the environment variable:
export COPYFILE_DISABLE=true

Wednesday, May 09, 2012

Android NDK8 now with MIPS arch support

With the support for MIPS architecture in the latest release of NDK8, the life of NDK developers became a bit more difficult again. We have 4 architectures to cross-compile a bunch of native libraries for: armebi, armebi-v7a, x86 and mips. I guess, this is just one more push to move towards Java code for better portability and smaller .APKs, etc.

By the way the issue with libc on x86 builds that I was posting about since NDK6 still exists.
One the native libraries that I use fails to build with the following errors:
undefined reference to `siglongjmp'
undefined reference to `sigsetjmp'
See here: http://aleksmaus.blogspot.com/2011/11/more-fun-with-android-ndk7.html

The x86 build fails with both Mac OS X and Linux NDK8.

If anybody on Android NDK team reads this, please, please, please fix it.

Monday, May 07, 2012

Mac OSX file handles limits

 I stumbled on this issue many times trying to run the services that open too many handles on Mac OS X (Lion). Even when you see the ulimit tool returning "unlimited" value, it's not actually unlimited.

Here are the couple of commands that I have to run to actually increase the number of allowed opened handles:
$ sudo launchctl limit maxfiles 500000 500000 
$ ulimit -n 500000


Wednesday, May 02, 2012

Bulding AOSP on Ubuntu 12.04

Update (July, 11, 2012):
Just built the Android 4.1.1 (Jelly Bean) branch from AOSP on Ubuntu 12 with no problems whatsoever. This makes this post no longer relevant.
Many thanks for that to Android development team.

//************************************************************************


I just started to play with Ubuntu 12.04 and stumbled on few issues while building Android source tree (AOSP master branch).

Here are few things that might be useful to know in order get AOSP building:

1. First, follow the instructions here http://source.android.com/source/initializing.html to install all the dependencies and set everything up.

2. Then install Sun JDK6, here is the link to the latest download at the moment:
http://www.oracle.com/technetwork/java/javase/downloads/jdk-6u32-downloads-1594644.html

After downloading it, execute these commands:

$ chmod u+x jdk-6u32-linux-x64.bin
$ ./jdk-6u32-linux-x64.bin
$ sudo mv jdk1.6.0_32 /usr/lib/jvm/
$ sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.6.0_32/bin/java" 1
$ sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.6.0_32/bin/javac" 1

then switch to this version of java with:
$ sudo update-alternatives --config java
and
$ sudo update-alternatives --config javac

You can probably get away with OpenJDK6 (disable the java version check in the build/core/main.mk). I remember I had a problem compiling one of the CTS tests and fixing that required some java code modifications.

3. The failure while building qtools build can be fixed with changing
common_cflags := -O0 -g 
to
common_cflags := -O0 -g -Wwrite-strings -fpermissive
in the sdks/emulator/qtools/Android.mk

4. The failure with OpenGL libraries linking can be fixed with 
sudo ln -s /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1 /usr/lib/libGL.so

5. The failure while building obbtool, can be fixed in the  
build/core/combo/HOST_linux-x86.mk file by changing the following line
HOST_GLOBAL_CFLAGS += -D_FORTIFY_SOURCE=0
to
HOST_GLOBAL_CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0

6. The failure with:
make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libMesa_intermediates/src/glsl/linker.o] Error 1
can be fixed with adding the 
#include <stddef.h>
at the top of the external/mesa3d/src/glsl/linker.cpp file.

7. The failure external/oprofile/libpp/format_output.h:94:22: error: reference ‘counts’ cannot be declared ‘mutable’ [-fpermissive]
can be fixed by changing the external/oprofile/libpp/format_output.h file
mutable counts_t & counts;
to 
counts_t & counts;

8. The failure external/gtest/src/../include/gtest/internal/gtest-param-util.h:122:11: error: ‘ptrdiff_t’ does not name a type
can be fixed by adding 
#include <cstddef>
into the external/gtest/src/../include/gtest/internal/gtest-param-util.h file. 

9. The failure /external/llvm/lib/Support/Mutex.cpp:143: undefined reference to `pthread_mutex_trylock'
collect2: ld returned 1 exit status
make: *** [out/host/linux-x86/obj/EXECUTABLES/test-librsloader_intermediates/test-librsloader] Error 1
can be fixed by adding 
LOCAL_LDLIBS := -lpthread -ldl 
into external/llvm/llvm-host-build.mk file.

10. For the failure frameworks/compile/slang/slang_rs_export_foreach.cpp:249:23: error: variable ‘ParamName’ set but not used [-Werror=unused-but-set-variable]
I just commented out that line since the ParamName is not used anyways.

This might not be the best solution, but it builds and leaves me some time to improve it if I need it.

Hope this saves you a bit of time.