New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is it "safe" to link to libChakra.Jsrt.a? #1441
Comments
We export a flat C API to make it easy for other technologies to link against ChakraCore. The flat C API also avoids the name mangling that you would see with C++ symbols. You can consider the symbols exported as of any official ChakraCore release (e.g. release/1.2) to be stable -- and they will be maintained into the future. The following is not guaranteed, but we also try our best to make sure any APIs that are added to master are maintained into the future. So, the short answer to your question is that you can consider any APIs in master to be reasonably safe to develop against, but technically the APIs added are subject to change up until an official release. Since we don't have an official ChakraCore release yet, or have official Linux binaries for the Note that we haven't made an official release yet, but if you wanted official Windows preview builds of I'm not sure what you mean by symbols prefixed with an underscore. Our flat-C-API function symbols should not be mangled by the compiler. What command are you using to list the symbols? I used
|
Yes, I had written bindings for ChakraCore to Rust (sankha93/ChakraCore.rs) and can confirm the names are not mangled by the compiler and it works. |
I was using Using I do see a bunch of stuff like this in there, though only with the underscore.
Also, it shows up twice. |
I don't seem to have |
@Fishrock123 libChakra.Jsrt.a is not enough. See https://github.com/Microsoft/ChakraCore/blob/master/bin/ch/CMakeLists.txt#L41-L72 |
@obastemur Sorry, I don't really understand what that linked code means. I am not hugely familiar with C code so my knowledge goes as far as "there should be a (bunch of) |
@obastemur @liminzhu It might be worth explicitly documenting in the Wiki how to link against the static or dynamic Linux libraries, since at the moment I think all of our instructions about linking are Windows-specific. |
@Fishrock123 if you are comfortable with Makefile ? https://github.com/Microsoft/Chakra-Samples/tree/master/ChakraCore%20Samples/Hello%20World/Linux_OSX |
@obastemur Somewhat... are you saying what I need are these files? LDIR=$(LIBRARY_PATH)/../pal/src/libChakra.Pal.a \
$(LIBRARY_PATH)/Common/Core/libChakra.Common.Core.a \
$(LIBRARY_PATH)/Jsrt/libChakra.Jsrt.a |
Exactly + if you have
|
It would definitely be helpful if this were better documented. I may be able to (help) do that if someone can point me to where that documentation should go. |
@Fishrock123 We take PRs to the Wiki :) https://github.com/Microsoft/ChakraCore-wiki The new documentation would probably go here: https://github.com/Microsoft/ChakraCore/wiki/Embedding-ChakraCore#linuxos-x |
@Fishrock123 @liminzhu @obastemur I opened an issue re: the documentation at microsoft/ChakraCore-wiki#8. Closing this question as answered. |
@sankha93 & @obastemur I'm still having trouble linking it... Getting this from cargo:
my let lib_path = "deps/ChakraCore/BuildLinux/Test/lib/";
println!("cargo:rustc-link-search=native={}{}", lib_path,
"../pal/src/libChakra.Pal.a");
println!("cargo:rustc-link-search=native={}{}", lib_path,
"Common/Core/libChakra.Common.Core.a");
println!("cargo:rustc-link-search=native={}{}", lib_path,
"Jsrt/libChakra.Jsrt.a");
println!("cargo:rustc-link-lib=static=ChakraCore"); Note: The previous Rust bindings are windows only and use Compile instructions:
|
Looks like that was a rustc linking problem. e.g. this is the correct way: println!("cargo:rustc-link-search=native={}{}", lib_path, "Jsrt/");
println!("cargo:rustc-link-lib=static=Chakra.Jsrt"); Now I'm getting a ton of Symbol errors from clang though, even though I've also linked the icu libraries... https://gist.github.com/Fishrock123/78cefc176bfc6f87bef99a32dd965fc1 |
Update, linked |
@Fishrock123 looks like it is because of std lib references. |
@obastemur Is that something that needs to be fixed here? I'll try on Linux in a day or two. OS X 10.10.5 fwiw |
@Fishrock123 OS X 10.10.5 should work, since we support 10.9+ but if we experience problems specifically because of that then I'd say there's a compat bug. For now let's assume it's not because of OS version. |
The problem that I can see there is missing std lib references. This happens due to targeting different lib mostly. i.e. ChakraCore is built against your OS SDK while Rust targets a much older SDK. |
@obastemur is it possible to build Rust with the newer SDK or ChakraCore with the Rust version of the SDK? (Which of these options is more difficult?) |
@dilijev IMO we will target a bit earlier version of macOS SDK (also for node-chakracore). Will work on this. |
@obastemur @Fishrock123 can we open a separate work item to resolve this issue and close this Question? |
@dilijev that's cool with me, so long as it is tracked, whatever suits your workflow best. |
Opened #1492 to track SDK issue. |
I'd like to link Chakra to use it via Rust, but Rust can't read headers so I need to get Symbols directly.
I see Symbols for all the APIs in the archive, but they all are prefixed by an underscore. Are these stable? Should I expect them to change or anything else?
The text was updated successfully, but these errors were encountered: