当我在 aosp(marshmallow - 6.0.1) 文件夹“frameworks/native/services/surfaceflinger/tests/resize”中编译(mm)SurfaceFlinger 测试程序“resize”。
#include <cutils/memory.h>
#include<android/native_window.h>
#include <utils/Log.h>
#include <binder/IPCThreadState.h>
#include <binder/ProcessState.h>
#include <binder/IServiceManager.h>
#include <gui/Surface.h>
#include <gui/SurfaceComposerClient.h>
using namespace android;
namespace android {
int main()
{
// set up the thread-pool
sp<ProcessState> proc(ProcessState::self());
ProcessState::self()->startThreadPool();
// create a client to surfaceflinger
sp<SurfaceComposerClient> client = new SurfaceComposerClient();
sp<SurfaceControl> surfaceControl = client->createSurface(String8("resize"),
160, 240, PIXEL_FORMAT_RGB_565, 0);
sp<Surface> surface = surfaceControl->getSurface();
SurfaceComposerClient::openGlobalTransaction();
surfaceControl->setLayer(100000);
SurfaceComposerClient::closeGlobalTransaction();
ANativeWindow_Buffer outBuffer;
surface->lock(&outBuffer, NULL);
ssize_t bpr = outBuffer.stride * bytesPerPixel(outBuffer.format);
android_memset16((uint16_t*)outBuffer.bits, 0xF800, bpr*outBuffer.height);
surface->unlockAndPost();
surface->lock(&outBuffer,NULL);
android_memset16((uint16_t*)outBuffer.bits, 0x07E0, bpr*outBuffer.height);
surface->unlockAndPost();
SurfaceComposerClient::openGlobalTransaction();
surfaceControl->setSize(320, 240);
SurfaceComposerClient::closeGlobalTransaction();
IPCThreadState::self()->joinThreadPool();
return 0;
} }
我收到以下错误。
[ 33% 2/6] target Executable: test-resize (out/target/product/rpi3/obj/EXECUTABLES/test-resize_intermediates/LINKED/test-resize)
FAILED: /bin/bash -c "prebuilts/clang/host/linux-x86/clang-2690385/bin/clang++ -pie -nostdlib -Bdynamic -Wl,-dynamic-linker,/system/bin/linker -Wl,--gc-sections -Wl,-z,nocopyreloc -Lout/target/product/rpi3/obj/lib -Wl,-rpath-link=out/target/product/rpi3/obj/lib out/target/product/rpi3/obj/lib/crtbegin_dynamic.o out/target/product/rpi3/obj/EXECUTABLES/test-resize_intermediates/resize.o -Wl,--whole-archive -Wl,--no-whole-archive out/target/product/rpi3/obj/STATIC_LIBRARIES/libunwind_llvm_intermediates/libunwind_llvm.a out/target/product/rpi3/obj/STATIC_LIBRARIES/libcompiler_rt-extras_intermediates/libcompiler_rt-extras.a prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/lib/libatomic.a prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9/bin/../lib/gcc/arm-linux-androideabi/4.9.x/libgcc.a -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--build-id=md5 -Wl,--warn-shared-textrel -Wl,--fatal-warnings -Wl,--icf=safe -Wl,--hash-style=gnu -Wl,--no-undefined-version -Wl,--no-fix-cortex-a8 -target arm-linux-androideabi -Bprebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9/arm-linux-androideabi/bin -Wl,--exclude-libs,libunwind_llvm.a -Wl,--no-undefined -lcutils -lutils -lui -lgui -lc -lc++ -lc++ -ldl -lc -lm -o out/target/product/rpi3/obj/EXECUTABLES/test-resize_intermediates/LINKED/test-resize out/target/product/rpi3/obj/lib/crtend_android.o"
out/target/product/rpi3/obj/lib/crtbegin_dynamic.o:crtbegin.c:function _start: error: undefined reference to 'main'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
make: *** [ninja_wrapper] Error 1
make: Leaving directory `/media/mukesh/myfile/android_rpi3'
帮我。