-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
strtod issue for MSVC #6349
Comments
Interesting, I missed that you had also seen an overflow from 0 while developing that PR. Digging through the Travis logs (I wish those were searchable in an easier way...) from 5988 I see you encountered the same flisp unit test failure too. That's a good sign that this should be fixable. Having to add more C code just for MSVC to work is annoying, but I guess that's the price you have to pay to try to use such a dramatically different runtime without MinGW's headers hiding away all the differences. Hmm, looks like MinGW is using very closely-related code: https://github.com/mirror/mingw-w64/tree/master/trunk/mingw-w64-crt/gdtoa |
Ah yes, now that you mention it I also remember the overflow when I typed I have looked a little bit closer to Another candidate is |
For reference: We are not alone: The later makes me wonder if parsing hex floats is really required to run Julia. Maybe could you comment on this Jeff (@JeffBezanson) ? |
But it will be in the "next major release" whenever that is? If hex parsing is actually required for Julia, maybe it could be created as an enhancement patch to the double-conversion library? The MinGW-w64 implementation for hex string-to-double appears to be here which calls gethex. Since double-conversion already has all the bignum machinery in place and is based on pretty much the same code for the fallback case, it might be easier to add the hex capability there. |
The MinGW implementation of that code actually looks cleaner than the freebsd one as all the |
It looks like you might need the entire Bigint implementation, for The issue where hex-floats were added to Julia and flisp was #2863, and PR 2925 referenced therein. Hard to tell how much they're used in application code. I might try a cherry-pick reversal of that commit, see if it lets MSVC get any further. |
Ok but the double conversion library is currently not a build time dependency for libjulia, right? More problematic is that the interface of the c++ code is not the same as for If this would not be the issue I would try the most simple C++ solution using stringstreams. |
No, currently it is not. But adding new build time dependencies for libjulia, at least if they are small, does not seem to be too bad - for example utf8proc was added a few months ago in PR 5462. Hm okay if the API is significantly different then that may be a non-starter.
|
The issue with the C++ solution is that it does not give us the endpoint character. I am not sure how bad this is. Jeff indicated in #5988 (comment) that it would be a problem. The C++ solution definately solves the delimiter issue. I am not sure about the hex thing though. |
Tried it with VS2010 and using the |
Bah. Seems silly to me to have to re-implement a piece of the C runtime, but I guess it's either that or selectively disable the hex-parsing capability somehow? I'm also wondering out loud whether the more serious |
Indeed this is silly. And actually its as silly as one of the major C compiler vendor not implementing C99... I am also not sure if the overflow error has anything to do with the |
I have just tried what I suggested in my previous post and it worked (on OSX): no hex floats working but |
You meant inside the if statement about hex floats, right? That's a few lines lower now. But yeah, tried it, still overflow in numeric constant "0": https://ci.appveyor.com/project/tkelman/julia/build/1.0.334 How do we attempt to debug that? |
Yes I meant inside the if statement. Hm, not sure how to go further. I am not entirely sure at which point the error happens. Is it when compiling the system image? I am right that you can currently only run this through AppVeyor and thus have no possibilities to debug it direktly, right? What comes to my mind is to get libjulia.dll and julia.exe out of AppVeyor (from a debug build) and debug this locally with WinDbg or Visual Studio. Maybe Jamson has an idea (@vtjnash)? |
Yes it's while building the system image, but the error looks like it's coming from the parser. I installed VS 2013, but I couldn't get your build of LLVM to work. Errors about conflicting stdlibs, libcmt ( What do we need for a debug build, besides |
I think the flags will be sufficiant. Then one has to put files inside of a julia development environement, execute the command to build the sys image and attach via a debugger. If you could get a backtrace from where the error happens, this will certainly help understanding whats going on. |
I can't get a backtrace because I have no idea how to set breakpoints for errors that happen in |
Could you have a look at this thread where Jameson gives some very good debugging intructions: JuliaGraphics/Gtk.jl#69 Anyway. The trick is to set a breakpoint at |
I've had some luck with debugging and breakpoints in the past with the assembly issues or other system image crashes, but with this one I can't seem to get any useful debugging done - it's not stopping at any of the breakpoints I've set. If I ask for a call stack after the error has already been shown, I get this:
Don't know whether or not that's meaningful. |
Got LLVM built locally so now I'm getting more useful backtraces:
|
If you walk the stack back to the jl_error function, you may be able to print the error message Julia wanted to print there |
From |
I know what the error is, it's |
Ok, if I look at src/flisp/read.c:119 I can see that s similar error is triggered when the errno is set to One try: Could you replace all occurrences (should be 4) of |
Another idea is to look at the while loop in |
Hm, that is interesting, but the error is saying |
Ok, was just a try. The actual error message is in the parser code as you have already mentioned. I think the most important thing is to understand, what is actually parsed when the error happens. What is the exact command that you call julia.exe? |
|
Ok, so it basically executes the sysimg.jl file. Now it would be helpful to understand at which line/expression the error occurs. This can be either done be some printf like debugging using |
As I predicted, looks like the resolution for hex I might give the CTP a try if anyone is still interested in seeing MSVC Julia happen. |
@tkelman just looked at your last post, and it looks like it ran out of stack space. this is unsurprising, since llvm needs ~2.5MB during sysimg compile, and the windows default is 1MB. we add a flag to all binaries built by mingw to get around this, changing the value to the unix default of 8MB. for gcc/clang the flag is an MSVC julia would still be nice to have. getting an issue closed without doing any specific work(-arounds) for it is also awesome. |
Googling tells me |
@tkelman Might it be a good idea to open a dedicated issue where the state of MSVC compilation of Julia is documented? You have got so far that it would be really nice to see this in actual action. |
Feels like it would be noise right before a release. I'll get back to this eventually. |
I don't think that all post 0.3 issues have to be silent before a release but of course you are right that it is not a pressing issue currently. I just realized that there are some MSVC compatibility issues (by you and me) that are already closed because the bits have been merged. And thus it would be nice to have an issue that is open as long as full MSVC compilation is achieved. |
Closing due to #7761. |
No, #7761 does not close this at all. Using the next version of MSVC might, but that's not out for at least another few months. |
I realise this is probably insane, but would it be at all feasible to implement string to float conversion in julia itself? Or is this required too early in the build step? |
No not insane but it is required quite early in the parser (flisp). So one would have a boostraping issue :-) |
I think the preview edition of the next visual studio is available now actually, if anyone's feeling adventurous. You'll need to build your own LLVM with it first though. |
One (hypothetical) advantage of implementing it ourselves: we could have non-standard literals, e.g. bit float ( |
I tested and |
Hey, that is really good news. Is VS2015 officially released yet, or is it still a ctp? (unrelated but pretty neat - the .NET JIT and GC were just open-sourced: https://github.com/dotnet/coreclr) |
Anyone want to build LLVM (not sure which version - either our patched 3.3, or 3.5.1, or the latest 3.6 branch?) using the latest VS 2015 CTP and post the binaries? I don't have it installed, and it's a pretty huge download. AppVeyor has a test image with the latest CTP installed, but my LLVM binaries from VS 2013 aren't going to work there. |
@Mike43110 are you sure you were building in 64 bit mode? C or C++ code? Looks like the VS 2015 CTP is finally able to compile C99 in C mode, only 15 years late. Though I am having some issues with the inline assembly still. (working branch at https://github.com/tkelman/julia/compare/appveyor2)
|
I checked again. Is an x64 llvm necessary? I have (I think, need to test) a working x86 llvm. It builds fine at least. However, an x64 llvm fails to build. I built (or I hope I built) llvm-svn. It takes about an hour to build, debug takes even longer. If there are any requirements for how llvm must be built please list. Once I am sure it's correct I will happily post the binaries. I should also be able to build an msvc one whenever its needed. My wonderful internet and the fact that my country is undergoing load-shedding (power cuts) may mean that it will take a few hours to post but hopefully it will help. Two unrelated notes: The .NET news is quite good! Quite interested to test it once they release build guides for Linux. Hoping they will release gui related things. I understood it that it is only console and asp.net for now. Still progress! I will download the 3.6 branch and build it as well. |
Actually we won't need llvm binaries until we can figure out a workaround for the inline assembly, so don't worry about it too much at this point. From some experiments on appveyor, it looks like compiling in 64 bit, in C mode (which now works for C99, it appears) instead of C++, the |
Think this can be closed since building Julia with MSVC is no longer officially supported. |
In #6230 it came up that that the flisp unit test did not compile when using MSVC. The issue is that the
strtod
function does not support hex values when using the MSVC runtime. I have just tried this out on VS2010 and can confirm this.Funnily this means that all the attempts in #5988 to use the MSVC runtime in order to use
_strtod_l
would have been useless.To solve the issue I think we have to try
http://mirror.fsf.org/pmon2000/3.x/src/sdk/libc/stdlib/strtod.c
again. I once got it almost working but had an error which was actually unrelated (forgot to cleanall).
Would be intersting if the ability to parse hex values is really required for running julia.
(notify @tkelman out this issue)
The text was updated successfully, but these errors were encountered: