I am trying to create a debug build of SpiderMonkey and load it as a library in a different C++ project while exposing internal APIs like the BytecodeEmitter, etc.
I tried updating the moz.build files:
EXPORTS.frontend += [
"frontend/AbstractScopePtr.h",
"frontend/AsyncEmitter.h",
"frontend/BytecodeCompiler.h",
"frontend/BytecodeControlStructures.h",
"frontend/BytecodeEmitter.h",
...
After the build I tried to load up the project
include_directories(
${SPIDERMONKEY_OBJ_DIR}/dist/include
)
...
target_link_libraries(metal_monkey PRIVATE
${ICU_LIBRARIES}
/home/mm/wd/mozilla-unified/obj-debug-x86_64-pc-linux-gnu/js/src/build/libjs_static.a
z
dl
pthread
stdc++
)
But the build fails with a bunch of linker errors
[100%] Linking CXX executable mmm
/usr/bin/ld: /home/mm/wd/mozilla-unified/obj-debug-x86_64-pc-linux-gnu/js/src/build/libjs_static.a(Unified_cpp_js_src18.o): in function `mozilla::Array<js::GlobalObjectData::ConstructorWithProto, 95ul>::operator[](unsigned long) const':
/home/mm/wd/mozilla-unified/obj-debug-x86_64-pc-linux-gnu/dist/include/mozilla/Array.h:51: undefined reference to `mozilla::detail::InvalidArrayIndex_CRASH(unsigned long, unsigned long)'
/usr/bin/ld: /home/mm/wd/mozilla-unified/obj-debug-x86_64-pc-linux-gnu/dist/include/mozilla/Array.h:51: undefined reference to `mozilla::detail::InvalidArrayIndex_CRASH(unsigned long, unsigned long)'
/usr/bin/ld: /home/mm/wd/mozilla-unified/obj-debug-x86_64-pc-linux-gnu/dist/include/mozilla/Array.h:51: undefined reference to `mozilla::detail::InvalidArrayIndex_CRASH(unsigned long, unsigned long)'
/usr/bin/ld: /home/mm/wd/mozilla-unified/obj-debug-x86_64-pc-linux-gnu/dist/include/mozilla/Array.h:51: undefined reference to `mozilla::detail::InvalidArrayIndex_CRASH(unsigned long, unsigned long)'
/usr/bin/ld: /home/mm/wd/mozilla-unified/obj-debug-x86_64-pc-linux-gnu/dist/include/mozilla/Array.h:51: undefined reference to `mozilla::detail::InvalidArrayIndex_CRASH(unsigned long, unsigned long)'
/usr/bin/ld: /home/mm/wd/mozilla-unified/obj-debug-x86_64-pc-linux-gnu/js/src/build/libjs_static.a(Unified_cpp_js_src18.o): in function `mozilla::IsUtf8(mozilla::Span<char const, 18446744073709551615ul>)':
...
I know this is not the intended mode of operation but I wanted to experiment a bit with SpiderMonkey without directly modifying the source code, any help is appreciated
I am a beginner to the project so I apologize for dumb questions