-
Notifications
You must be signed in to change notification settings - Fork 514
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
duk cores at start with segfault on FreeBSD 11.1-RELEASE #1752
Comments
|
Could you try what happens with -DDUK_USE_SELF_TESTS and -DDUK_USE_ASSERTIONS (given to configure.py) enabled? |
|
There was an earlier FreeBSD m32 issue which is documented here: https://github.com/svaarala/duktape/blob/master/misc/clang_aliasing.c. The output from that test might also be useful. |
|
Done, hopefully I did the right thing here: |
|
One more thing worth checking out is that the Duktape source and header files are an exact match. Sometimes if a With debug symbols it would also be nice to see what duk_eval() call is causing the segfault. If there's something obviously wrong, like the packed duk_tval not working due to the aliasing issue, it's most likely the first one. If the aliasing issue is at fault, -UDUK_USE_PACKED_TVAL (given to configure.py) would help. |
|
Ok, that self test failure means all bets are off - it's most likely the clang aliasing issue mentioned above, so you could try -UDUK_USE_PACKED_TVAL (given to configure.py) and see what happens. |
|
Unsetting I will retry with Clang 5.0 from ports. Currently, the Duktape FreeBSD port is broken due to this which I need for Gerbera. Does this issue imply that |
|
Assuming you're trying to do a system-wide install:
After that, the -UDUK_USE_PACKED_TVAL takes effect for any application built and linked against libduktape.so -- provided it is compiled with the correct, matching headers. |
|
If you're not doing a system-wide install, what matters is that any application code calling into libduktape.so is compiled with the exact same headers as the library itself, i.e. the same set of duk_config.h, duktape.c, duktape.h which is written by configure.py. |
It'll be interesting to hear if this fixes the issue. So far this issue has only happened on FreeBSD, with |
|
I currently do not have a system-wide install because I need to make things run first. |
|
I've already reported it in 2013: http://lists.llvm.org/pipermail/cfe-users/2013-December/000321.html. |
|
Still worth reporting it to bugs.freebsd.org. |
|
So, I have now clang from base (4.0.0) and 4.0.1 + 5.0.0 from ports: I will report this against FreeBSD base. |
|
Can you please update the wiki for clang 4.0.1 and 5.0.0? |
|
Ok, I'll open a pull for it. |
|
Looks very likely, I'll link to these to explain the cause a bit more. Any suggestions if Duktape could do something to (a) reliably detect the issue or (b) work around it? For (a), disabling packed duk_tval for Clang prior to 5.0 (or whatever the exact version is) seems quite wrong, because this issue does not appear on e.g. Linux clang prior to 5.0 (even with -m32). I'm not sure why, but maybe there's something in the way the compiler is configured/built. So one would ideally want something more precise. Maybe "FreeBSD && clang < 5.0 && x86" would be a good check? It would mean more memory usage (because duk_tval will be larger) until clang 5.0 but it seems better than a broken build which is detected by self checks only. There's no guarantee the issue wouldn't appear elsewhere too, but this narrow case at least seems broken. For (b), I don't have a good idea of how to work around it reliably. |
|
According to the bug report linked above compiling with |
|
@fatcerberus It does, but duk_config.h has no reasonable way of detecting whether strict aliasing is used or not? |
|
So what I'm mainly after, how to work around the issue so that the build comes our working without going through segfaults and diagnosis. I would also be happy with an |
|
#1764 is a possible automatic workaround. |
|
I will try #1764. |
|
Here is the report: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=222551 |
|
It might be that the root cause is not, after all, correct if the suggested workaround doesn't work. |
|
Feel free to close this issue as it has been decently resolved. Thank you for the precious input. The FreeBSD bug report gained some traction and instruction what to do: use the port. |
|
@michael-o Ok, thanks for taking the time to run all these tests :) |
Compiled 2.1.1 on
with
dukcore immediately at start withThe text was updated successfully, but these errors were encountered: