Skip to content

Compiling for Linux #8

Description

@osxster

I was curious if there is a way to compile this for Linux. I'd like to use this on an ESXi host, however ESXi doesn't have a compiler and thus I am trying to get this to compile on CentOS or BSD instead to see if it can be copied over to ESXi.

Below I am trying with CentOS 8.1, I am able to get this to get a lot of the way through, but it fails a trying to find mach/mach_host.h. See below:

[root@localhost xserve-frontpanel-master]# cmake . && make
-- Configuring done
-- Generating done
-- Build files have been written to: /home/HOME/xserve-frontpanel-master
[ 33%] Building C object CMakeFiles/hwmond.dir/cpu_usage.c.o
In file included from /home/HOME/xserve-frontpanel-master/cpu_usage.c:1:
/home/HOME/xserve-frontpanel-master/cpu_usage.h:3:2: warning: #import is a deprecated GCC extension [-Wdeprecated]
#import <stdlib.h>
^~~~~~
/home/HOME/xserve-frontpanel-master/cpu_usage.c:5:10: fatal error: mach/mach_host.h: No such file or directory
#include <mach/mach_host.h>
^~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/hwmond.dir/build.make:76: CMakeFiles/hwmond.dir/cpu_usage.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:68: CMakeFiles/hwmond.dir/all] Error 2
make: *** [Makefile:84: all] Error 2

It is failing because it is looking for Mach Kernel files which is the Kernel used by MacOS. Is there a way to update this to use Kernel files from Linux? I'd love go to see this work, any help would be greatly appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions