Skip to content
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

Building fails if we only have one use statement #1699

Closed
soupslurpr opened this issue Aug 10, 2023 · 7 comments
Closed

Building fails if we only have one use statement #1699

soupslurpr opened this issue Aug 10, 2023 · 7 comments

Comments

@soupslurpr
Copy link
Contributor

Hi, when my project only uses one use statement, building seems to fail. Adding another use statement fixes it even if we don't use that crate.

error: linking with `C:/Users/user/AppData/Local/Android/Sdk/ndk/26.0.10404224/toolchains/llvm/prebuilt/windows-x86_64/bin/aarch64-linux-android28-clang.cmd` failed: exit code: 255
  |
  = note: "C:/Users/user/AppData/Local/Android/Sdk/ndk/26.0.10404224/toolchains/llvm/prebuilt/windows-x86_64/bin/aarch64-linux-android28-clang.cmd" "-Wl,--version-script=C:\\Users\\user\\AppData\\Local\\Temp\\rustcqKh8Wv\\list" "-Wl,--no-undefined-version" "C:\\Users\\user\\AppData\\Local\\Temp\\rustcqKh8Wv\\symbols.o" "C:\\Users\\user\\projects\\BeauTyXT\\beautyxt_rs\\target\\aarch64-linux-android\\release\\deps\\beautyxt_rs.beautyxt_rs.1b8e755c7177c1b0-cgu.0.rcgu.o" "C:\\Users\\user\\projects\\BeauTyXT\\beautyxt_rs\\target\\aarch64-linux-android\\release\\deps\\beautyxt_rs.beautyxt_rs.1b8e755c7177c1b0-cgu.1.rcgu.o" "C:\\Users\\user\\projects\\BeauTyXT\\beautyxt_rs\\target\\aarch64-linux-android\\release\\deps\\beautyxt_rs.beautyxt_rs.1b8e755c7177c1b0-cgu.2.rcgu.o" "C:\\Users\\user\\projects\\BeauTyXT\\beautyxt_rs\\target\\aarch64-linux-android\\release\\deps\\beautyxt_rs.beautyxt_rs.1b8e755c7177c1b0-cgu.3.rcgu.o" "C:\\Users\\user\\projects\\BeauTyXT\\beautyxt_rs\\target\\aarch64-linux-android\\release\\deps\\beautyxt_rs.beautyxt_rs.1b8e755c7177c1b0-cgu.4.rcgu.o" "C:\\Users\\user\\projects\\BeauTyXT\\beautyxt_rs\\target\\aarch64-linux-android\\release\\deps\\beautyxt_rs.beautyxt_rs.1b8e755c7177c1b0-cgu.5.rcgu.o" "C:\\Users\\user\\projects\\BeauTyXT\\beautyxt_rs\\target\\aarch64-linux-android\\release\\deps\\beautyxt_rs.kaw1riddub6yrk0.rcgu.o" "-Wl,--as-needed" "-L" "C:\\Users\\user\\projects\\BeauTyXT\\beautyxt_rs\\target\\aarch64-linux-android\\release\\deps" "-L" "C:\\Users\\user\\projects\\BeauTyXT\\beautyxt_rs\\target\\release\\deps" "-L" "C:\\Users\\user\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\aarch64-linux-android\\lib" "-Wl,-Bstatic" "C:\\Users\\user\\projects\\BeauTyXT\\beautyxt_rs\\target\\aarch64-linux-android\\release\\deps\\libuniffi-b894bbf02c48ebf0.rlib" "C:\\Users\\user\\projects\\BeauTyXT\\beautyxt_rs\\target\\aarch64-linux-android\\release\\deps\\libuniffi_core-6226400175510933.rlib" "C:\\Users\\user\\projects\\BeauTyXT\\beautyxt_rs\\target\\aarch64-linux-android\\release\\deps\\libstatic_assertions-60495758fec0315b.rlib" "C:\\Users\\user\\projects\\BeauTyXT\\beautyxt_rs\\target\\aarch64-linux-android\\release\\deps\\liblog-5c8c9aee221ad39e.rlib" "C:\\Users\\user\\projects\\BeauTyXT\\beautyxt_rs\\target\\aarch64-linux-android\\release\\deps\\libbytes-e0063d400bfce6ab.rlib" "C:\\Users\\user\\projects\\BeauTyXT\\beautyxt_rs\\target\\aarch64-linux-android\\release\\deps\\libanyhow-ff64bf14315878f9.rlib" "C:\\Users\\user\\projects\\BeauTyXT\\beautyxt_rs\\target\\aarch64-linux-android\\release\\deps\\librand-032b9a32dea1e825.rlib" "C:\\Users\\user\\projects\\BeauTyXT\\beautyxt_rs\\target\\aarch64-linux-android\\release\\deps\\librand_chacha-cea2c6ba05033ade.rlib" "C:\\Users\\user\\projects\\BeauTyXT\\beautyxt_rs\\target\\aarch64-linux-android\\release\\deps\\libppv_lite86-4160ad67ba8df325.rlib" "C:\\Users\\user\\projects\\BeauTyXT\\beautyxt_rs\\target\\aarch64-linux-android\\release\\deps\\librand_core-1ae93b0f9d6556d2.rlib" "C:\\Users\\user\\projects\\BeauTyXT\\beautyxt_rs\\target\\aarch64-linux-android\\release\\deps\\libgetrandom-1198d1d02bf00ab6.rlib" "C:\\Users\\user\\projects\\BeauTyXT\\beautyxt_rs\\target\\aarch64-linux-android\\release\\deps\\liblibc-697cb05f9c1130b4.rlib" "C:\\Users\\user\\projects\\BeauTyXT\\beautyxt_rs\\target\\aarch64-linux-android\\release\\deps\\libcfg_if-417a3e028828f414.rlib" "C:\\Users\\user\\projects\\BeauTyXT\\beautyxt_rs\\target\\aarch64-linux-android\\release\\deps\\libmarkdown-948b89adb0debfda.rlib" "C:\\Users\\user\\projects\\BeauTyXT\\beautyxt_rs\\target\\aarch64-linux-android\\release\\deps\\libunicode_id-132e772bd1eabc8b.rlib" "C:\\Users\\user\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\aarch64-linux-android\\lib\\libstd-ac66c519fc156681.rlib" "C:\\Users\\user\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\aarch64-linux-android\\lib\\libpanic_unwind-912ceb4ed27fa292.rlib" "C:\\Users\\user\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\aarch64-linux-android\\lib\\libobject-441ec0e71c8e980c.rlib" "C:\\Users\\user\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\aarch64-linux-android\\lib\\libmemchr-acd78dad9f8401c4.rlib" "C:\\Users\\user\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\aarch64-linux-android\\lib\\libaddr2line-7b704a3c89aa174c.rlib" "C:\\Users\\user\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\aarch64-linux-android\\lib\\libgimli-cd1fe07296f81fee.rlib" "C:\\Users\\user\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\aarch64-linux-android\\lib\\librustc_demangle-766020562c253a48.rlib" "C:\\Users\\user\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\aarch64-linux-android\\lib\\libstd_detect-ac958e006f9b7c1d.rlib" "C:\\Users\\user\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\aarch64-linux-android\\lib\\libhashbrown-401234bdf22f1b04.rlib" "C:\\Users\\user\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\aarch64-linux-android\\lib\\librustc_std_workspace_alloc-a11da6c8c9e85f3f.rlib" "C:\\Users\\user\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\aarch64-linux-android\\lib\\libminiz_oxide-239f6c17d65178a6.rlib" "C:\\Users\\user\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\aarch64-linux-android\\lib\\libadler-0f8ec39c10f7fd09.rlib" "C:\\Users\\user\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\aarch64-linux-android\\lib\\libunwind-7159137f89f3c748.rlib" "C:\\Users\\user\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\aarch64-linux-android\\lib\\libcfg_if-86e237c6796fdcf5.rlib" "C:\\Users\\user\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\aarch64-linux-android\\lib\\liblibc-b5d72488d897814c.rlib" "C:\\Users\\user\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\aarch64-linux-android\\lib\\liballoc-0dec43b07835310f.rlib" "C:\\Users\\user\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\aarch64-linux-android\\lib\\librustc_std_workspace_core-6b4a9c00321aed49.rlib" "C:\\Users\\user\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\aarch64-linux-android\\lib\\libcore-0a2081d099bc47f7.rlib" "C:\\Users\\user\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\aarch64-linux-android\\lib\\libcompiler_builtins-40056501c2ca4013.rlib" "-Wl,-Bdynamic" "-lc" "-lm" "-ldl" "-llog" "-lunwind" "-ldl" "-lm" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "C:\\Users\\user\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\aarch64-linux-android\\lib" "-o" "C:\\Users\\user\\projects\\BeauTyXT\\beautyxt_rs\\target\\aarch64-linux-android\\release\\deps\\libbeautyxt_rs.so" "-Wl,--gc-sections" "-shared" "-Wl,-z,relro,-z,now" "-Wl,-O1" "-nodefaultlibs"
  = note: --version-script=C:\Users\user\AppData\Local\Temp\rustcqKh8Wv\list"" was unexpected at this time.
