trouble using self made component

More
12 Apr 2017 16:47 #91256 by islander261
Hello

I have created a simple realtime component that I need to use. I have compiled and installed the component with no error being reported, see next.
jd@plasma1 ~/linuxcnc-dev/configs/plasma_eoffset $ sudo halcompile --install sel_cmd.comp
Compiling realtime sel_cmd.c
Linking sel_cmd.so
cp sel_cmd.so /usr/lib/linuxcnc/modules/
jd@plasma1 ~/linuxcnc-dev/configs/plasma_eoffset $ sudo halcompile --compile sel_cmd.comp
Compiling realtime sel_cmd.c
Linking sel_cmd.so
jd@plasma1 ~/linuxcnc-dev/configs/plasma_eoffset $ 

I then load and instantiate like this:
...
loadrt lowpass names=lowpass.arcvolts
loadrt sel_cmd
loadrt eoffset_pid names=hc
...
addf mux2.thc_speed           servo-thread
addf sel_cmd              servo-thread
addf hc                       servo-thread
...
#

I then try to start Linuxcnc and get this segment of the startup message:
jd@plasma1 ~/linuxcnc-dev $ . scripts/linuxcnc -k
LINUXCNC - 2.8.0~pre1
Machine configuration directory is '/home/jd/linuxcnc-dev/configs/plasma_eoffset'
Machine configuration file is 'plasma_eoffset_1.ini'
Starting LinuxCNC...
...
hm2/hm2_7i76e.0:     IO Pin 050 (P3-13): IOPort
hm2/hm2_7i76e.0: registered
sel_cmd: dlopen: /home/jd/linuxcnc-dev/rtlib/sel_cmd.so: cannot open shared object file: No such file or directory
./plasma_eoffset_1.hal:27: waitpid failed /home/jd/linuxcnc-dev/bin/rtapi_app sel_cmd
./plasma_eoffset_1.hal:27: /home/jd/linuxcnc-dev/bin/rtapi_app exited without becoming ready
./plasma_eoffset_1.hal:27: insmod for sel_cmd failed, returned -1
HAL: ERROR: function 'sel_cmd' not found
./plasma_eoffset_1.hal:55: addf failed
./plasma_eoffset_1.hal:416: Pin 'sel_cmd.gui_set_point' does not exist
./plasma_eoffset_1.hal:419: Pin 'sel_cmd.arc_volts_in' does not exist
./plasma_eoffset_1.hal:421: Pin 'sel_cmd.setpoint_mode_enable' does not exist
./plasma_eoffset_1.hal:462: Pin 'sel_cmd.command_value_out' does not exist
Found file(REL): ./custom.hal
sel_cmd: dlopen: /home/jd/linuxcnc-dev/rtlib/sel_cmd.so: cannot open shared object file: No such file or directory
...

Ok, so I copy sel_cmd.so to the /home/jd/linuxcnc-dev/rtlib directory and try to start Linuxcnc again and this is now what happens:
jd@plasma1 ~/linuxcnc-dev $ . scripts/linuxcnc -k
LINUXCNC - 2.8.0~pre1
Machine configuration directory is '/home/jd/linuxcnc-dev/configs/plasma_eoffset'
Machine configuration file is 'plasma_eoffset_1.ini'
Starting LinuxCNC...
...
hm2/hm2_7i76e.0:     IO Pin 050 (P3-13): IOPort
hm2/hm2_7i76e.0: registered
HAL: ERROR: function 'sel_cmd' not found
./plasma_eoffset_1.hal:55: addf failed
./plasma_eoffset_1.hal:416: Pin 'sel_cmd.gui_set_point' does not exist
./plasma_eoffset_1.hal:419: Pin 'sel_cmd.arc_volts_in' does not exist
./plasma_eoffset_1.hal:421: Pin 'sel_cmd.setpoint_mode_enable' does not exist
./plasma_eoffset_1.hal:462: Pin 'sel_cmd.command_value_out' does not exist
Found file(REL): ./custom.hal
...

I do not know what I am doing incorrectly, at least I think that I am following the instructions in the documents correctly. What other information is need to tell what the problem is here? TIA

John

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

More
12 Apr 2017 21:19 #91265 by islander261
Hello

Ok, I did make a silly error.

I forgot, actually didn't pay attention, to the fact that hal component names with under scores have those underscores changed to dashes. I really needed to pay better attention to all the effects described under the HALNAME section and chart showing how HALNAME, C Identifier and HAL Identifiers are handled.

John

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

More
12 Apr 2017 21:22 #91266 by rodw
John, I don't think you should be using sudo. That will log you in as root and attempt to install the comp in the root user home folders... so you don't have access when you run linuxcnc as a user... and you will have permissions issues. Try
halcompile --install sel_cmd.comp

But you may need to delete some files now (as the user may not be able to overwite root owned files. If in doubt, do a "make clean" and start again.

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

More
13 Apr 2017 14:38 #91314 by andypugh

John, I don't think you should be using sudo.


Actually, to install the component in an installed LinuxCNC system you _do_ need to use sudo halcompile --install.

There is some confusion above about where the compionent is being sent (see the "cp ..... " line.)

To install into the linuxcnc-dev run-in-place system you need to run . ./scripts/rip-environment before running halcompile in the same terminal. (and that really is dot space dot slash)

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

More
13 Apr 2017 15:57 #91322 by islander261
Thank you for the replies.

I found that the halcompile failed during the cp step because of permission problems if I didn't use sudo.

I didn't know that the rip environment needed to be set fresh in each new terminal session. I just figured that halcompile was hard wired to the installed directory structure and manually copied the file to the ~/linuxcnc-dev/rtlib directory.

John

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

More
14 Apr 2017 01:52 #91339 by rodw

John, I don't think you should be using sudo.


Actually, to install the component in an installed LinuxCNC system you _do_ need to use sudo halcompile --install.

There is some confusion above about where the compionent is being sent (see the "cp ..... " line.)

To install into the linuxcnc-dev run-in-place system you need to run . ./scripts/rip-environment before running halcompile in the same terminal. (and that really is dot space dot slash)


Andy, but on my run in place system and the rip-environment configured on terminal startup, halcompile works for me without using sudo. Maybe its only required on an ISO or .deb install. I did a full make last night and had to recompile my comps. I just checked the terminal history and I did not use sudo. (I do need it to do other things).

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

More
14 Apr 2017 09:05 #91347 by andypugh
As I said, to install in an installed system you need sudo. You don't need it in a rip system.
The following user(s) said Thank You: rodw

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

Time to create page: 0.073 seconds
Powered by Kunena Forum