tauri icon indicating copy to clipboard operation
tauri copied to clipboard

App compiles but immediately crashes on M1 mac

Open arnesahlberg opened this issue 2 years ago • 5 comments

Describe the bug

I'm trying out Tauri on m M1 macbook air. Every time I try to run a tauri app it crashes. It comiles without issue, but as soon as I try to run it it crashes showing no error message in the terminal. However, I get an error report window saying:

-------------------------------------
Translated Report (Full Report Below)
-------------------------------------

Process:               Tauri Test [43319]
Path:                  /Users/USER/Documents/*/Tauri Test
Identifier:            Tauri Test
Version:               ???
Code Type:             ARM-64 (Native)
Parent Process:        cargo-tauri [42624]
Responsible:           iTerm2 [1407]
User ID:               501

Date/Time:             2023-07-04 14:49:17.6632 +0200
OS Version:            macOS 13.4.1 (22F82)
Report Version:        12
Anonymous UUID:        A0084DB1-8AEA-596D-03B6-D711C864AD81

Sleep/Wake UUID:       7A92F8D8-087D-4B3B-BCF2-CA925A39D854

Time Awake Since Boot: 240000 seconds
Time Since Wake:       316 seconds

System Integrity Protection: enabled

Crashed Thread:        0  main  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (SIGBUS)
Exception Codes:       UNKNOWN_0x101 at 0x000000000bad4007
Exception Codes:       0x0000000000000101, 0x000000000bad4007

Termination Reason:    Namespace SIGNAL, Code 10 Bus error: 10
Terminating Process:   exc handler [43319]

VM Region Info: 0xbad4007 is not in any region.  Bytes before following region: 4105961465
      REGION TYPE                    START - END         [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      UNUSED SPACE AT START
--->  
      __TEXT                      100694000-100e04000    [ 7616K] r-x/r-x SM=COW  .../*/Tauri Test

Thread 0 Crashed:: main Dispatch queue: com.apple.main-thread
0   ???                           	         0xbad4007 ???
1   ImageIO                       	       0x18d2d1120 IIOReadPlugin::callInitialize() + 324
2   ImageIO                       	       0x18d2d0d78 IIO_Reader::initImageAtOffset(CGImagePlugin*, unsigned long, unsigned long, unsigned long) + 124
3   ImageIO                       	       0x18d2ce60c IIOImageSource::makeImagePlus(unsigned long, IIODictionary*) + 808
4   ImageIO                       	       0x18d2cdee8 IIOImageSource::getPropertiesAtIndexInternal(unsigned long, IIODictionary*) + 72
5   ImageIO                       	       0x18d2cde24 IIOImageSource::copyPropertiesAtIndex(unsigned long, IIODictionary*) + 24
6   ImageIO                       	       0x18d2cdd2c CGImageSourceCopyPropertiesAtIndex + 276
7   AppKit                        	       0x186a2d008 ImageSourceOptionsForCGImageSource_index_ + 64
8   AppKit                        	       0x186a2ce88 +[NSBitmapImageRep _imagesWithData:hfsFileType:extension:zone:expandImageContentNow:includeAllReps:] + 428
9   AppKit                        	       0x186b4a4d8 +[NSBitmapImageRep imageRepsWithData:] + 68
10  AppKit                        	       0x186b49e34 -[NSImage initWithData:] + 76
11  Tauri Test                    	       0x1009c3700 _$LT$$LP$A$C$$RP$$u20$as$u20$objc..message..MessageArguments$GT$::invoke::he070eda173bf4cf7 + 116
12  Tauri Test                    	       0x1009c9238 objc::message::platform::send_unverified::_$u7b$$u7b$closure$u7d$$u7d$::h200ee5ecdf57add2 + 56
13  Tauri Test                    	       0x1009c9238 objc::message::platform::send_unverified::_$u7b$$u7b$closure$u7d$$u7d$::h200ee5ecdf57add2 + 56
14  Tauri Test                    	       0x1009c9238 objc::message::platform::send_unverified::_$u7b$$u7b$closure$u7d$$u7d$::h200ee5ecdf57add2 + 56
15  Tauri Test                    	       0x1009c9238 objc::message::platform::send_unverified::_$u7b$$u7b$closure$u7d$$u7d$::h200ee5ecdf57add2 + 56
16  Tauri Test                    	       0x1009c9238 objc::message::platform::send_unverified::_$u7b$$u7b$closure$u7d$$u7d$::h200ee5ecdf57add2 + 56
17  Tauri Test                    	       0x1009c9238 objc::message::platform::send_unverified::_$u7b$$u7b$closure$u7d$$u7d$::h200ee5ecdf57add2 + 56
18  Tauri Test                    	       0x1009c9238 objc::message::platform::send_unverified::_$u7b$$u7b$closure$u7d$$u7d$::h200ee5ecdf57add2 + 56
19  Tauri Test                    	       0x1009c9238 objc::message::platform::send_unverified::_$u7b$$u7b$closure$u7d$$u7d$::h200ee5ecdf57add2 + 56
20  Tauri Test                    	       0x1009c9238 objc::message::platform::send_unverified::_$u7b$$u7b$closure$u7d$$u7d$::h200ee5ecdf57add2 + 56
21  Tauri Test                    	       0x1009c9238 objc::message::platform::send_unverified::_$u7b$$u7b$closure$u7d$$u7d$::h200ee5ecdf57add2 + 56
22  Tauri Test                    	       0x1009c9238 objc::message::platform::send_unverified::_$u7b$$u7b$closure$u7d$$u7d$::h200ee5ecdf57add2 + 56
23  Tauri Test                    	       0x1009c9238 objc::message::platform::send_unverified::_$u7b$$u7b$closure$u7d$$u7d$::h200ee5ecdf57add2 + 56
24  Tauri Test                    	       0x1009c9238 objc::message::platform::send_unverified::_$u7b$$u7b$closure$u7d$$u7d$::h200ee5ecdf57add2 + 56
25  Tauri Test                    	       0x1009c9238 objc::message::platform::send_unverified::_$u7b$$u7b$closure$u7d$$u7d$::h200ee5ecdf57add2 + 56
26  Tauri Test                    	       0x1009c9238 objc::message::platform::send_unverified::_$u7b$$u7b$closure$u7d$$u7d$::h200ee5ecdf57add2 + 56
27  Tauri Test                    	       0x1009c9238 objc::message::platform::send_unverified::_$u7b$$u7b$closure$u7d$$u7d$::h200ee5ecdf57add2 + 56
28  Tauri Test                    	       0x1009c9238 objc::message::platform::send_unverified::_$u7b$$u7b$closure$u7d$$u7d$::h200ee5ecdf57add2 + 56
29  Tauri Test                    	       0x1009c9238 objc::message::platform::send_unverified::_$u7b$$u7b$closure$u7d$$u7d$::h200ee5ecdf57add2 + 56
30  Tauri Test                    	       0x1009c9238 objc::message::platform::send_unverified::_$u7b$$u7b$closure$u7d$$u7d$::h200ee5ecdf57add2 + 56
31  Tauri Test                    	       0x1009c9238 objc::message::platform::send_unverified::_$u7b$$u7b$closure$u7d$$u7d$::h200ee5ecdf57add2 + 56
32  Tauri Test                    	       0x1009c9238 objc::message::platform::send_unverified::_$u7b$$u7b$closure$u7d$$u7d$::h200ee5ecdf57add2 + 56
etc...

Anyone else encountering the same problem or know if I'm doing something wrong.

Reproduction

I see the error when doing the basic html display app shown here: https://tauri.app/v1/guides/getting-started/setup/html-css-js/

Expected behavior

I expect the window to open and show the html contents.

Platform and versions

[✔] Environment
    - OS: Mac OS 13.4.1 X64
    ✔ Xcode Command Line Tools: installed
    ✔ rustc: 1.67.0 (fc594f156 2023-01-24)
    ✔ Cargo: 1.67.0 (8ecd4f20a 2023-01-10)
    ✔ rustup: 1.25.2 (17db695f1 2023-02-01)
    ✔ Rust toolchain: stable-aarch64-apple-darwin (environment override by RUSTUP_TOOLCHAIN)
    - node: 17.1.0
    - yarn: 1.22.19
    - npm: 8.1.2

[-] Packages
    - tauri [RUST]: 1.4.1
    - tauri-build [RUST]: 1.4.0
    - wry [RUST]: 0.24.3
    - tao [RUST]: 0.16.2
    - @tauri-apps/api [NPM]: not installed!
    - @tauri-apps/cli [NPM]: 1.4.0

[-] App
    - build-type: bundle
    - CSP: unset
    - distDir: ../ui
    - devPath: ../ui

Stack trace

None, but the report is shown above.

Additional context

No response

arnesahlberg avatar Jul 04 '23 12:07 arnesahlberg

Please don't post an archive of your project because anonymous archived files are dangerous, instead share your minimal repro project in a github repo.

amrbashir avatar Jul 04 '23 12:07 amrbashir

Please don't post an archive of your project because anonymous archived files are dangerous, instead share your minimal repro project in a github repo.

Good point. Removed it. May add repo later.

arnesahlberg avatar Jul 04 '23 13:07 arnesahlberg

Seems like it might be something crashing in some underlying contract in IIOReadPlugin::callInitialize() being broken, I've been running into this issue on my M1 mac for various other projects (namely GNURadio and occasionally another opencv project).

(edit: these other projects worked fine not long ago, and now they're crashing... I think it's something upstream from tauri)

dgramop avatar Mar 28 '24 06:03 dgramop

Not sure whether this is related, but I encountered a similar issue with egui that on M1 the app crashed with EXC_BAD_ACCESS (SIGBUS). Remove /opt/homebrew/lib from env DYLD_LIBRARY_PATH resolved the issue

so61pi avatar Apr 15 '24 10:04 so61pi

Not sure whether this is related, but I encountered a similar issue with egui that on M1 the app crashed with EXC_BAD_ACCESS (SIGBUS). Remove /opt/homebrew/lib from env DYLD_LIBRARY_PATH resolved the issue

/opt/homebrew/lib/libgl.dylib was the offending file, I think this was also affecting solvespace. Comes down to how CMAKE on MacOS links libGL: it should compile with the -framework flag instead of linking it as a dylib

dgramop avatar Apr 15 '24 22:04 dgramop

I ran into the same problem but I do not have /opt/homebrew/lib/libgl.dylib on my system.

PythonCoderAS avatar May 31 '24 19:05 PythonCoderAS

I've stepped through with a debugger and this is where it crashes: https://github.com/tauri-apps/tauri/blob/3cca5c2be88bbd52139e7dda371e88510d28bc8e/core/tauri/src/app.rs#L1910

PythonCoderAS avatar May 31 '24 20:05 PythonCoderAS

This is the stack reported by RustRover:

<unknown> 0x000000000bad4007
PNGReadPlugin::InitializePluginData(IIOImageReadSession*, IIODictionary*, IIODictionary*, CGImageMetadata*, CGColorSpace**, ReadPluginData&, PNGPluginData&, __CFDictionary*) 0x0000000193708c9c
IIOReadPlugin::callInitialize() 0x0000000193700ff4
IIO_Reader::initImageAtOffset(CGImagePlugin*, unsigned long, unsigned long, unsigned long) 0x0000000193700dbc
IIOImageSource::makeImagePlus(unsigned long, IIODictionary*) 0x00000001936fe75c
IIOImageSource::getPropertiesAtIndexInternal(unsigned long, IIODictionary*) 0x00000001936fe030
IIOImageSource::copyPropertiesAtIndex(unsigned long, IIODictionary*) 0x00000001936fdf4c
CGImageSourceCopyPropertiesAtIndex 0x00000001936fddf0
ImageSourceOptionsForCGImageSource_index_ 0x000000018c5b2bf8
+[NSBitmapImageRep _imagesWithData:hfsFileType:extension:zone:expandImageContentNow:includeAllReps:] 0x000000018c5b2a78
+[NSBitmapImageRep imageRepsWithData:] 0x000000018c6ca1ec
-[NSImage initWithData:] 0x000000018c6c9abc
<(A,) as objc::message::MessageArguments>::invoke mod.rs:128
objc::message::platform::send_unverified::{{closure}} mod.rs:27
objc_exception::try::{{closure}} lib.rs:68
objc_exception::try_no_ret::try_objc_execute_closure lib.rs:34
RustObjCExceptionTryCatch exception.m:10
objc_exception::try_no_ret lib.rs:44
objc_exception::try lib.rs:67
objc::exception::try exception.rs:8
objc::message::platform::send_unverified mod.rs:26
[Inlined] objc::message::send_message mod.rs:178
<*mut objc::runtime::Object as cocoa::appkit::NSImage>::initWithData_ appkit.rs:3292
tauri::app::on_event_loop_event app.rs:1780
tauri::app::App<R>::run::{{closure}} app.rs:879
tauri_runtime_wry::handle_event_loop lib.rs:2823
<tauri_runtime_wry::Wry<T> as tauri_runtime::Runtime<T>>::run::{{closure}} lib.rs:2325
<tao::platform_impl::platform::app_state::EventLoopHandler<T> as tao::platform_impl::platform::app_state::EventHandler>::handle_nonuser_event::{{closure}} app_state.rs:105
tao::platform_impl::platform::app_state::EventLoopHandler<T>::with_callback app_state.rs:79
<tao::platform_impl::platform::app_state::EventLoopHandler<T> as tao::platform_impl::platform::app_state::EventHandler>::handle_nonuser_event app_state.rs:100
tao::platform_impl::platform::app_state::Handler::handle_nonuser_event app_state.rs:208
tao::platform_impl::platform::app_state::AppState::launched app_state.rs:299
tao::platform_impl::platform::app_delegate::did_finish_launching app_delegate.rs:94
__CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ 0x0000000188c62b1c
___CFXRegistrationPost_block_invoke 0x0000000188cf6db8
_CFXRegistrationPost 0x0000000188cf6d00
_CFXNotificationPost 0x0000000188c31648
-[NSNotificationCenter postNotificationName:object:userInfo:] 0x0000000189d4d464
-[NSApplication _postDidFinishNotification] 0x000000018c4cc37c
-[NSApplication _sendFinishLaunchingNotification] 0x000000018c4cc12c
-[NSApplication(NSAppleEventHandling) _handleAEOpenEvent:] 0x000000018c4ca674
-[NSApplication(NSAppleEventHandling) _handleCoreEvent:withReplyEvent:] 0x000000018c4ca270
-[NSAppleEventManager dispatchRawAppleEvent:withRawReply:handlerRefCon:] 0x0000000189d75914
_NSAppleEventManagerGenericHandler 0x0000000189d75708
<unknown> 0x000000018fc869c4
<unknown> 0x000000018fc862ec
aeProcessAppleEvent 0x000000018fc7f8a8
AEProcessAppleEvent 0x0000000193416e90
_DPSNextEvent 0x000000018c4c4c7c
-[NSApplication(NSEventRouting) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] 0x000000018ccb6dec
-[NSApplication run] 0x000000018c4b7cb8
<() as objc::message::MessageArguments>::invoke mod.rs:128
objc::message::platform::send_unverified::{{closure}} mod.rs:27
objc_exception::try::{{closure}} lib.rs:68
objc_exception::try_no_ret::try_objc_execute_closure lib.rs:34
RustObjCExceptionTryCatch exception.m:10
objc_exception::try_no_ret lib.rs:44
objc_exception::try lib.rs:67
objc::exception::try exception.rs:8
objc::message::platform::send_unverified mod.rs:26
[Inlined] objc::message::send_message mod.rs:178
tao::platform_impl::platform::event_loop::EventLoop<T>::run_return event_loop.rs:193
tao::platform_impl::platform::event_loop::EventLoop<T>::run event_loop.rs:160
tao::event_loop::EventLoop<T>::run event_loop.rs:179
<tauri_runtime_wry::Wry<T> as tauri_runtime::Runtime<T>>::run lib.rs:2299
tauri::app::App<R>::run app.rs:868
tauri::app::Builder<R>::run app.rs:1723
rezasm_tauri::main main.rs:127
core::ops::function::FnOnce::call_once function.rs:250
std::sys_common::backtrace::__rust_begin_short_backtrace backtrace.rs:155
std::rt::lang_start::{{closure}} rt.rs:166
[Inlined] core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once function.rs:284
[Inlined] std::panicking::try::do_call panicking.rs:552
[Inlined] std::panicking::try panicking.rs:516
[Inlined] std::panic::catch_unwind panic.rs:146
[Inlined] std::rt::lang_start_internal::{{closure}} rt.rs:148
[Inlined] std::panicking::try::do_call panicking.rs:552
[Inlined] std::panicking::try panicking.rs:516
[Inlined] std::panic::catch_unwind panic.rs:146
std::rt::lang_start_internal rt.rs:148
std::rt::lang_start rt.rs:165
main 0x0000000100a8e950
start 0x00000001888060e0

PythonCoderAS avatar May 31 '24 20:05 PythonCoderAS

Final investigation reveals that libpng from Homebrew is the culprit -- uninstalling it stopped the crashing.

PythonCoderAS avatar May 31 '24 20:05 PythonCoderAS