Introduction
As I just solved the issue with running FXServer on Apple M-series chips. I figured I would compose a guide so anyone else having the issue - or wishing to develop on their Macs can do it.
As Apple M-series chip users might know, the rosetta translation layer is good for almost any case of ARM → x86_64. There is just one issue when using rosetta, especially combined with Docker for Mac. The cpuinfo is not passed into the docker container, so /proc/cpuinfo
is missing relevant feature flags.
Spinning up an ubuntu image with platform set to linux/amd64
, the emulation correctly supports up until x86-64-v3.
Check yourself with this command:
> docker run --rm -it --platform linux/amd64 ubuntu ld.so --help
...
Subdirectories of glibc-hwcaps directories, in priority order:
x86-64-v4
x86-64-v3 (supported, searched) *
x86-64-v2 (supported, searched) *
When running the linux port of the FXServer it terminates stating that POPCNT
is not supported.
This is obviously wrong as we have just established x86-64-v2 is supported and following the specification for it, POPCNT
should be supported (x86-64 microarchitecture features).
Upon execution, the FXServer reads cpu flags from /proc/cpuinfo
. Here it can’t see the flag popcnt
as rosetta with qemu incorrectly passes them through. Well this is an issue, /proc
files are not meant to be edited, but I’ve found a solution.
Using Colima it correctly passes the feature flags trough to /proc/cpuinfo
. This will allow the FXServer to start and run.
This has allowed me to develop locally on my Mac and improve my productivity, I hope it helps.
How to
- Follow the installation guide for Colima, once installed go to the next step
- Run the following command to create a new Colima instance.
> colima start --profile x86_64 --arch x86_64 --cpu-type max
Feel free to assign custom cpu and mem limits, above is the base command to make it work.
--cpu-type max
sets the x86_64 microarchitecture equivalent to the max supported host architecture. Depending on the model, this may be x86-64-v3 or higher. You can verify this by running:
> docker run --rm -it --platform linux/amd64 ubuntu ld.so --help
- Update the docker context
docker context use colima
- Create the container
docker run -it --platform linux/amd64 ubuntu bash
- Continue on with the FXServer linux installation guide