Hi,
I have struggled with it for couple of days~~

we customized Android frameworks by adding a service component into
$ANDROID/frameworks/base/ folder

The service component needs to use $ANDROID/external/jpeg library, but we
got link error:

 Our problem could be identified as: *Is it feasible to link $ANDROID/
external/jpeg in $ANDROID/frameworks/base/xyz module, as the $ANDROID/
external/skia module?*
*
*

That is, *How could I link external/jpeg's libjpeg.a into
frameworks/base/xxx ??*
*
*
And, is it possible the namespace?
We include *jpeglib.h* with *extern "C"* declaration, and call libjpeg
functions in *android namespace*.

Does anyone know how to call libjpeg functions in android namespace?


The Android.mk is as follows:
####################
LOCAL_PATH:= $(call my-dir)
#
include $(CLEAR_VARS)
ifeq ($(USE_CAMERA_STUB),)
USE_CAMERA_STUB:= false
ifneq ($(filter sooner generic sim,$(TARGET_DEVICE)),)
USE_CAMERA_STUB:=true
endif #libcamerastub
endif

ifeq ($(USE_CAMERA_STUB),true)
#
# libcamerastub
#
LOCAL_C_INCLUDES := external/jpeg

LOCAL_STATIC_LIBRARIES := libjpeg

LOCAL_SRC_FILES :=  ...

ifeq ($(TARGET_SIMULATOR),true)
LOCAL_CFLAGS += -DSINGLE_PROCESS
endif

LOCAL_MODULE:= libcamerastub

include $(BUILD_STATIC_LIBRARY)

endif # USE_CAMERA_STUB


#
# libcameraservice
#
include $(CLEAR_VARS)

LOCAL_C_INCLUDES := external/jpeg

LOCAL_SRC_FILES := ...

LOCAL_MODULE:= libcameraservice

LOCAL_SHARED_LIBRARIES:= \
    libui \
    libutils \
    libbinder \
    libcutils \
    libmedia

LOCAL_PRELINK_MODULE := false
ifeq ($(TARGET_SIMULATOR),true)
LOCAL_CFLAGS += -DSINGLE_PROCESS
endif

LOCAL_STATIC_LIBRARIES := libjpeg

ifeq ($(USE_CAMERA_STUB), true)
LOCAL_STATIC_LIBRARIES += libcamerastub
else
LOCAL_SHARED_LIBRARIES += libcamera
endif

include $(BUILD_SHARED_LIBRARY)
####################



And the errors are:
out/target/product/devkit8000/obj/STATIC_LIBRARIES/libcamerastub_intermediates/libcamerastub.a(xxx.o):
In function `android::xxx::fxn()':
/work/0xdroid/frameworks/base/camera/libcameraservice/filexxx.cpp:314:
undefined reference to `jpeg_std_error'
/work/0xdroid/frameworks/base/camera/libcameraservice/filexxx.cpp:315:
undefined reference to `jpeg_CreateCompress'
/work/0xdroid/frameworks/base/camera/libcameraservice/filexxx.cpp:322:
undefined reference to `jpeg_stdio_dest'
/work/0xdroid/frameworks/base/camera/libcameraservice/filexxx.cpp:341:
undefined reference to `jpeg_set_defaults'
/work/0xdroid/frameworks/base/camera/libcameraservice/filexxx.cpp:351:
undefined reference to `jpeg_set_quality'
/work/0xdroid/frameworks/base/camera/libcameraservice/filexxx.cpp:354:
undefined reference to `jpeg_set_quality'
/work/0xdroid/frameworks/base/camera/libcameraservice/filexxx.cpp:355:
undefined reference to `jpeg_simple_progression'
/work/0xdroid/frameworks/base/camera/libcameraservice/filexxx.cpp:360:
undefined reference to `jpeg_start_compress'
/work/0xdroid/frameworks/base/camera/libcameraservice/filexxx.cpp:366:
undefined reference to `jpeg_write_scanlines'
/work/0xdroid/frameworks/base/camera/libcameraservice/filexxx.cpp:370:
undefined reference to `jpeg_finish_compress'
/work/0xdroid/frameworks/base/camera/libcameraservice/filexxx.cpp:372:
undefined reference to `jpeg_destroy_compress'
collect2: ld returned 1 exit status
make: ***
[out/target/product/devkit8000/obj/SHARED_LIBRARIES/libcamerastub_intermediates/LINKED/libcameraservice.so]
Error 1
make: *** Waiting for unfinished jobs....
~/work/0xdroid$


Best Regards,
Paul Chu
http://www.luke54.org/
 <http://www.luke54.org/>耶和華我的磐石,我的救贖主阿,願我口中的言語,心裡的意念,在你面前蒙悅納。~詩1914

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to