Difference between revisions of "Development:Setting up FEX"
Line 2: | Line 2: | ||
* cmake | * cmake | ||
* ninja-build | * ninja-build | ||
+ | * ccache (Recommended if you're rebuilding constantly) | ||
* clang | * clang | ||
* libnuma-dev | * libnuma-dev |
Revision as of 04:15, 23 April 2021
Build dependencies
- cmake
- ninja-build
- ccache (Recommended if you're rebuilding constantly)
- clang
- libnuma-dev
- libsdl2-dev (For GUI)
- libepoxy-dev (For GUI)
- g++-x86-64-linux-gnu (For building thunks)
- nasm (only if building tests)
- python3-clang (for struct verifier)
- libstdc++-10-dev-i386-cross (for struct verifier)
- libstdc++-10-dev-amd64-cross (for struct verifier)
Build Configuration
- Ensure release mode is enabled
- Enable LTO
- Disable test building
git clone https://github.com/FEX-Emu/FEX.git
cd FEX
git submodule update --init
mkdir Build
cd Build
CC=clang CXX=clang++ cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DENABLE_LTO=True -DBUILD_TESTS=False -G Ninja ..
ninja
Installation
sudo ninja install
On AArch64 hosts
You can install a binfmt_misc handler for both 32bit and 64bit x86 execution directly from the environment. If you already have box86's 32bit binfmt_misc handler installed then I don't recommend installing FEX's until it is useful. Make sure to have run install prior to this, otherwise binfmt_misc will install and old handler even if the executable has been updated.
sudo ninja binfmt_misc_32
sudo ninja binfmt_misc_64
Runtime Configuration
FEXConfig is the application to use for runtime configuration setup.
CTRL+SHIFT+O will open default "global" configuration.
CTLR+S saves it.
Things to ensure to set
On AArch64 host, a rootfs path is mandatory, while it is optional on x86-64 host
- Core: JIT
- RootFS
- Silent Logging (Useful to get FEX information spam out of the way)
- Block Size (500 is a good default. Optimization passes may break things though)
- Multiblock: enabled (Can cause more stuttering)
- Emulated CPU Cores: 1 (threading bugs cause issues with more)
RootFS generation
AArch64 hosts require a rootfs for running applications Follow the instructions here https://wiki.fex-emu.org/index.php/Development:Setting_up_RootFS
Installing Thunks
Only if you want
https://github.com/FEX-Emu/FEX/blob/main/ThunkLibs/README.md
Binaries
- FEXLoader
- This is useful for development purposes but is generally recommended against using.
- Allows passing arguments to FEX for configuration purposes, which can break under some execve situations
- FEXInterpreter
- This is a hardlink to FEXLoader which refuses to treat arguments as configuration options
- Is recommended to use over FEXLoader; Using FEXConfig to set configuration
- Requires being a hardlink or executable copy, execve logic sees through a softlink
- Is the executable used for binfmt_misc for interpreters
- FEXConfig
- Used for setting configuration options from a GUI
- Written using Dear ImGui
- Can load/save global configuration and application configuration files
- Application configuration files are compared against the executable filename
Debug binaries
- TestHarnessRunner
- Used for running FEX's ASM unit tests
- Runs some binary in a host x86_64 host environment or FEX and checks results
- Useful for quickly creating ASM based unit tests
- IRLoader
- Used for running FEX's IR based unit tests
- Only runs through FEX and checks the results
- Minimal number of tests
- UnitTestGenerator
- This is supposed to be an x86-64 instruction generator
- Has an understanding of x86-64 instruction encoding format
- Generates hundreds of thousands of instructions
- Used to be used with a lockstep runner to ensure correct behaviour
- Largely unsupported, avoiding undefined behaviour is difficult and FEX doesn't need to match undefined behaviour
- Lockstep hostrunner wasn't ever made to be bug free, hard to support
- Doesn't ensure correct behaviour on AArch64 device