JavaScriptCore-iOS icon indicating copy to clipboard operation
JavaScriptCore-iOS copied to clipboard

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

Open shahdhiren opened this issue 9 years ago • 7 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?

shahdhiren avatar Nov 25 '14 07:11 shahdhiren

+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

carrotcomputer avatar Dec 18 '14 17:12 carrotcomputer

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?

phoboslab avatar Dec 27 '14 20:12 phoboslab

+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.

denkeni avatar Jan 19 '15 10:01 denkeni

+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)

weakfl avatar Feb 10 '15 12:02 weakfl

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 avatar Feb 12 '15 03:02 denkeni

@denkeni: Nice solution, thanks.

weakfl avatar Feb 12 '15 09:02 weakfl

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.

phoboslab avatar Feb 12 '15 10:02 phoboslab