@badboy
Copy link
Member

badboy commented Aug 10, 2023

Please specify the code that works and the one that fails, otherwise we have to randomly guess what use statement fixes your build.

@soupslurpr
Copy link
Contributor Author

Oh right, sorry about that.

It is really weird, it randomly started working again but with one or more use statement only, specifically I am using the comrak crate. The below code fails with the same error I already showed, but everything is fine after importing comrak even though it isn't using it. Importing something else like rand still shows the error.

I was running cargo build --lib --release --target aarch64-linux-android

uniffi::setup_scaffolding!();

#[uniffi::export]
pub fn markdown_to_html(markdown: String) -> String {
    markdown
}

Below builds fine.

use comrak::{ListStyleType, ComrakOptions, ComrakExtensionOptions, ComrakParseOptions, ComrakRenderOptions};

uniffi::setup_scaffolding!();

#[uniffi::export]
pub fn markdown_to_html(markdown: String) -> String {
    markdown
}

I also copied the project, removed all dependencies including uniffi, cargo clean, and then tried to build, and I still got the same error. So maybe it is not a uniffi issue?

@badboy
Copy link
Member

badboy commented Aug 10, 2023

If you can remove UniFFI and it still fails as above then yes, something else is broken.

Though I still ask: Which version of UniFFI are you using?

@soupslurpr
Copy link
Contributor Author

soupslurpr commented Aug 10, 2023

I'm using the latest commit, I tried using a version from before I got the issue and it didn't solve it

@badboy
Copy link
Member

badboy commented Aug 10, 2023

Looks like this might be an issue with rust: rust-lang/rust#113711

@soupslurpr
Copy link
Contributor Author

soupslurpr commented Aug 10, 2023

Thanks for finding that, I probably should have searched there too instead of only google and the uniffi issue tracker. The workaround in android/ndk#1856 (comment) works and builds without errors.

@badboy
Copy link
Member

badboy commented Aug 11, 2023

Thanks for reporting back. Closing this issue then.

@badboy badboy closed this as completed Aug 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants