Repository navigation
Conversation
rursache
added a commit
to rursache/balatro-mod-manager
that referenced
this pull request
Oct 13, 2026
unrar_sys 0.5.8 picks link libraries and sources from the host instead of the target and its SSE/AES attributes are only enabled for GCC, so building x86_64-pc-windows-msvc with cargo-xwin from macOS failed. The local copy fixes both (build.rs mirrors upstream muja/unrar.rs#81), see PATCHED.md Claude-Session: https://claude.ai/code/session_01VQ2ANcwsfQEPqhrDGSNdeL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The build script decides which sources to compile and which libraries to link from
cfg!(windows), which in a build script answers for the machine doing the building rather than the one being built for. Cross compiling reads the wrong answer out of it, and there is no way to tell it otherwise.Two ways it shows:
isnt.cppis compiled for a platform that has none of what it needs. Building foraarch64-linux-androidfrom Windows stops atvendor/unrar/isnt.cpp:3:1: error: unknown type name 'DWORD'and thenfatal error: 'wbemidl.h' file not found.isnt.cppis left out of a library that needs it, andpowrprofandshell32go unlinked.CARGO_CFG_TARGET_OSandCARGO_CFG_TARGET_ENVare what a build script has to ask instead, and that is the first commit. Nothing changes for a native build on any platform.That alone gets an Android build as far as the next stop. A commit of its own carries the rest of what Android needs, three things:
Android has no
lutimes.ulinks.cpprestores a symlink's timestamps with it, so a Linux host building for Android fails witherror: use of undeclared identifier 'lutimes'; did you mean 'utimes'?. Upstream reaches forlutimesonly where it thinks there is noutimensat, whichos.hppdecides from_POSIX_C_SOURCE; bionic hasutimensatand does not set that macro. DefiningUNIX_TIME_NSfor Android takes theutimensatpath, which is the one that builds there and the more precise of the two. No vendored source is touched.Android has no
libpthread. Its pthread functions live in libc, so the-lpthreadthe Unix branch emits has nothing to link against. It is not emitted for Android now.Nothing links a C++ runtime. The NDK does not link one by default, and the
cpp_link_stdlib(None)that is there for windows-gnu says not to ask for one, so the link ends inundefined symbol: operator newand__cxa_throw. Android now linksc++_static, which keeps a dependent crate from having to shiplibc++_shared.sobeside its own library, plusc++abi, whichlibc++_staticleaves its ABI symbols to.One more, unrelated to Android, in a commit of its own; say the word if you would rather it went in a PR of its own: an MSVC link of a crate that depends on this one ends in
unresolved external symbol __imp_RegCloseKey,__imp_RegOpenKeyExW,__imp_RegQueryValueExW,__imp_OpenProcessToken,__imp_AdjustTokenPrivilegesand friends.pathfn.cppreads the registry to find the RAR data directory andsystem.cppasks about the process token; both are inadvapi32, which is not linked.windows-gnunever noticed because its import libraries are pulled in more loosely.Testing
On a Windows host (
x86_64-pc-windows-msvc):cargo build --releaseandcargo test --release: 46 tests across the 7 binaries, all passing, unchanged from before.cargo ndk -t arm64-v8a -t armeabi-v7a build --release: both compile, where before this they could not be built for Android from a Windows host at all.aarch64-linux-androidandarmv7-linux-androideabi. Linking is where the last two problems showed up, so a build alone was not enough to call it done.Not tested by me: a Linux or macOS host. The change to the Windows branch there is that it now fires for a Windows target rather than a Windows host, which is the point of the patch, and the non-Windows branch is unchanged for every target except Android.
Found while adding
.cbrsupport to Paperback, a screen-reader-first document reader. Comic archives packed with RAR are a good half of what people have on their shelves, and this crate reads them well; the Android build is the one place it could not follow.