Fix: CM-11 Philz/TWRP undefined reference to 'android::VectorImpl::finish_vector()' - General Questions and Answers

To fix Philz-6.59.0 or TWRP-2.8.1.0 build error under CM-11.0 with the following output
system/core/include/utils/SortedVector.h:161: error: undefined reference to 'android::VectorImpl::finish_vector()'
Edit their respective files as shown below
Philz-Fix
=========
Edit: recovery-philz/Android.mk
-LOCAL_STATIC_LIBRARIES += libminui libpixelflinger_static libpng libcutils liblog
+LOCAL_STATIC_LIBRARIES += libminui libpixelflinger_static libpng libcutils liblog libutils
TWRP-Fix (libminuitwrp)
========
Edit: recovery-twrp/minuitwrp/Android.mk
-LOCAL_SHARED_LIBRARIES += libz libc libcutils libjpeg libpng
+LOCAL_SHARED_LIBRARIES += libz libc libcutils libjpeg libpng libutils
PS: This is my first post, if it helped you fix the problem please click the :good:

Related

OpenSSL for android: linking shared libs error

I am trying to compile a simple program with ndk-build that uses functions from the OpenSSL libcrypto.so shared library, but I have some errors:
This is my Android.mk
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := lib-crypto
LOCAL_SRC_FILES := libcrypto.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := tema1
LOCAL_SRC_FILES := tema1.c
LOCAL_SHARED_LIBRARIES := lib-crypto
LOCAL_C_INCLUDES := /home/aleksei/openSSL0.9.8/include
include $(BUILD_EXECUTABLE)
libcrypto.so is the library that I have built for android. I want to make a program using it. Now it gives me this error:
Install : libcrypto.so => libs/armeabi/libcrypto.so
Executable : tema1
./obj/local/armeabi/libcrypto.so: undefined reference to `dladdr'
collect2: ld returned 1 exit status
make: *** [obj/local/armeabi/tema1] Error 1
What am I doing wrong?

[Q] Build a native c helloworld with DynamicLinkLibrary?

Hi everyone, I want to make a native c program with a dynamic link library, so I put these files in Android/development/hello/: hello.c, myprint.h,myprint.c, the main() is in hello.c and include myprint.h, and the Android.mk is:
---------------------------------------------------------------------
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := myprint
LOCAL_SRC_FILES := myprint.c
include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := helloworld
LOCAL_SRC_FILES := hello.c
LOCAL_SHARED_LIBRARIES := myprint
include $(BUILD_EXECUTABLE)
---------------------------------------------------------------------
Then I make helloworld, and the output info is that:
---------------------------------------------------------------------
target thumb C: helloworld <= development/hello/hello.c
target thumb C: myprint <= development/hello/myprint.c
target SharedLib: myprint (out/target/product/generic/obj/SHARED_LIBRARIES/myprint_intermediates/LINKED/myprint.so)
target Symbolic: myprint (out/target/product/generic/symbols/system/lib/myprint.so)
target Strip: myprint (out/target/product/generic/obj/lib/myprint.so)
target Executable: helloworld (out/target/product/generic/obj/EXECUTABLES/helloworld_intermediates/LINKED/helloworld)
/home/neil/dev/google_422/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7/bin/../lib/gcc/arm-linux-androideabi/4.7/../../../../arm-linux-androideabi/bin/ld: error: cannot find -lmyprint.so
development/hello/hello.c:5: error: undefined reference to 'myprint'
collect2: error: ld returned 1 exit status
---------------------------------------------------------------------
Please help me...

[Q] Compiling Screencap for Samsung galaxy tab 2 10.1 4.1.1

Hi, I am trying to recompile the screencap executable to tweak the code for my needs.
Unfortunetaly, I get some compilation error when i compile the code
I am compiling with ndk-build from android-ndk-r9
Here is the log:
[email protected]:~/Development/Hello_Screencap-2$ /home/lafd/Development/android-ndk-r9/ndk-build
Android NDK: WARNING: APP_PLATFORM android-18 is larger than android:minSdkVersion 8 in ./AndroidManifest.xml
Compile++ thumb : Hello-Sreencap-2 <= Hello_Screencap-2.cpp
Executable : Hello-Sreencap-2
/home/lafd/Development/android-ndk-r9/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: ./obj/local/armeabi/objs/Hello-Sreencap-2/Hello_Screencap-2.o: in function main:jni/Hello_Screencap-2.cpp:36: error: undefined reference to 'android::ScreenshotClient::ScreenshotClient()'
/home/lafd/Development/android-ndk-r9/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: ./obj/local/armeabi/objs/Hello-Sreencap-2/Hello_Screencap-2.o: in function main:jni/Hello_Screencap-2.cpp:41: error: undefined reference to 'android::SurfaceComposerClient::getBuiltInDisplay(int)'
/home/lafd/Development/android-ndk-r9/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: ./obj/local/armeabi/objs/Hello-Sreencap-2/Hello_Screencap-2.o: in function main:jni/Hello_Screencap-2.cpp:41: error: undefined reference to 'android::ScreenshotClient::update(android::sp<android::IBinder> const&)'
/home/lafd/Development/android-ndk-r9/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: ./obj/local/armeabi/objs/Hello-Sreencap-2/Hello_Screencap-2.o: in function main:jni/utils/StrongPointer.h:149: error: undefined reference to 'android::RefBase::decStrong(void const*) const'
/home/lafd/Development/android-ndk-r9/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: ./obj/local/armeabi/objs/Hello-Sreencap-2/Hello_Screencap-2.o: in function main:jni/Hello_Screencap-2.cpp:44: error: undefined reference to 'android::ScreenshotClient::getWidth() const'
/home/lafd/Development/android-ndk-r9/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: ./obj/local/armeabi/objs/Hello-Sreencap-2/Hello_Screencap-2.o: in function main:jni/Hello_Screencap-2.cpp:45: error: undefined reference to 'android::ScreenshotClient::getHeight() const'
/home/lafd/Development/android-ndk-r9/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: ./obj/local/armeabi/objs/Hello-Sreencap-2/Hello_Screencap-2.o: in function main:jni/Hello_Screencap-2.cpp:46: error: undefined reference to 'android::ScreenshotClient::getFormat() const'
/home/lafd/Development/android-ndk-r9/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: ./obj/local/armeabi/objs/Hello-Sreencap-2/Hello_Screencap-2.o: in function main:jni/Hello_Screencap-2.cpp:47: error: undefined reference to 'android::ScreenshotClient::getSize() const'
/home/lafd/Development/android-ndk-r9/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: ./obj/local/armeabi/objs/Hello-Sreencap-2/Hello_Screencap-2.o: in function main:jni/Hello_Screencap-2.cpp:54: error: undefined reference to 'android::ScreenshotClient::~ScreenshotClient()'
collect2: ld returned 1 exit status
make: *** [obj/local/armeabi/Hello-Sreencap-2] Error 1
Well it seems that every calls that needs the android namespace can't be referenced.
But, SurfaceComposerClient is included which defines the android namespace
Here is the c++ code snippet:
#include <utils/RefBase.h>
#include <binder/IBinder.h>
#include <binder/MemoryHeapBase.h>
#include <gui/ISurfaceComposer.h>
#include <gui/SurfaceComposerClient.h>
#include <dlfcn.h>
#include <errno.h>
#include <unistd.h>
#include <stdio.h>
#include <fcntl.h>
#include <linux/fb.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
using namespace android;
static void do_save(const char *filename, const void *buf, size_t size)
{
int out = open(filename, O_RDWR|O_CREAT, 0666);
int len = write(out, buf, size);
printf("Wrote %d bytes to out.\n", len);
close(out);
}
int main (int ac, char **av)
{
ScreenshotClient ssc;
const void *pixels;
size_t size;
int buffer_index;
if(ssc.update( android::SurfaceComposerClient::getBuiltInDisplay( android::ISurfaceComposer::eDisplayIdMain)) != NO_ERROR )
{
//printf("Captured: w=%d, h=%d, format=%d\n");
ssc.getWidth();
ssc.getHeight();
ssc.getFormat();
size = ssc.getSize();
do_save(av[1], pixels, size);
}
else
{
printf(" screen shot client Captured Failed");
}
return 0;
}
And The Android.mk
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SHARED_LIBRARIES := \
libcutils \
libutils \
libbinder \
libskia \
libui \
libgui
LOCAL_SRC_FILES:= \
Hello_Screencap-2.cpp
LOCAL_MODULE:= Hello-Sreencap-2
LOCAL_MODULE_TAGS := optional
LOCAL_C_INCLUDES += \
external/skia/include/core \
external/skia/include/effects \
external/skia/include/images \
external/skia/src/ports \
external/skia/src/core \
external/skia/include/utils \
include $(BUILD_EXECUTABLE)
When I compile the screencap from cyanogenmod, the compilation works but when the executable runs it shows an error about CANNOT LINK EXECUTABLE cannot locate symbol Zn7androidscreenshotclient...
If you need more don't hesitate

Maguro / Galaxy Nexus CM 12.1 build

Hi,
I've been playing a bit with CM's build as I expect to retire my Galaxy Nexus from its duty soon. The build went fine if not for the following build error:
Code:
target Executable: pvrsrvinit (/home/user/Development/Cyanogenmod/android/system/out/target/product/p5100/obj/EXECUTABLES/pvrsrvinit_intermediates/LINKED/pvrsrvinit)
/home/user/Development/Cyanogenmod/android/system/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.8/bin/../lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld: error: cannot find -lsrv_init_SGX540_120
/home/user/Development/Cyanogenmod/android/system/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.8/bin/../lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld: error: cannot find -lsrv_um_SGX540_120
hardware/ti/omap4/pvrsrvinit/pvrsrvinit.c:8: error: undefined reference to 'SrvInit'
collect2: error: ld returned 1 exit status
make: *** [/home/user/Development/Cyanogenmod/android/system/out/target/product/p5100/obj/EXECUTABLES/pvrsrvinit_intermediates/LINKED/pvrsrvinit] Error 1
make: *** Waiting for unfinished jobs....
make: Leaving directory `/home/user/Development/Cyanogenmod/android/system'
Other threads[0] reference the following fix, namely adding
Code:
<project name="DonkeyCoyote/proprietary_vendor_samsung" path="vendor/samsung" remote="github" revision="android-5.0" />
in
Code:
.repo/local_manifests/roomservice.xml
Unfortunately this trick didn't work. Upon closer inspection, the required libraries are part of the `omap4-common` subdirectory which is *not* sourced during the build[1]. I was nevertheless able to fix the build with the following change
Code:
% repo diff hardware/ti/omap4/
project hardware/ti/omap4/
diff --git a/pvrsrvinit/Android.mk b/pvrsrvinit/Android.mk
index 97d27c4..cdc6441 100644
--- a/pvrsrvinit/Android.mk
+++ b/pvrsrvinit/Android.mk
@@ -9,9 +9,9 @@ LOCAL_LDLIBS := -lsrv_init_SGX544_112 -lsrv_um_SGX544_112
pvrsrvinit: $(TARGET_OUT_VENDOR)/lib/libsrv_init_SGX544_112.so
pvrsrvinit: $(TARGET_OUT_VENDOR)/lib/libsrv_um_SGX544_112.so
else
-LOCAL_LDLIBS := -lsrv_init_SGX540_120 -lsrv_um_SGX540_120
-pvrsrvinit: $(TARGET_OUT_VENDOR)/lib/libsrv_init_SGX540_120.so
-pvrsrvinit: $(TARGET_OUT_VENDOR)/lib/libsrv_um_SGX540_120.so
+LOCAL_LDLIBS := -lsrv_init -lsrv_um
+pvrsrvinit: $(TARGET_OUT_VENDOR)/lib/libsrv_init.so
+pvrsrvinit: $(TARGET_OUT_VENDOR)/lib/libsrv_um.so
endif
LOCAL_MODULE_PATH := $(TARGET_OUT_EXECUTABLES)
LOCAL_MODULE := pvrsrvinit
Which means that the libraries are definitively extracted by `cd device/samsung/maguro/ && ./extract-files.sh` however, the libraries are merely named differently.
Has anybody encountered such a failure ?
ps: on another side note. how are you suppose to extract all the files from the stock 4.2.1 upstream build ? `system/bin/fRom`, `system/vendor/lib/mediadrm/libwvdrmengine.so` and `system/vendor/lib/libfrsdk.so` are missing from the image...
[0]: http://forum.xda-developers.com/showpost.php?p=59115913&postcount=1372
[1]: confirmed by `inotifywait -m vendor/samsung/omap4-common/*mk`
Btw, I looked at the content of a CM11 nightly[0], there is no trace of `libsrv_init_SGX540_120.so` or `libsrv_um_SGX540_120.so` either...
[0]: cm-11-20151213-NIGHTLY-maguro.zip

ninja: error: missing 'out/target/product/cancro/obj/lib/libtime_genoff.so.toc'

Hi, I am trying to build CM 14 for cancro (Mi3) on Ubuntu 16:10 but I am getting following error. Full logs are : http://pastebin.com/0k1i6N7v
Can someone please help me. Thanks in advance.
Code:
build/core/Makefile:34: warning: overriding commands for target `/home/kailash/android/system/out/target/product/cancro/system/vendor/lib/mediadrm/libdrmclearkeyplugin.so'
build/core/base_rules.mk:316: warning: ignoring old commands for target `/home/kailash/android/system/out/target/product/cancro/system/vendor/lib/mediadrm/libdrmclearkeyplugin.so'
Starting build with ninja
ninja: Entering directory `.'
ninja: error: '/home/kailash/android/system/out/target/product/cancro/obj/lib/libtime_genoff.so.toc', needed by '/home/kailash/android/system/out/target/product/cancro/obj/SHARED_LIBRARIES/libandroid_servers_intermediates/LINKED/libandroid_servers.so', missing and no known rule to make it
build/core/ninja.mk:151: recipe for target 'ninja_wrapper' failed
make: *** [ninja_wrapper] Error 1
make: Leaving directory '/home/kailash/android/system'
#### make failed to build some targets (37 seconds) ####
[email protected]:~/android/system$
same here
Did anyone find a solution to this?
Anyone have a solution for this?
frustrated, I have the same problem.
nousername12 said:
frustrated, I have the same problem.
Click to expand...
Click to collapse
Code:
include $(CLEAR_VARS)
LOCAL_MODULE := libtime_genoff
LOCAL_MODULE_OWNER := xiaomi
LOCAL_SRC_FILES := proprietary/vendor/lib/libtime_genoff.so
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_SUFFIX := .so
LOCAL_MODULE_CLASS := SHARED_LIBRARIES
include $(BUILD_PREBUILT)
put this in vendor/xiaomi/cancro/Android.mk can solve the problem.
from https://forum.xda-developers.com/general/xda-assist/ninjawrapper-error-t3540887

Categories

Resources