Skip to content

Segmentation fault during init when loading xhc-hb04 #209

@fishpepper

Description

@fishpepper

I am trying to add a hb04 wheel to my cnc config.
Machinekit is running on a BBB.
I get a Segmentation fault when /usr/bin/haltcl tries to start.

I tried to run the sample config:
`machinekit -v -V /usr/share/linuxcnc/examples/sample-configs/sim/axis/xhc-hb04/xhc-hb04-layout1.ini
Verbose mode on
halcmd 'print lots of junk' mode on
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/lib/linuxcnc
LINUXCNC_CONFIG_DIR=
LINUXCNC_LANG_DIR=/usr/share/linuxcnc/tcl/msgs
INIVAR=/usr/libexec/linuxcnc/inivar
HALCMD=halcmd -V
LINUXCNC_EMCSH=/usr/bin/wish8.6
MACHINEKIT - 0.1
Machine configuration directory is '/usr/share/linuxcnc/examples/sample-configs/sim/axis/xhc-hb04'
Machine configuration file is 'xhc-hb04-layout1.ini'
INIFILE=/usr/share/linuxcnc/examples/sample-configs/sim/axis/xhc-hb04/xhc-hb04-layout1.ini
PARAMETER_FILE=sim-9axis.var
TASK=milltask
HALUI=halui
DISPLAY=axis
Starting Machinekit...
Starting Machinekit server program: linuxcncsvr
Loading Real Time OS, RTAPI, and HAL_LIB modules
rtapi_msgd command: /usr/libexec/linuxcnc/rtapi_msgd --instance=0 --rtmsglevel=1 --usrmsglevel=1 --halsize=524288
rtapi_app command: /usr/libexec/linuxcnc/rtapi_app_xenomai --instance=0
Starting Machinekit IO program: io
io started
halcmd loadusr io started
Starting HAL User Interface program: halui
haltcl -i /usr/share/linuxcnc/examples/sample-configs/sim/axis/xhc-hb04/xhc-hb04-layout1.ini core_sim9.hal
/usr/bin/linuxcnc: line 769: 2599 Segmentation fault haltcl -i "$INIFILE" $CFGFILE
Shutting down and cleaning up Machinekit...
Killing task linuxcncsvr, PID=2529
Removing HAL_LIB, RTAPI, and Real Time OS modules
Removing NML shared memory segments
Cleanup done
Machinekit terminated with an error. For simple cases more information
can be found in the following files:
/home/machinekit/linuxcnc_debug.txt
/home/machinekit/linuxcnc_print.txt

For other cases get more meaningfull information by restarting after
export DEBUG=5

and look at the output of:
/var/log/linuxcnc.log
dmesg

When looking for errors, specifically look for libraries that fail to load
by looking for lines with 'insmod failed' as per example below.

insmod failed, returned -1:
do_load_cmd: dlopen: nonexistant-component.so: cannot open shared object file:
No such file or directory

For getting help, please have a look here: www.machinekit.io/docs/getting-help/`

When I trace the tcl calls using gdb I end up here:
`gdb tclsh8.6
GNU gdb (Debian 7.7.1+dfsg-5) 7.7.1
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "arm-linux-gnueabihf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
http://www.gnu.org/software/gdb/bugs/.
Find the GDB manual and other documentation resources online at:
http://www.gnu.org/software/gdb/documentation/.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from tclsh8.6...(no debugging symbols found)...done.
(gdb) run /usr/bin/haltcl -i /home/machinekit/machinekit/configs/ARM.BeagleBone.Panther/tinyBEE.ini tinyBEE.hal
Starting program: /usr/bin/tclsh8.6 /usr/bin/haltcl -i /home/machinekit/machinekit/configs/ARM.BeagleBone.Panther/tinyBEE.ini tinyBEE.hal
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".
[New Thread 0xb6b62460 (LWP 2457)]

Program received signal SIGSEGV, Segmentation fault.
0x00003c88 in ?? ()
(gdb) bt
#0 0x00003c88 in ?? ()
#1 0xb62e1ece in ?? () from /usr/lib/tcltk/linuxcnc/hal.so
#2 0xb62e1f7a in ?? () from /usr/lib/tcltk/linuxcnc/hal.so
#3 0xb62e2114 in Hal_Init () from /usr/lib/tcltk/linuxcnc/hal.so
#4 0xb6f4b19c in ?? () from /usr/lib/arm-linux-gnueabihf/libtcl8.6.so
Backtrace stopped: previous frame identical to this frame (corrupt stack?)`

I can also trigger the segfault by calling
haltcl -i /usr/share/linuxcnc/examples/sample-configs/sim/axis/xhc-hb04/xhc-hb04-layout1.ini core_sim9.hal
manually from the shell...

Any clues/hints where I could start digging?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions