I am trying to link an executable against libcutils.so, but I get the following error:
Executable : gps_test
/home/jbrew/android_gps/jni/lib_dir//libcutils.so: undefined reference to `ioprio_set'
/home/jbrew/android_gps/jni/lib_dir//libcutils.so: undefined reference to `ioprio_get'
collect2: ld returned 1 exit status
make: *** [obj/local/armeabi/gps_test] Error 1
Here is what my Android.mk file looks like:
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= \
gps_test.c
LOCAL_LDLIBS:= -L/home/jbrew/android_gps/jni/lib_dir/ -llog -lhardware -lcutils
LOCAL_C_INCLUDES:= \
/home/jbrew/android_gps/jni/includes
LOCAL_MODULE:= gps_test
#include $(BUILD_SHARED_LIBRARY)
include $(BUILD_EXECUTABLE)
Is there a way to get the compiler to ignore these? I tried to add CFLAG –warn-unresolved-symbols, but the compiler didn’t know what that flag meant.
For anyone else that has this issue, the problem was my API level. ndk-build was using android-3 to build by default. I added a default.properties file to my project path, then put “target=android-9” in that file. After this addition, I could build the executable.