Compiling linuxcnc on Slackware. Some warnings.

More
20 May 2020 22:40 - 21 May 2020 15:43 #168413 by fauve
Hello! First post. My name is Vitalii, and I live in Ukraine.

Trying to compile LinuxCNC. on Slackware . Almost there, hopefully.

What I managed so far is to compile a new kernel with an RTAI patch, and the RTAI modules themselves. The testssuit utilities show a decent latency for a Dell Optiplex 780. So this part is covered.

As for LinuxCNC itself, I installed a few dependencies missing in default installation (Yapps. libmodbus, bwidget, tcllib, tkimg), and pulled the 2.7.15 version of linuxcnc-dev from GitHub. After fixing some linkage issues (got a hint here github.com/LinuxCNC/linuxcnc/issues/181), it compiled, but with some warnings:
WARNING "ceil" [...linuxcnc-dev/src/xhc_hb04_util.ko] undefined!
WARNING: "fabs" [...linuxcnc-dev/src/steptest.ko] undefined!
WARNING: "floor" [...linuxcnc-dev/src/sim_spindle.ko] undefined!
WARNING: "ceil" [...linuxcnc-dev/src/sim_spindle.ko] undefined!
WARNING: "floor" [...linuxcnc-dev/src/orient.ko] undefined!
WARNING: "ceil" [...linuxcnc-dev/src/orient.ko] undefined!
WARNING: "pow" [...linuxcnc-dev/src/joyhandle.ko] undefined!
WARNING: "floor" [...linuxcnc-dev/src/ilowpass.ko] undefined!
WARNING: "pow" [...linuxcnc-dev/src/genserkins.ko] undefined!
WARNING: "floor" [...linuxcnc-dev/src/bldc.ko] undefined!
WARNING: "fabs" [...linuxcnc-dev/src/axistest.ko] undefined!     

Could you kindly point me in the right direction as of what's going on here? Where these errors come from. Is it critical? Thank you.
Last edit: 21 May 2020 15:43 by fauve.

Please Log in or Create an account to join the conversation.

More
23 May 2020 11:28 - 23 May 2020 11:59 #168681 by fauve
Replying to myself. This was probably my fault. When getting the repository from GitHub, I asked git to checkout version 2.7 instead of v2.7.15. It compiled OK, but still no luck with loading modules.

When executing latency-test it says
insmod: ERROR: could not insert module /usr/realtime/modules/linuxcnc/rtapi.ko: Unknown symbol in module

Starting linuxcnc with axis yields the following message:
LINUXCNC - 2.7.15
Machine configuration directory is '/usr/doc/linuxcnc/examples/sample-configs/sim/axis'
Machine configuration file is 'axis.ini'
Starting LinuxCNC...
insmod: ERROR: could not insert module /usr/realtime/modules/linuxcnc/rtapi.ko: Unknown symbol in module
Realtime system did not load
Shutting down and cleaning up LinuxCNC...
RTAPI: ERROR: could not open shared memory (No such device)
RTAPI: Locked memory limit is 64KiB, recommended at least 20480KiB.
This can cause the error 'could not open shared memory'.
For more information, see
        http://wiki.linuxcnc.org/cgi-bin/emcinfo.pl?LockedMemory
HAL: ERROR: could not initialize RTAPI
halcmd: hal_init() failed: -22
NOTE: 'rtapi' kernel module must be loaded
RTAPI: ERROR: could not open shared memory (No such device)
RTAPI: Locked memory limit is 64KiB, recommended at least 20480KiB.
This can cause the error 'could not open shared memory'.
For more information, see
        http://wiki.linuxcnc.org/cgi-bin/emcinfo.pl?LockedMemory
HAL: ERROR: could not initialize RTAPI
halcmd: hal_init() failed: -22
NOTE: 'rtapi' kernel module must be loaded
RTAPI: ERROR: could not open shared memory (No such device)
RTAPI: Locked memory limit is 64KiB, recommended at least 20480KiB.
This can cause the error 'could not open shared memory'.
For more information, see
        http://wiki.linuxcnc.org/cgi-bin/emcinfo.pl?LockedMemory
HAL: ERROR: could not initialize RTAPI
halcmd: hal_init() failed: -22
NOTE: 'rtapi' kernel module must be loaded
RTAPI: ERROR: could not open shared memory (No such device)
RTAPI: Locked memory limit is 64KiB, recommended at least 20480KiB.
This can cause the error 'could not open shared memory'.
For more information, see
        http://wiki.linuxcnc.org/cgi-bin/emcinfo.pl?LockedMemory
HAL: ERROR: could not initialize RTAPI
halcmd: hal_init() failed: -22
NOTE: 'rtapi' kernel module must be loaded
RTAPI: ERROR: could not open shared memory (No such device)
RTAPI: Locked memory limit is 64KiB, recommended at least 20480KiB.
This can cause the error 'could not open shared memory'.
For more information, see
        http://wiki.linuxcnc.org/cgi-bin/emcinfo.pl?LockedMemory
HAL: ERROR: could not initialize RTAPI
halcmd: hal_init() failed: -22
NOTE: 'rtapi' kernel module must be loaded
RTAPI: ERROR: could not open shared memory (No such device)
RTAPI: Locked memory limit is 64KiB, recommended at least 20480KiB.
This can cause the error 'could not open shared memory'.
For more information, see
        http://wiki.linuxcnc.org/cgi-bin/emcinfo.pl?LockedMemory
HAL: ERROR: could not initialize RTAPI
halcmd: hal_init() failed: -22
NOTE: 'rtapi' kernel module must be loaded
RTAPI: ERROR: could not open shared memory (No such device)
RTAPI: Locked memory limit is 64KiB, recommended at least 20480KiB.
This can cause the error 'could not open shared memory'.
For more information, see
        http://wiki.linuxcnc.org/cgi-bin/emcinfo.pl?LockedMemory
HAL: ERROR: could not initialize RTAPI
halcmd: hal_init() failed: -22
NOTE: 'rtapi' kernel module must be loaded
RTAPI: ERROR: could not open shared memory (No such device)
RTAPI: Locked memory limit is 64KiB, recommended at least 20480KiB.
This can cause the error 'could not open shared memory'.
For more information, see
        http://wiki.linuxcnc.org/cgi-bin/emcinfo.pl?LockedMemory
HAL: ERROR: could not initialize RTAPI
halcmd: hal_init() failed: -22
NOTE: 'rtapi' kernel module must be loaded
RTAPI: ERROR: could not open shared memory (No such device)
RTAPI: Locked memory limit is 64KiB, recommended at least 20480KiB.
This can cause the error 'could not open shared memory'.
For more information, see
        http://wiki.linuxcnc.org/cgi-bin/emcinfo.pl?LockedMemory
HAL: ERROR: could not initialize RTAPI
halcmd: hal_init() failed: -22
NOTE: 'rtapi' kernel module must be loaded
RTAPI: ERROR: could not open shared memory (No such device)
RTAPI: Locked memory limit is 64KiB, recommended at least 20480KiB.
This can cause the error 'could not open shared memory'.
For more information, see
        http://wiki.linuxcnc.org/cgi-bin/emcinfo.pl?LockedMemory
HAL: ERROR: could not initialize RTAPI
halcmd: hal_init() failed: -22
NOTE: 'rtapi' kernel module must be loaded
RTAPI: ERROR: could not open shared memory (No such device)
RTAPI: Locked memory limit is 64KiB, recommended at least 20480KiB.
This can cause the error 'could not open shared memory'.
For more information, see
        http://wiki.linuxcnc.org/cgi-bin/emcinfo.pl?LockedMemory
HAL: ERROR: could not initialize RTAPI
halcmd: hal_init() failed: -22
NOTE: 'rtapi' kernel module must be loaded
RTAPI: ERROR: could not open shared memory (No such device)
RTAPI: Locked memory limit is 64KiB, recommended at least 20480KiB.
This can cause the error 'could not open shared memory'.
For more information, see
        http://wiki.linuxcnc.org/cgi-bin/emcinfo.pl?LockedMemory
HAL: ERROR: could not initialize RTAPI
halcmd: hal_init() failed: -22
NOTE: 'rtapi' kernel module must be loaded
rmmod: ERROR: Module hal_lib is not currently loaded
rmmod: ERROR: Module rtapi is not currently loaded
LinuxCNC terminated with an error.  You can find more information in the log:
    /root/linuxcnc_debug.txt
