본문 바로가기

구글과인터넷/안드로이드

안드로이드 stdarg.h 인클루드 에러 관련

출처: http://blog.naver.com/acelhj?Redirect=Log&logNo=60118764483

흠 빌드가 잘 되나 싶더니, 10분 쯤 지났을까 stdarg.h가 없다며 에러가 발생했다.

 

인터넷에 찾아보니, 몇몇 패치를 해야 한다고 한다. 이 것은 곧 통합될 거라고는 하는데, 여튼 현재는 아닌 상태다.

근데, 이 포스트가 2009년 12월 13일에 된건데, 아직 통합안된건가, 아니면 내가 froyo를 끌어와서 그런건가

 

여튼 다음의 방법으로 해결이 될 듯 하다.

터미날에서 android설치 폴더로 이동 후( 나의 경우엔 mydroid)

$ cd ./system/core
$ git pull git://android.git.kernel.org/platform/system/core refs/changes/45/11845/3
$ cd ../..
$ cd ./external/qemu
$ git pull git://android.git.kernel.org/platform/external/qemu refs/changes/46/11846/3
$ cd ../..
$ cd ./system/core
$ git pull git://android.git.kernel.org/platform/system/core refs/changes/97/12597/1
$ cd ../..

1) change in file external/qemu/Makefile.android (need patch 11846)
MY_CC := gcc-4.0
to
MY_CC := gcc-4.0 -I/Developer/usr/lib/gcc/i686-apple-darwin10/4.0.1/include/
2) and do
cp /Developer/usr/lib/gcc/i686-apple-darwin10/4.0.1/include/stdarg.h 
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/stdarg.h
(1) without (2) does not work. seems (1) is not necessary. but i did not bother to recheck it after passing the 
compilation. hope it helps. two stdarg.h are quite different

 

그리고 빌드, cast 에러가 발생하면, 발생한 라인의 cast를 int_32_t 등을 대신하여 sizt_t로 수정해 준다.

 

Solving errors:

case 1:

/Developer/SDKs/MacOSX10.4u.sdk/usr/include/stdarg.h:4:25: error: stdarg.h: No such file or directory

In file included from external/qemu/elff/dwarf_die.h:21,

from external/qemu/elff/elf_file.h:20,

from external/qemu/elff/dwarf_cu.cc:20:

external/qemu/elff/elf_alloc.h: In static member function ‘static void* DwarfAllocBase::operator new(size_t)’:

external/qemu/elff/elf_alloc.h:156: warning: ‘operator new’ must not return NULL unless it is declared ‘throw()’ (or -fcheck-new is in effect)

make: *** [out/host/darwin-x86/obj/STATIC_LIBRARIES/emulator-elff_intermediates/elff/dwarf_cu.o] Error 1


solution

>vi external/qemu/Makefile.android

find

MY_CFLAGS += -mdynamic-no-pic

replace

MY_CFLAGS += -mdynamic-no-pic -I /Developer/usr/lib/gcc/i686-apple-darwin10/4.0.1/include/


case 2:

external/v8/src/arm/assembler-arm-inl.h: In constructor

‘v8::internal::Operand::Operand(const v8::internal::ExternalReference&)’:

external/v8/src/arm/assembler-arm-inl.h:172: error: cast from ‘v8::internal::byte*’ to ‘int32_t’ loses precision

In file included from external/v8/src/macro-assembler.h:87,

from external/v8/src/ic-inl.h:33,

from external/v8/src/assembler.cc:39:

external/v8/src/arm/assembler-arm-inl.h: In constructor

‘v8::internal::Operand::Operand(const char*)’:

external/v8/src/arm/assembler-arm-inl.h:165: error: cast from ‘const char*’ to ‘int32_t’ loses precision

external/v8/src/arm/assembler-arm-inl.h: In constructor

‘v8::internal::Operand::Operand(const v8::internal::ExternalReference&)’:

external/v8/src/arm/assembler-arm-inl.h:172: error: cast from ‘v8::internal::byte*’ to ‘int32_t’ loses precision


Solution

>vi build/core/config.mk

find

PREBUILT_IS_PRESENT := $(if $(wildcard prebuilt/Android.mk),true)

replace

PREBUILT_IS_PRESENT := $(if $(wildcard prebuilt/Android.mk),true)

ifeq ($(HOST_OS),darwin)

HOST_GLOBAL_CFLAGS += -arch i386

HOST_GLOBAL_CPPFLAGS += -arch i386

HOST_GLOBAL_LDFLAGS += -arch i386

endif


case 3:
ld: warning: in out/host/darwin-x86/obj/STATIC_LIBRARIES/libhost_intermediates/libhost.a, file is not of required architecture
Undefined symbols:
"_main", referenced from:
start in crt1.10.6.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make: *** [out/host/darwin-x86/obj/EXECUTABLES/acp_intermediates/acp] Error 1


Solution

>vi build/core/combo/darwin-x86.mk

or

>vi build/core/combo/HOST_darwin-x86.mk

find

$(HOST_CXX) \
-dynamiclib -single_module -read_only_relocs suppress \
$(HOST_GLOBAL_LD_DIRS) \

replace

$(HOST_CXX) \
-dynamiclib -single_module -read_only_relocs suppress \
$(HOST_GLOBAL_LD_DIRS) \

$(if $(PRIVATE_NO_DEFAULT_COMPILER_FLAGS),, \
$(HOST_GLOBAL_LDFLAGS) \
) \


find

$(HOST_CXX) \
-Wl,-dynamic -headerpad_max_install_names \
$(HOST_GLOBAL_LD_DIRS) \
$(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \

replace

$(HOST_CXX) \
-Wl,-dynamic -headerpad_max_install_names \
$(HOST_GLOBAL_LD_DIRS) \
$(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \

$(if $(PRIVATE_NO_DEFAULT_COMPILER_FLAGS),, \
$(HOST_GLOBAL_LDFLAGS) \
) \