Hello,
i'm facing an issue with the linker, most likely because of lack of knowledge :/
i think i lack an include path or something like that, but i could not find something in the documentation or got confused by the Android.bp files.
i try to simple example fuzzer:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "sonic.h"
#include "wave.h"
#define BUFFER_SIZE 2048
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
short inBuffer[BUFFER_SIZE];
int foo = 10;
int bar = 1;
waveFile batz = openInputWaveFile((char*)data, &foo,&bar);
readFromWaveFile(batz,inBuffer,size);
return 0;
}
for that, i setup an Android.bp file in the subfolder "fuzz" i created.
cc_fuzz {
name: "sonic_fuzz",
host_supported: false,
srcs: [
"sonic_fuzz.cc",
],
shared_libs: [
"libsonic",
],
cflags: [
"-g",
],
cpp_std: "c++98",
}
and after i tried to build it, i get:
ld.lld: error: undefined symbol: openInputWaveFile(char*, int*, int*)
>>> referenced by sonic_fuzz.cc:16 (external/sonic/fuzz/sonic_fuzz.cc:16)
>>> out/soong/.intermediates/external/sonic/fuzz/sonic_fuzz/android_arm64_armv8-a_cortex-a73_hwasan_fuzzer/obj/external/sonic/fuzz/sonic_fuzz.o:(LLVMFuzzerTestOneInput)
ld.lld: error: undefined symbol: readFromWaveFile(waveFileStruct*, short*, int)
>>> referenced by sonic_fuzz.cc:18 (external/sonic/fuzz/sonic_fuzz.cc:18)
>>> out/soong/.intermediates/external/sonic/fuzz/sonic_fuzz/android_arm64_armv8-a_cortex-a73_hwasan_fuzzer/obj/external/sonic/fuzz/sonic_fuzz.o:(LLVMFuzzerTestOneInput)
clang-10: error: linker command failed with exit code 1 (use -v to see invocation)
23:28:40 ninja failed with: exit status 1
#### failed to build some targets (13:07 (mm:ss)) ####
do i need to include some path for the sonic library in the Android.bp file or something?
Thanks for your help
Hannes