-
Notifications
You must be signed in to change notification settings - Fork 4
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
Compiling for Linux #8
Comments
ESXi can run some Linux ELF binaries but ESXi is not Linux. (ESX was, but ESXi isn't.) I already filed #4 for compiling for ESXi so this new ticket could be about compiling for Linux per your title. All the Mach-related variables and functions in the code are specific to operating systems like macOS/Darwin that use the Mach microkernel and will need to be made conditional on that (i.e. Everything I've found about how to get CPU core usage on Linux says to parse the first few lines of the contents of /proc/stat, for example this programming question and also the source code of unixtop. I was hoping there would be an actual operating system function that you would call to get this information like there is in Mach, but apparently there is not. ESXi has /proc but does not have /proc/stat so this method won't work there. I'll discuss what will work on ESXi in #4. |
Ah, of course the function in question can be found by looking at the source code for the I won't link to that code because of the licensing quandry: like the rest of Linux that function is licensed GPL, while this project is licensed MIT, so we could not copy parts of their code into this project without it becoming a derivative work and transforming it into a GPL project. I've looked at the We could just go with parsing /proc/stat for now and leave calling the kernel functions directly as an optimization for later. |
I've installed Linux, figured out how to use X11 forwarding, figured out how to add some code to CMakeLists.txt, separated the Mach-specific code into another file, made a different file for Linux which just uses random numbers so far, figured out how to configure udev to allow write access to the front panel controller, and now I'm stuck at:
I found a suggestion that there could be a kernel driver attached to the device, and that one should use |
Hi! I tried to compile for Linux earlier but failed and didn't think about filing an issue. I have an Xserve2,1 on 5.11.0 so I am also happy to test (and be in the loop) One thing about the GPL "taint": couldn't we do an FFmpeg and simply warn that compiling with the GPL link makes the binary nondistributable or under the GPL license or something like that? Simply adding an #ifdef LINUX does not taint builds unless it actually is compiled for Linux, and even then it does not taint the whole project, merely the binary-- Or so I thought? |
It's not my project of course but I personally favor non-GNU licenses and wouldn't want to introduce the licensing complications at this point. If the owner of the project wants to change its license to GPL that's up to them. But I think we'll be fine to just read /proc/stat for Linux to start with and can optimize later if needed. I'm not to the point of writing that code yet; I have some more elementary things to become accustomed to on Linux first, since I'm a Mac guy and haven't used Linux much. |
USB configurations are indexed from 1, not 0. "Configuration 0" means unconfigured. Linux doesn't allow you to claim an unconfigured device. See castvoid#4 and castvoid#8.
I now have random LEDs working in Ubuntu Server 20.04 and ESXi 6.0.0. Next step will be to implement real CPU activity data capturing for Linux and then for ESXi. |
Don't know if this project is still alive, but I recently got CentOS Linux installed on my old Xserve and I am having trouble getting this to work. I installed libusb and ran The make output is:
|
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.
The text was updated successfully, but these errors were encountered: