{"record":{"id":"5ddf133578e28678","repo":"DioxusLabs/dioxus","slug":"failed-to-find-main-symbol","errorCode":null,"errorMessage":"Failed to find main symbol","messagePattern":"Failed to find main symbol","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/desktop/src/mobile.rs","lineNumber":77,"sourceCode":"        fn stop_unwind<F: FnOnce() -> T, T>(f: F) -> T {\n            match std::panic::catch_unwind(std::panic::AssertUnwindSafe(f)) {\n                Ok(t) => t,\n                Err(err) => {\n                    eprintln!(\"attempt to unwind out of `rust` with err: {:?}\", err);\n                    std::process::abort()\n                }\n            }\n        }\n\n        stop_unwind(|| unsafe {\n            let mut main_fn_ptr = libc::dlsym(libc::RTLD_DEFAULT, b\"main\\0\".as_ptr() as _);\n\n            if main_fn_ptr.is_null() {\n                main_fn_ptr = libc::dlsym(libc::RTLD_DEFAULT, b\"_main\\0\".as_ptr() as _);\n            }\n\n            if main_fn_ptr.is_null() {\n                panic!(\"Failed to find main symbol\");\n            }\n\n            // Set the env vars that rust code might expect, passed off to us by the android app\n            // Doing this before main emulates the behavior of a regular executable\n            if cfg!(target_os = \"android\") && cfg!(debug_assertions) {\n                // Load the env file from the session cache if we're in debug mode and on android\n                //\n                // This is a slightly hacky way of being able to use std::env::var code in android apps without\n                // going through their custom java-based system.\n                let env_file = dioxus_cli_config::android_session_cache_dir().join(\".env\");\n                if let Ok(env_file) = std::fs::read_to_string(&env_file) {\n                    for line in env_file.lines() {\n                        if let Some((key, value)) = line.trim().split_once('=') {\n                            std::env::set_var(key, value);\n                        }\n                    }\n                }\n            }","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/DioxusLabs/dioxus/blob/24f6a829df0dfa203961a98ea4cae21c2ff27e28/packages/desktop/src/mobile.rs#L59-L95","documentation":"On mobile, the desktop crate's injected root tried to locate the app's C entry point via dlsym for both \"main\" and \"_main\" and both lookups returned null. Without the main symbol pointer, the mobile runtime cannot hand off execution to the user's app.","triggerScenarios":"Thrown at packages/desktop/src/mobile.rs:77 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["The mobile binary has no main symbol to call. Ensure the app exposes a main entry point and the mobile target links it correctly."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"24f6a829df0dfa203961a98ea4cae21c2ff27e28","analyzedAt":"2026-08-23T07:10:14.078Z","contentChangedAt":"2026-08-23T07:10:14.078Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}