I have an SBC that I only can install FreeBSD (probably OpenBSD, too), and from searching for some information I understand I just need Python3, and a “bit” of a preparation, and it should work.
Firstly, has anyone ever done it already? I would love to compare notes.
Secondly, at my first attempt, to me it seems the code uses linux headers (maybe just this one).
(klippy-env) [gal@klipper ~]$ /home/gal/klippy-env/bin/python /home/gal/klipper/klippy/klippy.py /home/gal/printer_data/config/printer.cfg -I /home/gal/printer_data/comms/klippy.serial -l /home/gal/printer_data/logs/klippy.log -a /home/gal/printer_data/comms/klippy.sock
/home/gal/klipper/klippy/chelper/pyhelper.c: In function 'get_monotonic':
/home/gal/klipper/klippy/chelper/pyhelper.c:21:29: error: 'CLOCK_MONOTONIC_RAW' undeclared (first use in this function); did you mean 'CLOCK_MONOTONIC_FAST'?
21 | int ret = clock_gettime(CLOCK_MONOTONIC_RAW, &ts);
| ^~~~~~~~~~~~~~~~~~~
| CLOCK_MONOTONIC_FAST
/home/gal/klipper/klippy/chelper/pyhelper.c:21:29: note: each undeclared identifier is reported only once for each function it appears in
/home/gal/klipper/klippy/chelper/serialqueue.c:15:10: fatal error: linux/can.h: No such file or directory
15 | #include <linux/can.h> // // struct can_frame
| ^~~~~~~~~~~~~
compilation terminated.
Traceback (most recent call last):
File "/home/gal/klipper/klippy/klippy.py", line 367, in <module>
main()
File "/home/gal/klipper/klippy/klippy.py", line 349, in main
main_reactor = reactor.Reactor(gc_checking=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/gal/klipper/klippy/reactor.py", line 311, in __init__
SelectReactor.__init__(self, gc_checking)
File "/home/gal/klipper/klippy/reactor.py", line 100, in __init__
self.monotonic = chelper.get_ffi()[1].get_monotonic
^^^^^^^^^^^^^^^^^
File "/home/gal/klipper/klippy/chelper/__init__.py", line 295, in get_ffi
do_build_code(cmd % (destlib, ' '.join(srcfiles)))
File "/home/gal/klipper/klippy/chelper/__init__.py", line 271, in do_build_code
raise Exception(msg)
Exception: Unable to build C code module (error=256)
^C
The SBC is a “Niuguy NIU-one”, intel based “mini” computer, I used it as my firewall, but upgraded the firewall, so it is just collecting dust, why not try to use it? It is still plenty powerful to run linux or freeBSD. The problem, is that there is some weird video hardware in it, and any linux distro just goes black screen at the beginning of the installation, even in text mode. I have been trying to install ubuntu for weeks, but didn’t get anywhere. So, I thought I’ll try to go down another road, installing klipper on freeBSD. But kiauh works only with linux (perhaps even only debian based distros). So, I am now trying to install klipper manually.
I am building a Voron2, and I am going to use a SmartPrintCoreH7x board (or two, since it only has 5 stepper drivers). I already have successfully set up klipper to run on the board, I just didn’t want to buy a RPi just to run clipper, when I have a perfectly good computer.
I tried adding linux_enable=“YES” to /etc/rc.conf, but it didn’t help. I have a feeling that would only help if I already had a linux binary (just guessing), but in my case, the c_helper.so module compilation just fails.
I dug out the compile command from klipper/klippy/chelper/init.py, and executed it, and got the same error.
[gal@klipper ~/klipper/klippy/chelper]$ gcc -mfpmath=sse -msse2 -Wall -g -O2 -shared -fPIC -flto -fwhole-program -fno-use-linker-plugin -o /home/gal/klipper/klippy/chelper/c_helper.so /home/gal/klipper/klippy/chelper/pyhelper.c /home/gal/klipper/klippy/chelper/serialqueue.c /home/gal/klipper/klippy/chelper/stepcompress.c /home/gal/klipper/klippy/chelper/itersolve.c /home/gal/klipper/klippy/chelper/trapq.c /home/gal/klipper/klippy/chelper/pollreactor.c /home/gal/klipper/klippy/chelper/msgblock.c /home/gal/klipper/klippy/chelper/trdispatch.c /home/gal/klipper/klippy/chelper/kin_cartesian.c /home/gal/klipper/klippy/chelper/kin_corexy.c /home/gal/klipper/klippy/chelper/kin_corexz.c /home/gal/klipper/klippy/chelper/kin_delta.c /home/gal/klipper/klippy/chelper/kin_deltesian.c /home/gal/klipper/klippy/chelper/kin_polar.c /home/gal/klipper/klippy/chelper/kin_rotary_delta.c /home/gal/klipper/klippy/chelper/kin_winch.c /home/gal/klipper/klippy/chelper/kin_extruder.c /home/gal/klipper/klippy/chelper/kin_shaper.c /home/gal/klipper/klippy/chelper/kin_idex.c /home/gal/klipper/klippy/chelper/kin_generic.c
/home/gal/klipper/klippy/chelper/pyhelper.c: In function 'get_monotonic':
/home/gal/klipper/klippy/chelper/pyhelper.c:21:29: error: 'CLOCK_MONOTONIC_RAW' undeclared (first use in this function); did you mean 'CLOCK_MONOTONIC_FAST'?
21 | int ret = clock_gettime(CLOCK_MONOTONIC_RAW, &ts);
| ^~~~~~~~~~~~~~~~~~~
| CLOCK_MONOTONIC_FAST
/home/gal/klipper/klippy/chelper/pyhelper.c:21:29: note: each undeclared identifier is reported only once for each function it appears in
/home/gal/klipper/klippy/chelper/serialqueue.c:15:10: fatal error: linux/can.h: No such file or directory
15 | #include <linux/can.h> // // struct can_frame
| ^~~~~~~~~~~~~
compilation terminated.
[gal@klipper ~/klipper/klippy/chelper]$
Could chelper be changed, so that it wouldn’t contain any linux system call?
You found the problem. This means the Linux kernel (at least the version you tried) doesn’t support this hardware native.
Three things you could try.
First, find out the VID (vendor ID) and PID (product ID) of this “weird video hardware” with you running FreeBSD (don’t know how, I never used FreeBSD). When you have the VID and PID you could try a WWW search for a Linux driver. If you find a driver, install it by hand and try to get Linux running.
Second try to install a Debian distribution which supports the latest kernel.
Third, install Windows. Find out the VID (vendor ID) and PID (product ID) of this “weird video hardware” (I could help you here).
You need to get running a Debian based Linux distro on your “Niuguy NIU-one” to run Klipper!
As indicated, Klipper focuses on Debian-like distributions.
FreeBSD and Linux are quite different in many aspects.
It seems strange that some video hardware is supported by FreeBSD but not by a recent Linux kernel. Usually, support for this type of hardware is much better in Linux, while FreeBSD clearly excels in pure server/networking topics.
An interested developer would likely need to dedicate their time to figuring out the relevant differences and solving them. Since this is probably considered a “niche OS” for Klipper with low user impact, the chances might be rather slim.
The Klipper core developers are actively monitoring this place, making it the right spot to raise such a request. If there is interest, they will surely return to it.
I just read it in another post I could try to run Klipper in a virtual python environment on pretty much any operating system, as long as I have python, but I understand the official standpoint is that Klipper is only supported on debian based linux distributions. It is totally understandable, and sorry for sounding like I am demaning something, it was not my intention.
As per the weird hardware, I don’t think it’s the kernel that works or fails, but the bootloader, and it could be the BIOS, not really the video hardware. I tried installing Windows, but it behaves the exact same way as linux. Only freebSD and OpenBSD “goes through”.
Thank you for taking the time reading my posts and responding!
There is no kernel failing, I never intended to state that. I was talking about hardware drivers.
How do you run Klipper in a virtual python environment without a working SBC/Niu-one?
According to
For your Niu-one
Windows only is the supported OS.
If you don’t get Windows running you have some other serious problems. Did you change some settings in the BIOS?
While this might be largely true, there are places in Klipper that rely on low-level kernel and operating system interfaces. How many there are and how complex it would be to resolve them, I cannot tell.
then the BIOS (Basic Input/Output System) or nowadays UEFI (Unified Extensible Firmware Interface) comes up (this runs from an IC on your motherboard and is a “very simple operating system”). If CSM (Compatibility Support Module) is available you can go back from UEFI to BIOS/Legacy mode (can be helpful).
BIOS/UEFI one of those is the first (very simple) “operating system” on your PC. But! If you mess up the settings here, no OS like Windows, Linux, FreeBSD, or macOS will be able to install.
Well, yeah, as I am getting older, I more and more realize the more I learn, the less I know. I mean, there’s just so much knowledge, one cannot fathom to know everything. I’m trying… Will do better next time, sorry again.