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

Library Forwarding: Allow reading standard library headers from a development x86 rootfs #4230

Merged
merged 1 commit into from
Dec 31, 2024

Conversation

asahilina
Copy link
Contributor

This is the last commit from #3597, rebased. It's sufficient to build FEX with thunks on Fedora aarch64, given a suitable x86_64/i686 sysroot with the required includes and glibc/libstdc++ and friends (and some gnarly toochain override files because the cross-compilers Fedora ships on aarch64 aren't actually configured identically to the native compilers on x86/x86_64).

Copy link
Member

@Sonicadvance1 Sonicadvance1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing here seems scary to me.

CMakeLists.txt Outdated Show resolved Hide resolved
@neobrain
Copy link
Member

It's sufficient to build FEX with thunks on Fedora aarch64, given a suitable x86_64/i686 sysroot with the required includes and glibc/libstdc++ and friends (and some gnarly toochain override files because the cross-compilers Fedora ships on aarch64 aren't actually configured identically to the native compilers on x86/x86_64).

Could you provide a vague run-down of the required tweaks for reference (or just post an example toolchain file)?

@teohhanhui
Copy link
Contributor

I think that's

#1996 (comment)

right?

@asahilina
Copy link
Contributor Author

Our Fedora setup is here: https://src.fedoraproject.org/rpms/fex-emu/pull-request/7

Fedora only ships "generic" cross-compilers with no system headers or glibc, which are intended to be used for freestanding code. The target tuple is different to the native compiler. To make those work for building thunks, we ship a minimal sysroot with just the required system headers (built from x86_64 devel packages), and toolchain files with include overrides and which disable linking with native libs and startup files (since those aren't needed for building shared libraries). I also force disable the cmake compiler checks, since this setup can't build executables (only libs).

I don't think there's much more to do on the FEX side here, since these hacks are Fedora-specific. Distros which ship similar cross-compilers can do something similar, and will probably need their own tweaks anyway since the -redhat tuple stuff is obviously very specific to Fedora/RH, and there are probably other differences in how the headers are installed anyway. Distros which ship full cross-compilers with glibc/etc can just use the existing FEX toolchain files (probably).

@asahilina asahilina force-pushed the thunks-build-sysroot branch from eef7657 to fb16a0f Compare December 23, 2024 09:30
Copy link
Member

@neobrain neobrain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Will be useful to have those references around for anyone trying to set up FEX for development themselves.

@asahilina
Copy link
Contributor Author

I don't know what's up with that failing test... I don't see how it can be related to this PR?

@asahilina asahilina force-pushed the thunks-build-sysroot branch from fb16a0f to d503366 Compare December 24, 2024 10:41
@neobrain
Copy link
Member

I don't know what's up with that failing test... I don't see how it can be related to this PR?

Don't worry about it, this is pending on #4232 .

(Happy holidays!)

@Sonicadvance1 Sonicadvance1 merged commit d66cd16 into FEX-Emu:main Dec 31, 2024
10 of 12 checks passed
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

Successfully merging this pull request may close these issues.

5 participants