box86/docs/COMPILE.md

128 lines
5.9 KiB
Markdown
Raw Normal View History

2019-03-03 20:04:07 +00:00
Compiling
----
2019-12-24 10:48:57 +00:00
#### for Pandora
2019-03-03 20:04:07 +00:00
2020-05-14 06:45:59 +00:00
`mkdir build; cd build; cmake .. -DPANDORA=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo; make`
2019-09-12 20:24:18 +00:00
2019-12-24 10:48:57 +00:00
#### for Pyra
2019-12-24 10:46:11 +00:00
2020-05-14 06:45:59 +00:00
`mkdir build; cd build; cmake .. -DPYRA=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo; make`
2019-12-24 10:46:11 +00:00
2019-12-24 10:48:57 +00:00
#### for Gameshell
2019-11-07 17:20:11 +00:00
2020-05-14 06:45:59 +00:00
`mkdir build; cd build; cmake .. -DGAMESHELL=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo; make`
2019-11-07 17:20:11 +00:00
#### for Raspberry Pi
2019-12-24 10:46:11 +00:00
_a build for model 2, 3 and 4 can be done. Model 1 and 0 cannot (at least not with Dynarec, as they lack NEON support)_
```
git clone https://github.com/ptitSeb/box86
cd box86
mkdir build; cd build; cmake .. -DRPI4=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo
make
sudo make install
sudo systemctl restart systemd-binfmt
```
Note that you can use `make -j2` or more to speed up 1st build, but beware of the memory requirement if you go to high.
2019-12-24 10:46:11 +00:00
#### for Raspberry Pi on 64bits OS
_For Pi4. Change to RPI2 or RPI3 for other models. Change `-DRPI4=1` to `-DRPI4ARM64=1` for compiling on arm64. (armhf multiarch or chroot required alongside armhf gcc. Install it with 'sudo apt install gcc-arm-linux-gnueabihf'.)_
2019-12-24 10:46:11 +00:00
```
git clone https://github.com/ptitSeb/box86
cd box86
mkdir build; cd build; cmake .. -DRPI4ARM64=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo
make -j2
sudo make install
sudo systemctl restart systemd-binfmt
```
2020-04-16 05:52:09 +00:00
#### for ODROID
`mkdir build; cd build; cmake .. -DODROID=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo; make -j3`
2020-04-16 05:52:09 +00:00
#### for RK3399
`mkdir build; cd build; cmake .. -DRK3399=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo; make -j3`
2021-11-23 11:49:43 +00:00
As most RK3399 device run AARCH64 OS, you'll need an `armhf` multiarch environment, and an armhf gcc: On debian, install it with `sudo apt install gcc-arm-linux-gnueabihf`. Also, on armbian, you may need to also use `sudo apt install libc6-dev-armhf-cross` or you may have an issue with `crt1.o` and a few other similar file not found at link.
#### for Tinker Board (1/1S) or RK3288
`mkdir build; cd build; cmake .. -DRK3288=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo; make -j3`
2021-10-30 15:35:53 +00:00
#### for Allwinner A64
`mkdir build; cd build; cmake .. -DA64=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo; make -j3`
2021-10-30 15:35:53 +00:00
2021-11-23 11:49:43 +00:00
As most Allwinner A64 device run AARCH64 OS, you'll need an `armhf` multiarch environment, and an armhf gcc: On debian, install it with `sudo apt install gcc-arm-linux-gnueabihf`. Also, on armbian, you may need to also use `sudo apt install libc6-dev-armhf-cross` or you may have an issue with `crt1.o` and a few other similar file not found at link.
2021-10-30 15:35:53 +00:00
#### for Snapdragon 845
`mkdir build; cd build; cmake .. -DSD845=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo; make -j4`
As most Snapdragon 845 device run AARCH64 OS, in most cases you'll need an `armhf` multiarch environment, and an armhf gcc: On mobian, install it with `sudo apt install gcc-arm-linux-gnueabihf`.
2021-10-30 10:11:56 +00:00
#### for Phytium
`mkdir build; cd build; cmake .. -DPHYTIUM=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo; make -j4`
2021-11-23 11:49:43 +00:00
As most Phytium (D2000 or FT2000/4) device run AARCH64 OS, you'll need an `armhf` multiarch environment, and an armhf gcc: On debian/ubuntu, install it with `sudo apt install gcc-arm-linux-gnueabihf`. Also, on armbian, you may need to also use `sudo apt install libc6-dev-armhf-cross` or you may have an issue with `crt1.o` and a few other similar file not found at link.
2021-10-30 10:11:56 +00:00
#### for Other ARM Linux platforms
2019-03-03 20:04:07 +00:00
`mkdir build; cd build; cmake .. -DARM_DYNAREC=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo; make -j3`
2019-03-03 20:04:07 +00:00
2019-12-24 10:48:57 +00:00
#### for x86 Linux
2019-03-03 20:04:07 +00:00
`mkdir build; cd build; cmake .. -DCMAKE_C_FLAGS="-m32" -DLD80BITS=1 -DNOALIGN=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo; make -j3`
2019-03-03 20:04:07 +00:00
2019-12-24 10:48:57 +00:00
#### use ccmake
2019-03-03 20:04:07 +00:00
Alternatively, you can use the curses-bases ccmake (or any other gui frontend for cmake) to select wich platform to use interactively.
2019-12-24 10:48:57 +00:00
#### Customize your build
2020-05-14 06:49:00 +00:00
*use ccache if you have it*
2019-03-03 20:04:07 +00:00
Add `-DUSE_CCACHE=1` if you have ccache (it's better if you plan to touch the sources)
2020-05-14 06:49:00 +00:00
*have some debug info*
The `-DCMAKE_BUILD_TYPE=RelWithDebInfo` argument makes a build that is both optimized for speed, and has debug information embedded. That way, if you have a crash or try to analyse performance, you'll have some symbols.
2019-06-20 09:09:17 +00:00
2020-05-14 06:49:00 +00:00
*to have a Trace Enabled build*
To have a trace enabled build ( ***it will be slower***), add `-DHAVE_TRACE=1` but you will need, at runtime, to have the [Zydis library](https://github.com/zyantific/zydis) library in your `LD_LIBRARY_PATH` or in the system library folders.
2019-03-03 20:04:07 +00:00
*to have ARM Dynarec*
2020-05-14 06:49:00 +00:00
The Dynarec is only available on the ARM architecture(Right now, anyways.). Notes also that VFPv3 and NEON are required for the Dynarec. Activate it by using `-DARM_DYNAREC=1`. Also, be sure to use `-marm` in compilation flags (because many compileur use Thumb as default, and the dynarec will not work in this mode). Note that compiling with `ARM_DYNAREC` but without hardware profile is not advise. If you get error building that "target CPU does not support ARM mode", then try to pick hardware profile (like ODROID for armv7 or PI4 for armv8). Also, if you are using a 64bits with armhf multiarch, it's much easier to pick one of the hardware profile like `RPI4ARM64`, `RK3399`, `PHYTIUM` or `SD845`.
*not building from a git clone*
If you are not building from a git clone (for example, downloading a release source zipped from github), you need to activate `-DNOGIT=1` from cmake to be able to build (normal process include git sha1 of HEAD in the version that box86 print).
2019-03-03 20:04:07 +00:00
----
Testing
----
A few tests are included.
They can be launched with `ctest`
They are very basic and don't test much for now.
2021-09-11 10:23:22 +00:00
----
Note about devices with Tegra X1 and newer.
Nvidia don't provide armhf libraries for their GPU drivers at this moment so there is no special variable to compile it for them as it would be missleading for many people. If you still want to use it wihout GPU acceleration, building it with RPI4 configuration should work just fine. As instalation of Mesa can break Nvidia driver, safest option is usage of chroot.
2022-01-18 17:06:58 +00:00
----
Debian Packaging
----
2022-01-18 19:09:44 +00:00
Box86 can also be packaged into a .deb file with `DEB_BUILD_OPTIONS=nostrip dpkg-buildpackage -us -uc -nc`.
2022-01-18 17:06:58 +00:00