Question

I added a module in the directory of framework/av/

The code can be built when the Android.mk ended with the line

include $(BUILD_STATIC_LIBRARY) .

However, since I need a shared library file (say abcd.so), I changed this line to

include $(BUILD_SHARED_LIBRARY)

Then I got errors which refer to some undefined reference errors.

Did I need to change anything here?

Thanks

out/target/product/abcd/obj/SHARED_LIBRARIES/libudev_intermediates/libudev.o: in function udev_new:frameworks/av/libudev/libudev.c:195: error: undefined reference to 'secure_getenv'
target 
Symbolic: libcutils (out/target/product/abcd/symbols/system/lib/libcutils.so)
collect2: ld returned 1 exit status
make: *** [out/target/product/abcd/obj/SHARED_LIBRARIES/libudev_intermediates/LINKED/libudev.so] Error 1
make: *** Waiting for unfinished jobs....
Was it helpful?

Solution

In the android system, there are many other modules which are depending on static av module. I suggest you build both static library and shared library. Even if you make a shared library, you should take care of the dependence. These changing may lead other problems.

And the codes looks like these:

include $(BUILD_STATIC_LIBRARY)
#appending this line for shared library
LOCAL_MODULE := xxx_shared
include $(BUILD_SHARED_LIBRARY)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top