2011-08-12 9 views
1

Android 용 libharu을 컴파일하려고합니다. 모든 소스와Android NDK를 사용하여 libharu 컴파일

  • /JNI/lpng154/과의 libpng에 대한 파일을 포함; 내 JNI 폴더에서 나는했습니다
  • /jni/libharu-2.2.1/ 오순절 모든 소스 및 libharu

이 (/JNI/ 폴더에) 내 Android.mk입니다에 대한 파일이 포함됩니다. libharu는 libpng와 종속되어 있으므로 먼저 libpng를 컴파일해야합니다.

LOCAL_PATH := $(call my-dir) 

include $(CLEAR_VARS) 

sources := png.c \ 
    pngerror.c \ 
    pngget.c \ 
    pngmem.c \ 
    pngpread.c \ 
    pngread.c \ 
    pngrio.c \ 
    pngrtran.c \ 
    pngrutil.c \ 
    pngset.c \ 
    pngtrans.c \ 
    pngwio.c \ 
    pngwrite.c \ 
    pngwtran.c \ 
    pngwutil.c 

LOCAL_C_INCLUDES := $(LOCAL_PATH)/lpng154 
LOCAL_MODULE  := png 
LOCAL_LDLIBS  := -lz 
LOCAL_SRC_FILES := $(sources:%=lpng154/%) 

include $(BUILD_STATIC_LIBRARY) 

그런 다음 libharu를 컴파일합니다.

include $(CLEAR_VARS) 

sources := hpdf_annotation.c \ 
    hpdf_array.c \ 
    hpdf_binary.c \ 
    hpdf_boolean.c \ 
    hpdf_catalog.c \ 
    hpdf_destination.c \ 
    hpdf_dict.c \ 
    hpdf_doc.c \ 
    hpdf_doc_png.c \ 
    hpdf_encoder.c \ 
    hpdf_encoder_cns.c \ 
    hpdf_encoder_cnt.c \ 
    hpdf_encoder_jp.c \ 
    hpdf_encoder_kr.c \ 
    hpdf_encrypt.c \ 
    hpdf_encryptdict.c \ 
    hpdf_error.c \ 
    hpdf_ext_gstate.c \ 
    hpdf_font.c \ 
    hpdf_font_cid.c \ 
    hpdf_fontdef_base14.c \ 
    hpdf_fontdef.c \ 
    hpdf_fontdef_cid.c \ 
    hpdf_fontdef_cns.c \ 
    hpdf_fontdef_cnt.c \ 
    hpdf_fontdef_jp.c \ 
    hpdf_fontdef_kr.c \ 
    hpdf_fontdef_tt.c \ 
    hpdf_fontdef_type1.c \ 
    hpdf_font_tt.c \ 
    hpdf_font_type1.c \ 
    hpdf_gstate.c \ 
    hpdf_image.c \ 
    hpdf_image_png.c \ 
    hpdf_info.c \ 
    hpdf_list.c \ 
    hpdf_mmgr.c \ 
    hpdf_name.c \ 
    hpdf_namedict.c \ 
    hpdf_null.c \ 
    hpdf_number.c \ 
    hpdf_objects.c \ 
    hpdf_outline.c \ 
    hpdf_page_label.c \ 
    hpdf_page_operator.c \ 
    hpdf_pages.c \ 
    hpdf_real.c \ 
    hpdf_streams.c \ 
    hpdf_string.c \ 
    hpdf_u3d.c \ 
    hpdf_utils.c \ 
    hpdf_xref.c \ 
    hpdf_pdfa.c 

LOCAL_C_INCLUDES := \ 
    $(LOCAL_PATH)/lpng154 \ 
    $(LOCAL_PATH)/libharu-2.2.1/include \ 
    $(LOCAL_PATH)/libharu-2.2.1/src 

LOCAL_LDLIBS := -lz -lm 
LOCAL_MODULE := haru 
LOCAL_SRC_FILES := $(sources:%=libharu-2.2.1/src/%) 

LOCAL_STATIC_LIBRARIES := z png 

include $(BUILD_SHARED_LIBRARY) 

난 실행하면 NDK-buid * 그 같은 많은 오류가 다음 파일 *의 hpdf_image_png.c를 컴파일 할 때 컴파일러가 중지을 :

.../src/hpdf_image_png.c: In function 'ReadPngData_Interlaced': 
.../src/hpdf_image_png.c:113: error: dereferencing pointer to incomplete type 
.../src/hpdf_image_png.c:118: error: dereferencing pointer to incomplete type 
.../src/hpdf_image_png.c:119: error: dereferencing pointer to incomplete type 
.../src/hpdf_image_png.c:129: error: dereferencing pointer to incomplete type 
... 
... 

내가 찾을 수없는 NDK 빌드를 추측 png.h ... 헤더를 찾기 위해 컴파일러를 돕는 방법은 무엇입니까?

내 Android.mk에서 나는 플래그를 추가하는 경우 : 두 행하기 전에

LOCAL_CFLAGS := -DLIBHPDF_HAVE_NOPNGLIB 

:

LOCAL_LDLIBS := -lz -lm 
LOCAL_MODULE := haru 
... 

실행 everithing 잘 컴파일 NDK 빌드 ...하지만 것을 libharu에 png 임베딩을 놓친다.

여러분 덕분에.

답변

1

, 당신은 LPNG/스크립트/pnglibconf.h.prebuilt에서 찾을 수는 그냥 pnglibconf.h의 이름을 변경 .prebuilt를 pnglibconf.h로 지정한 다음 lpng 폴더에 추가하십시오. 또한 hpdf_image_png.c 파일을 수정해야합니다. #include png.html #include pnginfo.h 다음 줄을 추가하십시오. 그게 전부입니다. 나는 당신이 성공할 수 있다고 믿습니다.

0

저는 jimtoner의 대답을 사용합니다. 거의 맞습니다. 그러나 내 상황 (1.6.3)에서는 hpdf_image_png.c 파일을 수정해야하며 #include 뒤에 #include를 추가해야합니다. 그리고 성공합니다!

관련 문제