and
    /root/linuxcnc_print.txt
as well as in the output of the shell command 'dmesg' and in the terminal

The rtapi.conf is located in /etc/linuxcnc/ with the following lines:
# snip header comments
# A few parameters from emc2/Makefile.inc
EMC2_HOME=/usr
KERNELDIR=/usr/src/linux
RTLIB_DIR=/usr/realtime/modules/linuxcnc
MODULE_EXT=.ko
RTPREFIX=rtai
KERNEL_VERS=4.4.71-smp-rtai

# Sets the default DEBUG level
DEBUG='1'

# Path to the realtime kernel modules
MODPATH=/usr/realtime/modules

# List of realtime kernel modules to be loaded
if [ "5" = "3" ] ; then \
    MODULES="adeos rtai_hal rtai_ksched rtai_fifos rtai_sem rtai_math"
    RTAI=5
    MODPATH_adeos=
    MODPATH_rtai_hal=/usr/realtime/modules/rtai_hal.ko
    MODPATH_rtai_ksched=
    MODPATH_rtai_fifos=/usr/realtime/modules/rtai_fifos.ko
    MODPATH_rtai_sem=/usr/realtime/modules/rtai_sem.ko
    MODPATH_rtai_math=
elif [ "5" = "5" ] ; then \
    MODULES="rtai_hal rtai_sched rtai_math"
    RTAI=5
    MODPATH_rtai_hal=/usr/realtime/modules/rtai_hal.ko
    MODPATH_rtai_sched=/usr/realtime/modules/rtai_sched.ko
    MODPATH_rtai_math=
fi

Here is the relevant output of dmesg:
[ 1837.644827] I-pipe: head domain RTAI registered.
[ 1837.644830] RTAI[hal]: mounted. ISOL_CPUS_MASK: 0.
[ 1837.644833] SYSINFO - # CPUs: 2, TIMER NAME: 'lapic', TIMER IRQ: 2306, TIMER FREQ: 20779791, CLOCK NAME: 'tsc', CLOCK FREQ: 2992397000, CPU FREQ: 2992397000, LINUX TIMER IRQ: 2306.
[ 1837.644834] 
               REMARK: RTAI WILL NOT ACCESS USER SPACE ON STACKS ARGS ITS WAY.

[ 1837.647277] RTAI[malloc]: global heap size = 2097152 bytes, <BSD>.
[ 1837.647289] , kstacks pool size = 524288 bytes.
[ 1837.647291] RTAI[sched]: hard timer type/freq = lapic/20779791(Hz); timing: ONESHOT; linear timed lists.
[ 1837.647293] RTAI[sched]: Linux timer freq = 300 (Hz), TimeBase freq = 2992397000 hz.
[ 1837.647294] RTAI[sched]: timer setup = 48 ns, resched latency = 0 ns.
[ 1837.647726] USERMODE CHECK: OK.
[ 1837.647728] USERMODE CHECK PROVIDED (ns): KernelLatency 851, UserLatency 1118.
[ 1837.647730] FINAL CALIBRATION SUMMARY (ns): KernelLatency 851, UserLatency 1118.
[ 1837.648687] rtapi: Unknown symbol rtf_get (err 0)
[ 1837.648701] rtapi: Unknown symbol rtf_put (err 0)
[ 1837.648711] rtapi: Unknown symbol rt_shm_free (err 0)
[ 1837.648719] rtapi: Unknown symbol rt_shm_alloc (err 0)
[ 1837.648726] rtapi: Unknown symbol rtf_destroy (err 0)
[ 1837.648734] rtapi: Unknown symbol rt_sem_signal (err 0)
[ 1837.648745] rtapi: Unknown symbol rt_sem_wait_if (err 0)
[ 1837.648754] rtapi: Unknown symbol rt_sem_init (err 0)
[ 1837.648762] rtapi: Unknown symbol rtf_create (err 0)
[ 1837.648775] rtapi: Unknown symbol rt_sem_delete (err 0)
[ 1837.648784] rtapi: Unknown symbol rt_sem_wait (err 0)
[ 1839.933295] RTAI[malloc]: unloaded.
[ 1840.036490] RTAI[sched]: unloaded (forced hard/soft/hard transitions: traps 0, syscalls 0).
[ 1840.050893] I-pipe: head domain RTAI unregistered.
[ 1840.050897] RTAI[hal]: unmounted.

I'll add the whole dmesg output in the attachment, as well as the kernel config, and a SlackBuild script of sorts (maybe it will be of use to someone).

I don't get the linuxcnc logic when loding modules. If I link /usr/realtime/ to /lib/modules/4.4.71-smp-rtai/rtai, then I can manually load `rtapi.ko with no problem. My guess is something off in rtapi.conf (/etc/linuxcnc/rtapi.conf). I hate asking for help, but this time I need some.

File Attachment:

File Name: dmesg.txt
File Size:58 KB

File Attachment:

File Name: config-4.4...rtai.txt
File Size:95 KB

File Attachment:

File Name: linuxcnc.S...uild.txt
File Size:3 KB
Attachments:
Last edit: 23 May 2020 11:59 by fauve.

Please Log in or Create an account to join the conversation.

More
23 May 2020 12:34 #168683 by BeagleBrainz
It’s a right pain.
I went through the whole process a few years ago. Now I’ve been a user of Slackware for years, but to be honest I found it not really to be worth the effort, unless you are bored.
I just upgraded my server at home from Slackware 14.2 to Ubuntu 18.04 and as much as I hate to say it setting up Ubuntu is a damn site more efficient.
In all honesty you won’t get any better latency with Slackware than Debian, it’s damn pain in the arse. All the time you try getting to work is better spent getting your machine tuned.
If I remember it did take some fiddling to get going. I may have a hdd packed away that has Slackware and linuxcnc, I’ll dig it out tomorrow and see if I can make sense of what I did. From memory it took some messing with the modules.

Please Log in or Create an account to join the conversation.

More
23 May 2020 19:54 - 23 May 2020 20:04 #168716 by fauve
Thank you for replying. OK, if it is not too much trouble for you.

You are right, I don't expect some miraculous performance boost from Slackware. I've installed Debian/LinuxCNC on every computer I could get my hands on, including the one I am typing now. Configured them for my CNC routers (luckily it wasn't too bad, except maybe the external EStop, which took me a couple of days to get my head around). And the fun is gone :) Really feeling more at home with Slackware. Just the boot-up logo makes me happy. No pressure, though. Just a nice cherry on top of the quarantine cake.
Last edit: 23 May 2020 20:04 by fauve.

Please Log in or Create an account to join the conversation.

More
24 May 2020 02:04 #168757 by BeagleBrainz
Bleh....
The slackware HDD is IDE and I have no boxes running with IDE ATM...I'll have to look around for my dock.
Anyways found this thread from a while back
forum.linuxcnc.org/9-installing-linuxcnc...-with-modules#110814

Please Log in or Create an account to join the conversation.

More
24 May 2020 21:38 #168829 by fauve
That link actually helped me to move forward a bit. I managed to start the latency-test, and it's looking pretty good with 6 x glxgears, YouTube, and who knows what.

All it took is adding rtai_shm to the module_whitelist[] array in the module_helper.c, and some editing of rtapi.conf file, so it ended like this for now:
# snip
elif [ "5" = "5" ] ; then \
    MODULES="rtai_hal rtai_sched rtai_fifos rtai_sem rtai_shm rtai_math"
    RTAI=5
    MODPATH_rtai_hal=/usr/realtime/modules/rtai_hal.ko
    MODPATH_rtai_sched=/usr/realtime/modules/rtai_sched.ko
    MODPATH_rtai_fifos=/usr/realtime/modules/rtai_fifos.ko
    MODPATH_rtai_sem=/usr/realtime/modules/rtai_sem.ko
    MODPATH_rtai_shm=/usr/realtime/modules/rtai_shm.ko
    MODPATH_rtai_math=
fi
But the linuxcnc itself is not loading still. This time it is:
Found file(lib): /usr/share/linuxcnc/hallib/core_sim.hal
Found file(lib): /usr/share/linuxcnc/hallib/sim_spindle_encoder.hal
insmod: ERROR: could not insert module /usr/realtime/modules/linuxcnc/sim_spindle.ko: Unknown symbol in module
/usr/share/linuxcnc/hallib/sim_spindle_encoder.hal:2: exit value: 1
/usr/share/linuxcnc/hallib/sim_spindle_encoder.hal:2: insmod for sim_spindle failed, returned -1
See the output of 'dmesg' for more information.
Shutting down and cleaning up LinuxCNC...
LinuxCNC terminated with an error.
modinfo sim_spindle.ko gives us hal_lib,rtapi,rtai_math. I think this rtai_math is the culprit. Will try to recompile rtai with diferent vesions of math library (NEWLIB, uCLIB, GLIBC, MUSL) before givig up. It is finicky! An updated SlackBuild included, yet to produce a wotking system...

File Attachment:

File Name: linuxcnc.S...5-24.txt
File Size:3 KB
Attachments:

Please Log in or Create an account to join the conversation.

More
24 May 2020 22:42 #168833 by tommylight
You should try some other sim's. that one is complaining about spindle so choose one without a spindle, like:
linuxcnc>sample configurations>by machine>plasmac>axis>axis mm or inch
that one does work always, as i test with it very often on the latest builds of Linuxcnc.

Please Log in or Create an account to join the conversation.

More
27 May 2020 22:39 - 27 May 2020 22:45 #169162 by fauve
Still no luck. I think I forgot to mention that i tried to compile linuxcnc-2.7.15 against rtai-5.1. I've tried all the possible math modules, provided by RTAI with no success of starting linuxcnc though. Mostly the same "unknown symbol" error. After that I changed a few lines in the build script, and tried the 2.8-pre1 branch. Like before it is mocking me with a nice latency test, and no LinuxCNC.

This time the error looks like this:
 LINUXCNC - 2.8.0~pre1
Machine configuration directory is '/home/nabis/linuxcnc/configs/sim.axis'
Machine configuration file is 'axis_mm.ini'
can't find package Linuxcnc
    while executing
"package require Linuxcnc "
    (file "/usr/share/linuxcnc/hallib/check_config.tcl" line 141)
check_config validation failed
LinuxCNC terminated with an error.  You can find more information in the log:
    /home/nabis/linuxcnc_debug.txt
and
    /home/nabis/linuxcnc_print.txt
as well as in the output of the shell command 'dmesg' and in the terminal
Could someone explain please what does it mean? The linuxcnc_debug.txt is empty, while linuxcnc_print.txt contains the following:
RUN_IN_PLACE=no
LINUXCNC_DIR=
LINUXCNC_BIN_DIR=/usr/bin
LINUXCNC_TCL_DIR=/usr/lib/tcltk/linuxcnc
LINUXCNC_SCRIPT_DIR=
LINUXCNC_RTLIB_DIR=/usr/realtime/modules/linuxcnc
LINUXCNC_CONFIG_DIR=
LINUXCNC_LANG_DIR=/usr/lib/tcltk/linuxcnc/msgs
INIVAR=inivar
HALCMD=halcmd
LINUXCNC_EMCSH=/usr/bin/wish8.6
INIFILE=/home/nabis/linuxcnc/configs/sim.axis/axis_mm.ini
VERSION=1.1
Thank you.

File Attachment:

File Name: linuxcnc.S...5-27.txt
File Size:3 KB
Attachments:
Last edit: 27 May 2020 22:45 by fauve. Reason: added SlackBuild

Please Log in or Create an account to join the conversation.

More
27 May 2020 23:23 #169169 by tommylight
From your error report:
Machine configuration file is 'axis_mm.ini'
can't find package Linuxcnc
while executing
"package require Linuxcnc "
Clearly something has gone missing somehow.....
Can you also try in termiinal
latency-histogram --sbinsize 1000
see if it runs.
The following user(s) said Thank You: fauve

Please Log in or Create an account to join the conversation.

More
27 May 2020 23:41 #169174 by fauve
The latency-histogram says there is no BLT (tlc-blt).
can't find package BLT
To install: sudo apt-get install blt
I tried to compile BLT-2.4z a couple of times. It just doesn't. Under impression it hasn't been maintained for a long-long time. (sourceforge.net/projects/blt/) I'll give it a few more shots. Maybe someone has a link to more recent version?

Please Log in or Create an account to join the conversation.

Time to create page: 0.447 seconds
Powered by Kunena Forum