phoboslab / JavaScriptCore-iOS

Apple's JavaScript Engine, with modified project files for iOS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Using Compiled version of JavascriptCore library/framework gives compile time error

shahdhiren opened this issue · comments

I am able to successfully build JSC library and while trying to use it in my project gives below error

Undefined symbols for architecture armv7:
  "std::__1::__call_once(unsigned long volatile&, void*, void (*)(void*))", referenced from:
      JSC::initializeThreading() in libiOSJavaScriptCore.a(InitializeThreading.o)
      WTF::initializeCompilationThreads() in libiOSJavaScriptCore.a(CompilationThread.o)
  "void std::__1::__sort<std::__1::__less<unsigned long, unsigned long>&, unsigned long*>(unsigned long*, unsigned long*, std::__1::__less<unsigned long, unsigned long>&)", referenced from:
      JSC::DFG::NaturalLoops::compute(JSC::DFG::Graph&) in libiOSJavaScriptCore.a(DFGNaturalLoops.o)
  "void std::__1::__sort<std::__1::__less<unsigned int, unsigned int>&, unsigned int*>(unsigned int*, unsigned int*, std::__1::__less<unsigned int, unsigned int>&)", referenced from:
      JSC::JSObject::getOwnPropertyNames(JSC::JSObject*, JSC::ExecState*, JSC::PropertyNameArray&, JSC::EnumerationMode) in libiOSJavaScriptCore.a(JSObject.o)
      JSC::DFG::Graph::dumpBlockHeader(WTF::PrintStream&, char const*, JSC::DFG::BasicBlock*, JSC::DFG::Graph::PhiNodeDumpMode, JSC::DumpContext*) in libiOSJavaScriptCore.a(DFGGraph.o)
      JSC::computePreciseJumpTargets(JSC::CodeBlock*, WTF::Vector<unsigned int, 32ul, WTF::CrashOnOverflow>&) in libiOSJavaScriptCore.a(PreciseJumpTargets.o)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I have verified all the required architecture of JSC and my project and it is common. But still while using JSC library I am having above error. Can you please suggest what is problem in above errors?

+1 to this. Tried all kinds of variations of JavascriptCore and cannot compile. My issue is mainly around arm64, but tried armv7 with no success either

All architectures (armv7, armv7s, arm64, i386, x86_64) compile cleanly for me with XCode 6.1 installed. Are you using the make.py as stated in the README?

+1 the same issue. JavaScriptCore can be built successfully, but the problem lies in compiling working project using the pre-compiled JavaScriptCore library, with Xcode 6.1.1. No luck with one built by Xcode 6 or copied from Ejecta project.

+1, same issue.
Did build using make.py as stated in the README. Also using Xcode 6.1.1.

Undefined symbols for architecture armv7:
  "void std::__1::__sort<std::__1::__less<unsigned long, unsigned long>&, unsigned long*>(unsigned long*, unsigned long*, std::__1::__less<unsigned long, unsigned long>&)", referenced from:
      JSC::DFG::NaturalLoops::compute(JSC::DFG::Graph&) in JavaScriptCore(DFGNaturalLoops.o)
  "void std::__1::__sort<std::__1::__less<unsigned int, unsigned int>&, unsigned int*>(unsigned int*, unsigned int*, std::__1::__less<unsigned int, unsigned int>&)", referenced from:
      JSC::JSObject::getOwnPropertyNames(JSC::JSObject*, JSC::ExecState*, JSC::PropertyNameArray&, JSC::EnumerationMode) in JavaScriptCore(JSObject.o)
      JSC::DFG::Graph::dumpBlockHeader(WTF::PrintStream&, char const*, JSC::DFG::BasicBlock*, JSC::DFG::Graph::PhiNodeDumpMode, JSC::DumpContext*) in JavaScriptCore(DFGGraph.o)
      JSC::computePreciseJumpTargets(JSC::CodeBlock*, WTF::Vector<unsigned int, 32ul, WTF::CrashOnOverflow>&) in JavaScriptCore(PreciseJumpTargets.o)
  "std::__1::__call_once(unsigned long volatile&, void*, void (*)(void*))", referenced from:
      JSC::initializeThreading() in JavaScriptCore(InitializeThreading.o)
      WTF::exchangeIsCompilationThread(bool) in JavaScriptCore(CompilationThread.o)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

A workaround here. We built this project for arm64 slice in order to build our project for Standard architectures (armv7, arm64). But since Apple's arm64 devices all start at least iOS 7, we should be safe to drop this project in favor of iOS 7 built-in JavaScriptCore framework for arm64:

#ifdef __LP64__
#import <JavaScriptCore/JavaScriptCore.h>       // use iOS7 JavaScriptCore framework
#else
#import <JavaScriptCore-iOS/JavaScriptCore.h>   // use PhobosLab JavaScriptCore-iOS
#endif

So this project could be retired. Thanks for the contribution so far.

@denkeni: Nice solution, thanks.

Sadly, we still need this custom JSC version for Ejecta, because the official JSC doesn't yet have an API to read/write Typed Arrays.

See: https://bugs.webkit.org/show_bug.cgi?id=120112

No idea what's going wrong with compilation, though. Last time I tried it, everything compiled smoothly.