Repository navigation
Debug/checking build, macOS 15.5, clang 20, emacs-mac-gnu_master_exp #41
Replies: 8 comments 6 replies
|
Hmm, I've haven't recently tried So perhaps leave it as Also, please don't try to run the app directly from the and it works fine. |
|
I can confirm the same crash occurs due to clang v20: It seems newer clang has revealed an autorelease memory issue in the GUI queue synchronization. I think I may have an idea for a fix, but in the meantime, you can just use the system clang. |
|
JD Smith ***@***.***> writes:
Hmm, I've haven't recently tried --enable-checking=yes. I just gave it a try on the emacs-30 tracking branch and had no
trouble. @simmsb, would you be able to give --enable-checking=yes on master? Most likely your clang version is causing
problems. I have:
configure:9281: gcc --version >&5
Apple clang version 17.0.0 (clang-1700.0.13.5)
Target: arm64-apple-darwin24.5.0
Thread model: posix
So perhaps leave it as gcc.
Thansk. Using now, from config.log:
```
$ /Users/gerd/emacs/github/emacs-mac/configure --enable-mac-app=/Users/gerd/emacs/github/emacs-mac/self-contained --enable-mac-self-contained --cache-file /var/folders/1d/k_6t25f94sl83szqbf8gpkrh0000gn/T//config.cache.emacs-mac --enable-checking=yes --with-native-compilation=no CC=/usr/bin/clang 'CFLAGS=-Wgnu-imaginary-constant -Wunused-result -g -g -O0 -Wno-ignored-attributes -Wno-flag-enum -Wno-missing-method-return-type -Wno-variadic-macros -Wno-strict-prototypes -Wno-availability -Wno-nullability-completeness'
configure:9366: /usr/bin/clang --version >&5
Apple clang version 17.0.0 (clang-1700.0.13.5)
Target: arm64-apple-darwin24.5.0
```
I get the same crash and so on as with Clang 20 when starting `src/emacs
-Q`.
Also, please don't try to run the app directly from the mac/ directory, run make-install. If you want to build the App
somewhere temporary, config with --enable-mac-app=/path/to/dir --enable-mac-self-contained. E.g. I just tried:
./configure --with-native-compilation --with-tree-sitter --enable-mac-app=/tmp --enable-mac-self-contained --enable-checking='yes,glyphs'
make -j6
make install
/tmp/Emacs.app/Contents/MacOS/Emacs -Q
and it works fine.
I've changed my script to install into `<repo>/self-contained`, see
config.log above. The installation creates an `Emacs.app` there that I can
launch when built with Clang 17 but not when built with Clang 20.
|
|
BTW,
then the build would be much closer to the nextstep build. and easier by default, at least IMO. |
|
Got it working now with my plus adding No errors or crashes so far, and performance on my MBP screen is at least as good as NS, if not better. |
|
JD Smith ***@***.***> writes:
I get the same crash and so on as with Clang 20 when starting src/emacs -Q.
Yeah this is not a supported start mechanism. You can
/Users/gerd/emacs/github/emacs-mac/self-contained/Emacs.app/Contents/MacOS/Emacs
-Q instead.
Yes, but I hate it :-). The "make install" this requires slows down
development.
Sounds like it works with Clang 17, which is good news.
Yeah, it seems to work. I have still have to tweak my init.el a bit, to
get things working work like I'm used to, but everything looks good so
far. No insurmountable problems. Quite nice.
If you have ideas to hunt down the EXC_BAD_ACCESS on Clang 20 I'd be
open. I played with clang's address sanitizer and Instruments.app
leaks, but it notices lots of things (which is probably because it
knows nothing about Emacs' GC). Please see #43; ideas and data very
welcome.
These warnings make ma a bit nervous:
macappkit.m:1150:23: warning: null passed to a callee that requires a non-null argument [-Wnonnull]
1150 | handlerRefCon:0];
| ^
macappkit.m:10066:5: warning: misleading indentation; statement is not part of the previous 'else' [-Wmisleading-indentation]
10066 | mac_within_app (^{
| ^
macappkit.m:10059:3: note: previous statement is here
10059 | else
| ^
macappkit.m:13990:5: warning: misleading indentation; statement is not part of the previous 'else' [-Wmisleading-indentation]
13990 | {
| ^
macappkit.m:13985:3: note: previous statement is here
13985 | else
| ^
Maybe this invokes UB, and clang 20 feels entitled to do strange things?
|
|
JD Smith ***@***.***> writes:
Yes, but I hate it :-). The "make install" this requires slows down development.
True. I have been able to avoid it by linking in the native-lisp
directory and running the app from mac/Emacs.app to speed up the
development cycle; see the README. For some reason Emacs.pdmp gets
mishandled at times, but then I just delete it from
Emacs.app/Contents/MacOS and it runs fine. On the list to figure out.
These warnings make ma a bit nervous.
Yeah. We inherited these from upstream so have left them as is. I will look into them soon.
Maybe this invokes UB, and clang 20 feels entitled to do strange things?
That could be. I think it's more likely that various worker threads
which the new CoreXXX things use require more subtle handling of
autorelease. Not at all an expert on that stuff. Again if you have
thoughts or findings about any of this, please drop them in #43.
And I'm no expert in anything of that either, plus I don't know
event know how emacs-mac works :-).
Anyway. Do you know the thread checker? I've used it once on NS build,
but it found nothing. Here's what I have in my notes:
https://medium.com/capital-one-tech/using-apples-main-thread-checker-tool-on-ui-tests-a89508bcd524
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/libMainThreadChecker.tbd
There's a number of ways you can do this: the easiest is probably
setting the DYLD_INSERT_LIBRARIES environment variable to
/Applications/Xcode.app/Contents/Developer/usr/lib/libMainThreadChecker.dylib.
(You can do this from the "Arguments" tab of the Schemes editor.)
Another way would be to dynamically load it in code. Just put
something like
dlopen("/Applications/Xcode.app/Contents/Developer/usr/lib/libMainThreadChecker.dylib",
RTLD_LAZY) early in your app's startup path.
You could also directly link against the library, but that would
hardcode the library into your app, which I would not really recommend
for something used largely for debugging.
https://bryce.co/main-thread-checker-configuration/
MTC_VERBOSE
MTC_PRINT_SELECTOR_STATS
MTC_CRASH_ON_REPORT
MTC_LOG_REPORTS_TO_STDERR
Maybe that helps in some way.
There also seem to be environment variables that one can set to enable
checks and logs and so on, But I never found a reference manual /
descripton of these. Here are the fragments that I have collected over
the years.
* NSDebugEnabled
https://developer.apple.com/documentation/foundation/nsdebugenabled
* Environment Variables
-> and crash. I have enabled the environment variables: NSZombieEnabled, NSHangOnUncaughtException,
NSAutoreleaseFreedObjectCheckEnabled, NSDebugEnabled,
MallocStackLogging, MallocStackLoggingNoCompact, NSDeallocateZombies,
but no result.
https://gist.github.com/JeOam/e62c95a0b4c21974bcf6
https://loufranco.com/blog/debugging-memory-iphone
FWIW :-). Sorry for the form of the notes.
|
|
JD Smith ***@***.***> writes:
Just saw this, thanks. I want to capture some of these ideas when I have some time. I've tried out the address sanitizer
(ASan), and it was fairly easy to use (if hard to interpret).
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.
I've used ASAN regularly with Emacs, so I might be able to help if there
are questions.
|
Uh oh!
There was an error while loading. Please reload this page.
Repository version
Config
From
config.logBuild
Build is successful, but with quite some warnings. Note that this is a
debug build with assertions enabled.
App start
Starting Emacs the terminal opens Emacs briefly, it does not get keyboard input,
and then gets a segmentation fault
Opening
mac/in Finder and double-click onEmacs.appdoes not open the app.A non-debug build without
--enable-checkingdid open it once I think, not sure.Sorry, I don't have the time to work on this. Note though that one
warning that I saw had something to do with autorelease pools IIRC.
All reactions