Questions about using comp

More
12 Jul 2012 22:23 #21852 by billooms
I have several questions regarding the proper use of comp for compiling my own components. My component is called keypad.comp and the linesadded to my postgui.hal file are:
loadrt keypad count=1
addf keypad servo-thread

I have the source for linuxcnc downloaded and compiled in /usr/src/build/src. If I add my own component to hal/compoents, I can do a make and it compiles without errors. However, it isn't found when I launch linuxcnc:
keypad: dlopen: /usr/lib/linuxcnc/modules/keypad.so cannot open shared object file: No such file or directory

If I manually copy /usr/src/build/rtlib/keypad.so to /usr/lib/linuxcnc/modules it still is not loaded:
HAL: ERROR: function keypad not found

Also, if I try to keep the keypad.comp in my home directory (instead of copying it to the /usr/src/build/src/hal/components directory), the comp command is not found when I try to use it from the terminal. It exists in the /usr/src/build/bin/ directory and works if I type the full path name. Then in my own directory I do the following (based on HAL Manual V2.5 section 14.13):
/usr/src/build/bin/comp keypad.comp
/usr/src/build/bin/comp --compile keypad.comp
/usr/src/build/bin/comp --install keypad.comp
/usr/src/build/bin/comp --document keypad.comp

No errors, and the keypad.so is copied to /usr/src/build/rtlib but again the component does not load.

There's something obvious that I'm missing in all of this -- any help on what I'm missing?

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

More
12 Jul 2012 22:30 #21854 by andypugh
billooms wrote:

There's something obvious that I'm missing in all of this -- any help on what I'm missing?

My first guess would be the not-obvious requirement to run the correct environment script.
The run-in-place one will be in linuxcnc-dev/scripts/rip-environment
You can probably also use . ./ linuxcnc-dev/scripts/linuxcnc to setup the environment and start linuxcnc.

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

More
12 Jul 2012 22:54 #21855 by billooms
Thanks for the quick reply.

I did the rip-environment and now comp is recognized as it should be.

The command "comp --install keypad.comp" builds the .so file in /usr/src/build/rtlib/ but when I launch linuxcnc it still gives the message:
keypad: dlopen: /usr/lib/linuxcnc/modules/keypad.so cannot open shared object file: No such file or directory

Apparently, linuxcnc is looking in /usr/lib/linuxcnc/modules and not looking in /usr/src/build/rtlib.

One more thing (maybe important, maybe not) -- I'm running simulation mode linuxcnc here in my office.

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

More
12 Jul 2012 23:02 #21857 by andypugh
billooms wrote:

Apparently, linuxcnc is looking in /usr/lib/linuxcnc/modules and not looking in /usr/src/build/rtlib.


Are you starting linuxcnc from the command line, or the GUI?

The GUI will (by default) use the installed version. After a rip-environment the command-line will use the rip-version.

I am surprised that comp doesn't work in the installed environment though. Did you "sudo" the comp --install?

There's little to be lost from copying the .so (actually, I would expect a .ko) from the linuxcnc-dev/src directory to /usr/src/build/rtlib

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

More
13 Jul 2012 09:07 #21864 by ArcEye
Hi

As Andy said, suspect you are executing linuxcnc outside the shell environment in which you ran . ./scripts/rip-environment

That first period (.) is crucial and means it persists only within the current shell session.

Even if you launched linuxcnc from the command line in another terminal, it would still default to the installed version.

regards

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

More
13 Jul 2012 18:40 #21913 by billooms
Andy -- No, I didn't sudo the comp --install. Without the sudo, it did successfully copy the .so to /usr/src/build/rtlib. When I do sudo it, I get the following:
sudo: comp: command not found

In a terminal window I change to directory /usr/src/build and execute the . ./scripts/rip-environment command (with the period). Then from that same terminal window I launch linuxcnc and it finds my component just fine! So I'm back in business for now!

Thank you for your help!

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

Time to create page: 0.063 seconds
Powered by Kunena Forum