-
Notifications
You must be signed in to change notification settings - Fork 236
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
mingw issue with executable path #42
Comments
What are the first 20 bytes of the file? |
To clarify, the test and log is from a Windows 10 build with msys2 mingw64 compiler. I haven't been able to get the tests (make check) build under Linux mingw64 cross compiler. I will try to build the app under msys2 to see if there's different behaviour...
Let me know, and I will send you the executable if that helps. |
Thanks. The start of that file looks fine. I don't see how it could produce that error. Can you run it under the debugger and see what is happening? The error is being returned by the function |
I ran it under the debugger, but it had errors before it got to that error, so I decided to reduce the complexity and used an example program that has minimal complexity and corrected for passing the executable path to backtrace_create which was suspect. So now I'm just still seeing no trace but no errors. However not to run too far ahead looking at btest nothing works:
Is this meant to work under Mingw / MSVC? Either way I think btest.c is the place to start looking for the problems? I guess it won't work with MS compiler as it uses gcc specifics. |
I did a bit of a code dive and the problem seems to be that |
Some more notes before i head to bed.
|
@matanui159 To clarify the initial problem didn't had to do with GetModuleFileName. It had to do with the variable passed to backtrace_create_state which in my case was temporary for some reason. Now both argv[0] and GetModuleFileName work under both wine and msys2 under Windows. They both return the same path under wine and msys2 for me, and they're windows paths. So that doesn't seem to be the problem anymore, and wasn't the problem in the case of btest.c.
|
Also as a side note I noticed that if it fails to open the provided filename it falls back to alternatives. It would be nice if it failed with an error straight away if it couldn't open the provided filename since it would make issues like this easier to debug. |
Yes I agree @matanui159. I'm opening another issue for the remaining problem which is that with mingw the library doesn't work. |
I'll probably keep looking into that today although it will be slightly biased since I'm running it under wine on Linux. I really wanna get this project working, it's a really neat little library. |
FWIW, whereami might be a more robust way to automatically determine the executable file name. This also works on MSYS2/Windows: https://github.com/gpakosz/whereami. |
Commenting on this to raise awareness, and see if a work-around can be identified. I'm using Gfortran 9.2 on msys2/mingw64 and it exhibits what may be the same problem. In my case when a segfault is issued, gfortran runtime uses libbacktrace to print the stack. The result I see on windows msys2/mingw64 is the following:
I don't observe any infinite loop. It stops at |
This was most likely fixed by c1c86fa. Please comment if it is still a problem. Thanks. |
Getting the following error from callback after backtrace_full:
Then it it's an infinite loop of last error. Under Linux it runs fine.
Environment:
Statically linked executable
ExceptionTest.exe: PE32+ executable (console) x86-64, for MS Windows
OS:Ubuntu/Wine
MXE static compiler
Any clues?
The text was updated successfully, but these errors were encountered: