Closed mrmaffen closed 7 years ago
According to this stackoverflow answer, it might be a bug in the NDK itself. To paraphrase, the answer proposed adding -m32 to LOCAL_CFLAGS in Android.mk (I'd imagine in J2V8 in this case, not V8 itself). Have you tried that?
@KnownUnown Looks like the ndk bug only applies to x86 builds. The build that crashes with a SIGILL for me is armv8a though :/. But using a different NDK version seems like a good idea. I'll try that now ...
@KnownUnown I was using the NDK r10e before. I've tried every other available release and wasn't able to successfully build the library. Seems like the NDK has changed quite a bit after r10e, therefore a lot of errors are popping up with later releases.
#include <unistd.h>
extern unsigned int __page_size = getpagesize();
[armeabi] SharedLibrary : libj2v8_android_armeabi.so
/home/mrmaffen/v8-builder/v8/out/android_armeabi.release/obj.target/tools/gyp/libv8_base.a(/home/mrmaffen/v8-builder/v8/out/android_arm.release/obj.target/v8_base/src/assembler.o):assembler.cc:function std::__1::basic_ostream<char, std::__1::char_traits<char> >::sentry::~sentry(): error: undefined reference to 'std::__1::ios_base::clear(unsigned int)'
/home/mrmaffen/v8-builder/v8/out/android_armeabi.release/obj.target/tools/gyp/libv8_base.a(/home/mrmaffen/v8-builder/v8/out/android_arm.release/obj.target/v8_base/src/assembler.o):assembler.cc:function std::__1::basic_ostream<char, std::__1::char_traits<char> >::flush(): error: undefined reference to 'std::__1::ios_base::clear(unsigned int)'
/home/mrmaffen/v8-builder/v8/out/android_armeabi.release/obj.target/tools/gyp/libv8_base.a(/home/mrmaffen/v8-builder/v8/out/android_arm.release/obj.target/v8_base/src/assembler.o):assembler.cc:function std::__1::basic_ostream<char, std::__1::char_traits<char> >::operator<<(void const*): error: undefined reference to 'std::__1::ios_base::getloc() const'
/home/mrmaffen/v8-builder/v8/out/android_armeabi.release/obj.target/tools/gyp/libv8_base.a(/home/mrmaffen/v8-builder/v8/out/android_arm.release/obj.target/v8_base/src/assembler.o):assembler.cc:function std::__1::basic_ostream<char, std::__1::char_traits<char> >::operator<<(void const*): error: undefined reference to 'std::__1::locale::use_facet(std::__1::locale::id&) const'
/home/mrmaffen/v8-builder/v8/out/android_armeabi.release/obj.target/tools/gyp/libv8_base.a(/home/mrmaffen/v8-builder/v8/out/android_arm.release/obj.target/v8_base/src/assembler.o):assembler.cc:function std::__1::basic_ostream<char, std::__1::char_traits<char> >::operator<<(void const*): error: undefined reference to 'std::__1::locale::~locale()'
/home/mrmaffen/v8-builder/v8/out/android_armeabi.release/obj.target/tools/gyp/libv8_base.a(/home/mrmaffen/v8-builder/v8/out/android_arm.release/obj.target/v8_base/src/assembler.o):assembler.cc:function std::__1::basic_ostream<char, std::__1::char_traits<char> >::operator<<(void const*): error: undefined reference to 'std::__1::ios_base::getloc() const'
/home/mrmaffen/v8-builder/v8/out/android_armeabi.release/obj.target/tools/gyp/libv8_base.a(/home/mrmaffen/v8-builder/v8/out/android_arm.release/obj.target/v8_base/src/assembler.o):assembler.cc:function std::__1::basic_ostream<char, std::__1::char_traits<char> >::operator<<(void const*): error: undefined reference to 'std::__1::locale::use_facet(std::__1::locale::id&) const'
/home/mrmaffen/v8-builder/v8/out/android_armeabi.release/obj.target/tools/gyp/libv8_base.a(/home/mrmaffen/v8-builder/v8/out/android_arm.release/obj.target/v8_base/src/assembler.o):assembler.cc:function std::__1::basic_ostream<char, std::__1::char_traits<char> >::operator<<(void const*): error: undefined reference to 'std::__1::locale::~locale()'
/home/mrmaffen/v8-builder/v8/out/android_armeabi.release/obj.target/tools/gyp/libv8_base.a(/home/mrmaffen/v8-builder/v8/out/android_arm.release/obj.target/v8_base/src/assembler.o):assembler.cc:function std::__1::basic_ostream<char, std::__1::char_traits<char> >::operator<<(void const*): error: undefined reference to 'std::__1::ios_base::clear(unsigned int)'
/home/mrmaffen/v8-builder/v8/out/android_armeabi.release/obj.target/tools/gyp/libv8_base.a(/home/mrmaffen/v8-builder/v8/out/android_arm.release/obj.target/v8_base/src/assembler.o):assembler.cc:function std::__1::basic_ostream<char, std::__1::char_traits<char> >::operator<<(void const*): error: undefined reference to 'std::__1::num_put<char, std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> > >::id'
/home/mrmaffen/v8-builder/v8/out/android_armeabi.release/obj.target/tools/gyp/libv8_base.a(/home/mrmaffen/v8-builder/v8/out/android_arm.release/obj.target/v8_base/src/assembler.o):assembler.cc:function std::__1::basic_ostream<char, std::__1::char_traits<char> >::operator<<(void const*): error: undefined reference to 'std::__1::ctype<char>::id'
/home/mrmaffen/v8-builder/v8/out/android_armeabi.release/obj.target/tools/gyp/libv8_base.a(/home/mrmaffen/v8-builder/v8/out/android_arm.release/obj.target/v8_base/src/assembler.o):assembler.cc:function std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned int): error: undefined reference to 'std::__1::ios_base::getloc() const'
/home/mrmaffen/v8-builder/v8/out/android_armeabi.release/obj.target/tools/gyp/libv8_base.a(/home/mrmaffen/v8-builder/v8/out/android_arm.release/obj.target/v8_base/src/assembler.o):assembler.cc:function std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned int): error: undefined reference to 'std::__1::locale::use_facet(std::__1::locale::id&) const'
etc ...
Lots of people on stackoverflow simply seem to suggest that this can best be solved by reverting to NDK r10e. Which doesn't help in my case obviously :/
@irbull Do you intend to add support for armv8a and x86_64 or do you have suggestions on what I should try next? I don't know if all the time I'm spending on getting this to work is really worth it or if I should just wait until you can find the time to dig into it. I'd assume you're much more knowledgeable about all this than me :)
I'm currently trying to get arm
and x86
builds working (actually I published a 4.7.0-SNAPSHOT
to maven central last night based on the build work that @KnownUnown did). The aar
is larger than it was in the past, and I'm trying to get the filesize down. Once I've solved that, I can look at other platforms.
As for your specific references, are these related to I18L and ICU? Did you get these errors when you were building the J2V8 .so files, or when you were building node / v8?
@irbull The "undefined reference" errors occurred when I ran ndk-build (with NDK r14b) for the j2v8 project itself. It builds just fine with NDK r10e but every version after that produces the above mentioned "undefined reference" errors.
This works is finally complete and in master. Thanks again to @KnownUnown and others who helped. You can now build this form Android by
git clone https://github.com/eclipsesource/J2V8
cd j2v8
curl -O http://download.eclipsesource.com/j2v8/v8/node.out-7_4_0.tar.gz
./buildAll.sh
The curl
statement downloads the prebuild node.js. You can build that yourself if you'd like. It comes from (github.com/eclipsesource/static-node-build). buildAll.sh
will use docker containers to build Android.arm Android.x86 and Linux.x64. The Tests are run in the linux container. The Android arm and x86 so
files are copied out, and placed in the proper resource directory.
@irbull Where should -D NODE_COMPATIBLE=1
be put so that NodeJS can be added to Android build? And after ./buildAll.sh
how do I generate .aar
file. I am not that good in C/C++ programming, would appreciate help on this :smile: .
Hi there,
this project is pure awesomeness. I'd love to use it in my Android app, however I don't want to drop support for my armv8 and x86_64 builds. That's why I have tried to build it myself and after a few hours of trying and mostly thanks to this how-to https://gist.github.com/magmastonealex/a9158173828932def9ffb81672d6c578 I was actually able to compile the build successfully. The resulting armv8a works just fine when I run my app on an armv8a emulated avd device. But when I start it on my Galaxy S7 the app crashes with a SIGILL:
Do you know what's going on here? I'm not that knowledgeable when it comes to native coding in c... mainly a Java/JS/Python guy. I'd love to get this to work.
Thanks for your help!