-
Notifications
You must be signed in to change notification settings - Fork 440
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
STATIC ERROR: std.jsonnet:1:1: Unexpected end of file. #380
Comments
fixing this issue: google#380
Thanks for reporting the issue. Could you provide some more details?
The Here is some more context in case you are interested: |
Hey! Sorry for providing so few information. These are the commands and versions and all of that, sorted by their time of installation: Versions:
Commands:all executed in one session in the local jsonnet repo
The thing is, I don't really understand C++ and things involved with it, so I kinda brute forced the available build options to get jsonnet to work on a Windows machine. So some things probably were downloaded or installed already half way through when they threw an error. I currently can't reproduce this issue with another, "clean" Windows 10 machine, because I simple don't have another and didn't want to reset all of the requirements I installed on my current machine, I hope that's understandable 😄. I try to provide you with the infromation relevant to what I think finally built the jsonnet.exe for command line: I already had Python 2.7 and Python 3.6, but I needed msys2 packages and the Java JDK 8 to get Bazel to work. So I downloaded and installed them successfully. Then I downloaded and installed Bazel with chocolatey, the first few times it wasn't working because some requirements weren't installed, then finally I got it. Then I cloned the jsonnet repository to my desktop and tried to build it with Bazel. This wasn't working several times because my pc needed some Windows build tools, SDK, C++ stuff and Visual Studio 2017. Installing these things was a little depressing and took so crazy long, but after that, the bazel build command for jsonnet didn't show errors anymore. Yay! So I thought jsonnet finally works now. Tried it out, didn't work. It just showed me the error So I looked in the repository for this file name and found two files, the std.jsonnet and the std.jsonnet.h. The std.jsonnet.h was empty, the std.jsonnet wasn't. So I thought: "Yeah, the .h file probably gets built from the std.jsonnet file when running the bazel build command. So I opened the .jsonnet file in Visual Studio Code and the jsonnet syntax extension for it showed me an error immediately: So removed the colon, entered the bazel build command again. And yay, now everything was working fine. So to finally answer your three questions 😆:
As I said, I cloned the repository directly, and that was two days ago, so my local version of the repo is identical to the current master branch here, which was updated four days ago the last time. And yes, I retried this whole process (not the whole process, but you know, cloned the "clean" repo again and executed the build command). The final jsonnet file compile command still only works if I remove the colon from std.jsonnet and build jsonnet again. Thank you for reading! I hope this is somehow helpful. 🌷 |
Thanks for the detailed explanation. You may be one of the first people to use it on Windows, so you're exploring some uncharted territory. Anyway, we want to provide proper experience on Windows too, so that's very helpful! I doubt that it's the colon that made the difference (we don't lex or parse it at all at this point, we just convert it to a comma separated list of byte values, using a bunch of piped commands https://github.com/google/jsonnet/blob/master/stdlib/BUILD#L20). My working theory is that it's something else that your editor did (newlines? modification time?). In particular I suspect that if you added the colon back it would still work. I don't have any Windows machine available, but I'll try to get one soon to get to the bottom of this. |
Wow. Yes. You're right. :D Just cloned the repository to a new test folder, and it works, untouched...so probably the colon wasn't even significant at all... smh 😆 whywhywhywhy😢 So I guess this has something to do with corrupted c++ or bazel or visual studio installations? Meh. I will never be able to reproduce this issue. But now that I actually know how to build jsonnet on Windows, I would be the perfect person to write the docs for it, haha! Yeah...no. I'm not a native english speaker and couldn't keep it simple and short. But I tried to make a short list of steps, maybe that's useful in the future:
Should work on every system >= Windows 7. |
Ok, I got a Windows machine. So far I was able to build jsonnet using g++ and make (installed using pacman/msys2). The
I haven't tried VS or bazel yet. |
If I had to guess, I would say that this rule is not working properly on Windows:
|
The std.jsonnet file is "compiled" into a C file where it is represented as an array of bytes. This makes it easy to link it into the Jsonnet binary. So std.jsonnet.h should not be empty, it should be a very long file of comma separated decimal byte numbers (all on one line) and it should be in bazel-genfiles/stdlib/std.jsonnet.h |
Did this get resolved? If not I'm inclined to close it as we have no other reports like it. Thanks |
It worked for me and @nnmrts in the end, so it can be closed IMO. |
Replace `setup.py test` with pytest command
Hey! I tried using the binary version of jsonnet. However, whatever I do, it gives me back this error:
STATIC ERROR: std.jsonnet:1:1: Unexpected end of file.
I read on the jsonnet webpage here, that std or stdlib is kind of a utility functions object for jsonnet itself. The error message suggests that the file is empty. Unfortunately we don't know really, which file is meant, it could be the std.jsonnet or the std.jsonnet.h file. At first I thought it's the first one, but that was full with 42kb of data. However, the problem is, there is an error, as I just discovered. A specific unexpected token prevents the file from being built and so the std.jsonnet.h file is empty in the end.
Will create a pull request fixing this issue and reference it here. Sorry for even submitting this issue now that I already discovered what the actual issue is. Nevertheless, I think it will bring more clarity to my pull request.
The text was updated successfully, but these errors were encountered: