pru_generic.so: cannot open shared object file: No such file or directory

27 views
Skip to first unread message

fogl

unread,
May 12, 2023, 10:38:05 AM5/12/23
to Machinekit
Hello everybody,

I am stuck with machinekit and pru. I am running a single line .hal file:
loadrt prucode=/usr/lib/linuxcnc/rt-preempt/pru_generic pru=0 halname=hpg

This returns:
msgd:0 stopped
rtapi:0 stopped
rtapi_msgd command:  /usr/libexec/linuxcnc/rtapi_msgd --instance=0 --rtmsglevel=1 --usrmsglevel=1 --debug=1 --halsize=524288
rtapi_app command:  /usr/libexec/linuxcnc/rtapi_app_rt-preempt --instance=0 --debug=1
stat: No such file or directory
prutest.hal:6: insmod failed, returned -1:
do_load_cmd: dlopen: prucode=/usr/lib/linuxcnc/rt-preempt/pru_generic.so: cannot open shared object file: No such file or directory
rpath=/usr/lib/linuxcnc/rt-preempt

Even though the file is actually there:
$ ls /usr/lib/linuxcnc/rt-preempt | grep pru
hal_pru.so
hal_pru_generic.so
hal_prudebug.so
pru_decamux.bin
pru_decamux.dbg
pru_generic.bin
pru_generic.dbg

This is my linuxcnc.log (export DEBUG=5):
May 12 14:19:23 beaglebone rtapi:0: do_load_cmd: dlopen: prucode=/usr/lib/linuxcnc/rt-preempt/pru_generic.so: cannot open shared object file:$
May 12 14:19:23 beaglebone rtapi:0: rpath=/usr/lib/linuxcnc/rt-preempt
May 12 14:19:23 beaglebone rtapi:0: 1:rtapi_app:4613:user do_load_cmd: dlopen: prucode=/usr/lib/linuxcnc/rt-preempt/pru_generic.so: cannot op$
May 12 14:19:23 beaglebone rtapi:0: 1:rtapi_app:4613:user rpath=/usr/lib/linuxcnc/rt-preempt
May 12 14:19:24 beaglebone msgd:0: rtapi_app exit detected - scheduled shutdown
May 12 14:19:26 beaglebone msgd:0: msgd shutting down
May 12 14:28:07 beaglebone rtapi:0: do_load_cmd: dlopen: prucode=/usr/lib/linuxcnc/rt-preempt/pru_generic.so: cannot open shared object file:$
May 12 14:28:07 beaglebone rtapi:0: rpath=/usr/lib/linuxcnc/rt-preempt
May 12 14:28:07 beaglebone rtapi:0: 1:rtapi_app:4766:user do_load_cmd: dlopen: prucode=/usr/lib/linuxcnc/rt-preempt/pru_generic.so: cannot op$
May 12 14:28:07 beaglebone rtapi:0: 1:rtapi_app:4766:user rpath=/usr/lib/linuxcnc/rt-preempt
May 12 14:28:08 beaglebone msgd:0: rtapi_app exit detected - scheduled shutdown
May 12 14:28:10 beaglebone msgd:0: msgd shutting down


$ uname -a
Linux beaglebone 4.19.120-bone-rt-r50 #1stretch PREEMPT RT Fri May 8 22:45:31 UTC 2020 armv7l GNU/Linux

Every help would be very much appreciated,
Regards,
Klemen

John Allwine

unread,
May 12, 2023, 11:19:42 AM5/12/23
to fogl, Machinekit
Is it just a matter of adding the .bin to the file name? Something like this:
loadrt prucode=/usr/lib/linuxcnc/rt-preempt/pru_generic.bin pru=0 halname=hpg

--
website: http://www.machinekit.io blog: http://blog.machinekit.io github: https://github.com/machinekit
---
You received this message because you are subscribed to the Google Groups "Machinekit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to machinekit+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/machinekit/96db28f3-8676-472c-af15-d68fe2d1cab2n%40googlegroups.com.

Charles Steinkuehler

unread,
May 12, 2023, 11:25:17 AM5/12/23
to fogl, Machinekit
Your output indicates dlopen is looking for "pru_generic.so" but your
filesystem only has "hal_pru_generic.so".

You need to fix the script(s) trying to load the PRU HAL module or make
a symlink or something so the file dlopen is looking for actually exists.
--
Charles Steinkuehler
cha...@steinkuehler.net

klemen dovrtel

unread,
May 12, 2023, 2:06:20 PM5/12/23
to Charles Steinkuehler, Machinekit
Thank you for your reply,

I tried both options, but with no luck:
1. loadrt prucode=/usr/lib/linuxcnc/rt-preempt/hal_pru_generic pru=0 halname=hpg

returns

msgd:0 stopped
rtapi:0 stopped
rtapi_msgd command:  /usr/libexec/linuxcnc/rtapi_msgd --instance=0 --rtmsglevel=1 --usrmsglevel=1 --debug=1 --halsize=524288
rtapi_app command:  /usr/libexec/linuxcnc/rtapi_app_rt-preempt --instance=0 --debug=1
stat: No such file or directory
prutest.hal:6: insmod failed, returned -1:
do_load_cmd: dlopen: prucode=/usr/lib/linuxcnc/rt-preempt/hal_pru_generic.so: cannot open shared object file: No such file or directory
rpath=/usr/lib/linuxcnc/rt-preempt

2. loadrt prucode=/usr/lib/linuxcnc/rt-preempt/pru_generic.bin pru=0 halname=hpg

returns

msgd:0 stopped
rtapi:0 stopped
rtapi_msgd command:  /usr/libexec/linuxcnc/rtapi_msgd --instance=0 --rtmsglevel=1 --usrmsglevel=1 --debug=1 --halsize=524288
rtapi_app command:  /usr/libexec/linuxcnc/rtapi_app_rt-preempt --instance=0 --debug=1
stat: No such file or directory
prutest.hal:6: insmod failed, returned -1:
do_load_cmd: dlopen: prucode=/usr/lib/linuxcnc/rt-preempt/pru_generic.bin.so: cannot open shared object file: No such file or directory

Regards
Klemen



kdun...@gmail.com

unread,
May 12, 2023, 2:20:30 PM5/12/23
to Machinekit
Try running this command to see if a dependent library is missing:

$ ldd /usr/lib/linuxcnc/rt-preempt/hal_pru_generic.so

klemen dovrtel

unread,
May 12, 2023, 2:29:24 PM5/12/23
to kdun...@gmail.com, Machinekit
This is what i get:

$ ldd /usr/lib/linuxcnc/rt-preempt/hal_pru_generic.so
linux-vdso.so.1 (0xbeb23000)
libgcc_s.so.1 => /lib/arm-linux-gnueabihf/libgcc_s.so.1 (0xb6f2b000)
libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0xb6e3d000)
/lib/ld-linux-armhf.so.3 (0xb6f71000)

But i am not sure what this means - that the library is ok?

Regards
Klemen

--
You received this message because you are subscribed to a topic in the Google Groups "Machinekit" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/machinekit/C5KrBQkH7Gw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to machinekit+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/machinekit/71473c0e-3871-4ca0-ad67-4035ef16e2e7n%40googlegroups.com.

kdun...@gmail.com

unread,
May 12, 2023, 2:46:22 PM5/12/23
to Machinekit
Yes, it looks like that library is ok.

I don't know how up-to-date these paths/filenames are but have you tried looking in the various places described here: https://github.com/machinekit/machinekit/blob/master/scripts/linuxcnc.in#L210

Machinekit terminated with an error.  For simple cases more information
can be found in the following files:
    $HOME/linuxcnc_debug.txt
    $HOME/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

Charles Steinkuehler

unread,
May 12, 2023, 2:50:06 PM5/12/23
to klemen dovrtel, Machinekit
You are missing the name of the HAL driver. The loadrt command expects
a driver name, then the arguments. The error in your first command
shows the HAL system trying to load the HAL driver named:

"prucode=/usr/lib/linuxcnc/rt-preempt/hal_pru_generic"

...you need something like:

loadrt hal_pru_generic <options>
--
Charles Steinkuehler
cha...@steinkuehler.net

John Allwine

unread,
May 12, 2023, 3:47:50 PM5/12/23
to Charles Steinkuehler, klemen dovrtel, Machinekit
Maybe symlinking the other file would work?
sudo ln -s /usr/lib/linuxcnc/rt-preempt/hal_pru_generic.so /usr/lib/linuxcnc/rt-preempt/pru_generic.so

Also, maybe specify the specific file for your prucode, which includes the .bin?
loadrt prucode=/usr/lib/linuxcnc/rt-preempt/pru_generic.bin pru=0 halname=hpg

           

          John Allwine

          Principal Software Engineer


         1.406.451.3799

          https://www.pentamachine.com

 




You received this message because you are subscribed to the Google Groups "Machinekit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to machinekit+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/machinekit/c4be3f48-84e6-d3ad-1660-4d5252849489%40steinkuehler.net.

klemen dovrtel

unread,
May 12, 2023, 11:26:14 PM5/12/23
to John Allwine, Charles Steinkuehler, Machinekit
Charles was right, I was missing the name :)

This now loads the pru:
loadrt hal_pru_generic prucode=/usr/lib/linuxcnc/rt-preempt/pru_generic.bin pru=0 halname=hpg

Thank you all for your help and fast response
Regards
Klemen
Reply all
Reply to author
Forward
0 new messages