I avoid linker problems by properly sorting the libraries.
The linker is sequential, and will fail if a given symbol is not present by 
the time it is referenced, regardless it is in another to link lib.

This is a sort order that worked for me.
 v8_base v8_libplatform v8_libbase v8_libsampler v8_snapshot v8_inspector

Other than that, I now make one single lib file will all v8 code in it. Not 
only to avoid linker errors, but to make my life easier by substantially 
reducing my mk file size.

hope this helps.


El martes, 14 de agosto de 2018, 9:02:07 (UTC+2), young louis escribió:
>
> I have a similar problem when embeding V8  6.8 to android.  An error is 
> reported while linking libv8_nosnapshot.a, briefly 
>
>
> *../../src/isolate.cc:0: error: undefined reference to 'vtable for 
> v8::internal::SetupIsolateDelegate'*
>
> Can anyone help, please.
>
> 在 2018年4月13日星期五 UTC+8下午6:37:57,Coulson Chen写道:
>>
>> I build v8 static libraries for android successfully(using V8 6.5), and 
>> then embed it in andoid app(using the hello-world.cc demo from official 
>> wiki. Android studio 3.1,Cmake),but error  like the follow takes place 
>> while building the APK
>> Build command failed.
>> Error while executing process 
>> /usr/local/v8/v8/third_party/android_tools/sdk/cmake/3.6.4111459/bin/cmake 
>> with arguments {--build 
>> /mnt/share/V8Wrapper/app/.externalNativeBuild/cmake/debug/armeabi-v7a 
>> --target native-lib}
>> [1/2] Building CXX object 
>> CMakeFiles/native-lib.dir/src/main/cpp/native-lib.cpp.o
>> [2/2] Linking CXX shared library 
>> ../../../../build/intermediates/cmake/debug/obj/armeabi-v7a/libnative-lib.so
>> FAILED: : && 
>> /usr/local/v8/v8/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++
>>   
>> --target=armv7-none-linux-androideabi 
>> --gcc-toolchain=/usr/local/v8/v8/third_party/android_ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64
>>  
>> --sysroot=/usr/local/v8/v8/third_party/android_ndk/sysroot -fPIC -isystem 
>> /usr/local/v8/v8/third_party/android_ndk/sysroot/usr/include/arm-linux-androideabi
>>  
>> -D__ANDROID_API__=16 -g -DANDROID -ffunction-sections -funwind-tables 
>> -fstack-protector-strong -no-canonical-prefixes -march=armv7-a 
>> -mfloat-abi=softfp -mfpu=vfpv3-d16 -fno-integrated-as -mthumb 
>> -Wa,--noexecstack -Wformat -Werror=format-security -std=c++11 -std=c++11 
>> -frtti -fexceptions -O0 -fno-limit-debug-info  -Wl,--exclude-libs,libgcc.a 
>> -Wl,--exclude-libs,libatomic.a --sysroot 
>> /usr/local/v8/v8/third_party/android_ndk/platforms/android-16/arch-arm 
>> -Wl,--build-id -Wl,--warn-shared-textrel -Wl,--fatal-warnings 
>> -Wl,--fix-cortex-a8 -Wl,--exclude-libs,libunwind.a 
>> -L/usr/local/v8/v8/third_party/android_ndk/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a
>>  
>> -Wl,--no-undefined -Wl,-z,noexecstack -Qunused-arguments -Wl,-z,relro 
>> -Wl,-z,now -shared -Wl,-soname,libnative-lib.so -o 
>> ../../../../build/intermediates/cmake/debug/obj/armeabi-v7a/libnative-lib.so 
>> CMakeFiles/native-lib.dir/src/main/cpp/native-lib.cpp.o  
>> /usr/local/v8/v8/third_party/android_ndk/platforms/android-16/arch-arm/usr/lib/liblog.so
>>  
>> -landroid ../../../../src/main/cpp/armeabi-v7a/libv8_base.a 
>> ../../../../src/main/cpp/armeabi-v7a/libv8_nosnapshot.a -latomic -lm 
>> "/usr/local/v8/v8/third_party/android_ndk/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/libc++.a"
>>  
>> && :
>> ../../src/isolate.cc:0: error: undefined reference to 'vtable for 
>> v8::internal::SetupIsolateDelegate'
>> /usr/local/v8/v8/third_party/android_ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld:
>>  
>> the vtable symbol may be undefined because the class is missing its key 
>> function
>> clang++: error: linker command failed with exit code 1 (use -v to see 
>> invocation)
>> ninja: build stopped: subcommand failed.
>>
>> the key point is " 'vtable for v8::internal::SetupIsolateDelegate'",is 
>> the libv8_base.a  not correct? 
>>
>> Any help is appreciated!
>>
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to