Skip to content

feat: copy frameworks to Frameworks folder, detect linkers, custom target dirs #4174

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

Merged
merged 33 commits into from
May 24, 2025

Conversation

jkelleyrtp
Copy link
Member

@jkelleyrtp jkelleyrtp commented May 22, 2025

Fixes #4154 by implementing framework linking in our bundle setup.
Fixes #4146
Fixes #4149
Fixes #4159
Fixes #4165
Fixes long paths?
Fixes aarch64-unknown-linux subsecond

Previously we assumed all apps were statically linked into the bundle, but projects like bevy rely on dynamic linking of code, which breaks that assumption. This fix is not just for subsecond, but rather any rust crate that compiles as a dylib, since we weren't distributing those dylibs at all.

This kicks in for both .so files and .dylibs, but I'm unsure how we should handle windows, so I simply left it as a todo. We can't just blindly copy .dll files since system frameworks also end in .dll.

Anyways, this fixes subsecond + bevy dynamic linking which makes the rebuilds much faster.

@jkelleyrtp jkelleyrtp requested a review from a team as a code owner May 22, 2025 12:22
@jkelleyrtp jkelleyrtp marked this pull request as draft May 22, 2025 12:29
@jkelleyrtp jkelleyrtp changed the title feat: copy frameworks to Frameworks folder feat: copy frameworks to Frameworks folder, detect linkers May 22, 2025
@jkelleyrtp jkelleyrtp changed the title feat: copy frameworks to Frameworks folder, detect linkers feat: copy frameworks to Frameworks folder, detect linkers, custom target dirs May 22, 2025
@jkelleyrtp jkelleyrtp marked this pull request as ready for review May 22, 2025 22:11
@dsgallups
Copy link
Contributor

Seems like cli will not compile on windows. windows libc doesn't appear to export dlsym:

error[E0425]: cannot find function `dlsym` in crate `libc`                                                          
   --> packages\subsecond\subsecond\src\lib.rs:699:15
    |
699 |         libc::dlsym(libc::RTLD_DEFAULT, c"main".as_ptr() as _) as _
    |               ^^^^^ not found in `libc`

error[E0425]: cannot find value `RTLD_DEFAULT` in crate `libc`
   --> packages\subsecond\subsecond\src\lib.rs:699:27
    |
699 |         libc::dlsym(libc::RTLD_DEFAULT, c"main".as_ptr() as _) as _
    |                           ^^^^^^^^^^^^ not found in `libc`

@jkelleyrtp jkelleyrtp merged commit 0982c1f into main May 24, 2025
15 of 17 checks passed
@jkelleyrtp jkelleyrtp deleted the jk/fix-dyn-link-subsecond branch May 24, 2025 21:41
AnteDeliria pushed a commit to AnteDeliria/dioxus that referenced this pull request Jun 2, 2025
…rget dirs (DioxusLabs#4174)

* feat: copy frameworks to Frameworks folder

* add dylib linking to patching

* remove logging

* rename __aslr_offset

* fix android/linux

* support linker flavor

* support custom target dirs

* custom cargo target dir support

* whoops ios

* dlsym doesn't exist on windows

* look for the right main symbol per platform

* distinction between mains

* export main on windows

* enbable rlib caching

* add dx hash

* adjust linking warnings

* update tui with hotreload state

* implement symbol flags

* add flags

* only run ranlib on darwin

* enable lld

* paths

* add harness test for tls

* wip: revert launch mobile

* wip

* fix fullstack mobile

* fix a few bugs
- long paths?
- reverting back to original

* pass-thru fuse-ld args

* fix nan in render, fix empty archives

* consider existing dep files if archive exists

* fmt

* drop msrv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants