- LinuxCNC
- General LinuxCNC Questions
- Problems with including comp userspace application file to LinuxCNC project
Problems with including comp userspace application file to LinuxCNC project
- smal
- Offline
- Senior Member
Less
More
- Posts: 60
- Thank you received: 4
24 Aug 2023 06:58 #278837
by smal
Problems with including comp userspace application file to LinuxCNC project was created by smal
Hello
I would like to make my own userspace application which will communicate with my external electronics over serial/USB port like it is made in this project:
forum.linuxcnc.org/18-computer/22562-ard...or-linuxcnc?start=90
Actually I took this project as a basis for my work but already in his original form does not want to load. When I start the LinuxCNC application I get the following printouts:
Debug file information:
Note: Using POSIX realtime
./smal3D_CNC_machine.hal:66: execv(serialcon): No such file or directory
./smal3D_CNC_machine.hal:66: waitpid failed serialcon serialcon
./smal3D_CNC_machine.hal:66: serialcon exited without becoming ready
1609
Stopping realtime threads
Unloading hal components
RTAPI_PCI: Unmapped 65536 bytes at 0x7f29d8691000
Note: Using POSIX realtime
Complete linuccnc.report file is in attachment.
My procedure:
1. I have placed serialcon.comp file in my comp file project -> ./src/hal/components/serialcon.comp
2. Compile it -> smal@LinuxCNC:~/linuxcnc-2.8/src$ make
and smal@LinuxCNC:~/linuxcnc-2.8/src$ sudo make setuid
3. To see what the compiler has done I look for all files created in the process:
smal@LinuxCNC:~/linuxcnc-2.8$ find . -name serialcon.*
./docs/man/man9/serialcon.9
./src/hal/components/serialcon.comp
./src/objects/serialcon.sym
./src/objects/serialcon.ver
./src/objects/hal/components/serialcon.c
./src/objects/hal/components/serialcon.mak
./src/objects/rtobjects/hal/components/serialcon.d
./src/objects/rtobjects/hal/components/serialcon.o
./src/objects/serialcon.tmp
./rtlib/serialcon.so
smal@LinuxCNC:~/linuxcnc-2.8$
4. Then loadusr -W serialcon was added to my main hal file
As it seems linuxcnc application does not find serialcon.so file. Is rtlib the right folder for userspace applications? Because I am also using other comp files which I wrote for realtime space and they all work as expected.
Kind regards
Simon
I would like to make my own userspace application which will communicate with my external electronics over serial/USB port like it is made in this project:
forum.linuxcnc.org/18-computer/22562-ard...or-linuxcnc?start=90
Actually I took this project as a basis for my work but already in his original form does not want to load. When I start the LinuxCNC application I get the following printouts:
Debug file information:
Note: Using POSIX realtime
./smal3D_CNC_machine.hal:66: execv(serialcon): No such file or directory
./smal3D_CNC_machine.hal:66: waitpid failed serialcon serialcon
./smal3D_CNC_machine.hal:66: serialcon exited without becoming ready
1609
Stopping realtime threads
Unloading hal components
RTAPI_PCI: Unmapped 65536 bytes at 0x7f29d8691000
Note: Using POSIX realtime
Complete linuccnc.report file is in attachment.
My procedure:
1. I have placed serialcon.comp file in my comp file project -> ./src/hal/components/serialcon.comp
2. Compile it -> smal@LinuxCNC:~/linuxcnc-2.8/src$ make
and smal@LinuxCNC:~/linuxcnc-2.8/src$ sudo make setuid
3. To see what the compiler has done I look for all files created in the process:
smal@LinuxCNC:~/linuxcnc-2.8$ find . -name serialcon.*
./docs/man/man9/serialcon.9
./src/hal/components/serialcon.comp
./src/objects/serialcon.sym
./src/objects/serialcon.ver
./src/objects/hal/components/serialcon.c
./src/objects/hal/components/serialcon.mak
./src/objects/rtobjects/hal/components/serialcon.d
./src/objects/rtobjects/hal/components/serialcon.o
./src/objects/serialcon.tmp
./rtlib/serialcon.so
smal@LinuxCNC:~/linuxcnc-2.8$
4. Then loadusr -W serialcon was added to my main hal file
As it seems linuxcnc application does not find serialcon.so file. Is rtlib the right folder for userspace applications? Because I am also using other comp files which I wrote for realtime space and they all work as expected.
Kind regards
Simon
Please Log in or Create an account to join the conversation.
- Aciera
- Offline
- Administrator
Less
More
- Posts: 4001
- Thank you received: 1728
24 Aug 2023 08:06 #278842
by Aciera
Replied by Aciera on topic Problems with including comp userspace application file to LinuxCNC project
Maybe try using halcompile:
$ halcompile --install ./src/hal/components/serialcon.comp
$ halcompile --install ./src/hal/components/serialcon.comp
Please Log in or Create an account to join the conversation.
- smal
- Offline
- Senior Member
Less
More
- Posts: 60
- Thank you received: 4
24 Aug 2023 18:12 #278876
by smal
Replied by smal on topic Problems with including comp userspace application file to LinuxCNC project
smal@LinuxCNC:~/linuxcnc-2.8$ halcompile --install ./src/hal/components/serialcon.comp
gcc -I/usr/include -I/usr/include/linuxcnc -URTAPI -U__MODULE__ -DULAPI -Os -o serialcon /tmp/tmpeQRRro/serialcon.c -Wl,-rpath,/lib -L/lib -llinuxcnchal
Traceback (most recent call last):
File "/usr/bin/halcompile", line 1508, in <module>
main()
File "/usr/bin/halcompile", line 1478, in main
process(f, mode, outfile)
File "/usr/bin/halcompile", line 1371, in process
build_usr(tempdir, outfilename, mode, filename)
File "/usr/bin/halcompile", line 1098, in build_usr
shutil.copy(output, os.path.join(BASE, "bin", binname))
File "/usr/lib/python2.7/shutil.py", line 139, in copy
copyfile(src, dst)
File "/usr/lib/python2.7/shutil.py", line 97, in copyfile
with open(dst, 'wb') as fdst:
IOError: [Errno 13] Permission denied: '/usr/bin/serialcon'
smal@LinuxCNC:~/linuxcnc-2.8$
There is no file serialcon in this /usr/bin/ folder.
gcc -I/usr/include -I/usr/include/linuxcnc -URTAPI -U__MODULE__ -DULAPI -Os -o serialcon /tmp/tmpeQRRro/serialcon.c -Wl,-rpath,/lib -L/lib -llinuxcnchal
Traceback (most recent call last):
File "/usr/bin/halcompile", line 1508, in <module>
main()
File "/usr/bin/halcompile", line 1478, in main
process(f, mode, outfile)
File "/usr/bin/halcompile", line 1371, in process
build_usr(tempdir, outfilename, mode, filename)
File "/usr/bin/halcompile", line 1098, in build_usr
shutil.copy(output, os.path.join(BASE, "bin", binname))
File "/usr/lib/python2.7/shutil.py", line 139, in copy
copyfile(src, dst)
File "/usr/lib/python2.7/shutil.py", line 97, in copyfile
with open(dst, 'wb') as fdst:
IOError: [Errno 13] Permission denied: '/usr/bin/serialcon'
smal@LinuxCNC:~/linuxcnc-2.8$
There is no file serialcon in this /usr/bin/ folder.
Please Log in or Create an account to join the conversation.
- tommylight
- Away
- Moderator
Less
More
- Posts: 19460
- Thank you received: 6529
24 Aug 2023 18:44 #278878
by tommylight
Replied by tommylight on topic Problems with including comp userspace application file to LinuxCNC project
Tldnr,
Are you trying to access something over serial?
First thing anyone using serial on Linux should do is:
sudo apt purge brltty
As it does not allow normal access to serial ports.
Usually this was no issue, but with the advent of feature keyboards most Linux's will install it, although it used for old Braile keyboards.
Go figure.....
Are you trying to access something over serial?
First thing anyone using serial on Linux should do is:
sudo apt purge brltty
As it does not allow normal access to serial ports.
Usually this was no issue, but with the advent of feature keyboards most Linux's will install it, although it used for old Braile keyboards.
Go figure.....
The following user(s) said Thank You: smal
Please Log in or Create an account to join the conversation.
- smal
- Offline
- Senior Member
Less
More
- Posts: 60
- Thank you received: 4
24 Aug 2023 19:27 #278883
by smal
Replied by smal on topic Problems with including comp userspace application file to LinuxCNC project
Yes that would be one of the goals of my software. But this is for the moment not yet a problem because I am not able to load this module at the start of linuxcnc application.
As it look like somehow serialcon.so is not visible for the linuxcnc.
I do not have the same problem with my realtime comp modules. Maybe it has something to do because it is userspace?
As it look like somehow serialcon.so is not visible for the linuxcnc.
I do not have the same problem with my realtime comp modules. Maybe it has something to do because it is userspace?
Please Log in or Create an account to join the conversation.
- Aciera
- Offline
- Administrator
Less
More
- Posts: 4001
- Thank you received: 1728
25 Aug 2023 05:40 #278900
by Aciera
Replied by Aciera on topic Problems with including comp userspace application file to LinuxCNC project
I presumed you were on a run-in-place install (ie a git clone) however it seems that maybe you are on a deb installation.
In that case you would have to use sudo:
$ sudo halcompile --install ./src/hal/components/serialcon.comp
In that case you would have to use sudo:
$ sudo halcompile --install ./src/hal/components/serialcon.comp
Please Log in or Create an account to join the conversation.
- smal
- Offline
- Senior Member
Less
More
- Posts: 60
- Thank you received: 4
25 Aug 2023 07:06 #278904
by smal
Replied by smal on topic Problems with including comp userspace application file to LinuxCNC project
Yes I were on run-in-place install (git clone) but using sudo helped somehow.
smal@LinuxCNC:~/linuxcnc-2.8$ sudo halcompile --install ./src/hal/components/serialcon.comp
[sudo] password for smal:
gcc -I/usr/include -I/usr/include/linuxcnc -URTAPI -U__MODULE__ -DULAPI -Os -o serialcon /tmp/tmpHtNDaY/serialcon.c -Wl,-rpath,/lib -L/lib -llinuxcnchal
smal@LinuxCNC:~/linuxcnc-2.8$
But now I have completely different problems which I was not having before:
Some problems with jog whb04
Debug file information:
Note: Using POSIX realtime
Nonstandard layout:<2 (required: 1|2 are supported)>
trying: 2 (required: 1|2 are supported)
find_file_in_hallib_path: cannot find: <2 (required: 1|2 are supported)>
while executing
"find_file_in_hallib_path $cfg"
(file "./xhc-hb04.tcl" line 473)
invoked from within
"source $filename"
invoked from within
"set result [source $filename]"
(file "/home/smal/linuxcnc-2.8/scripts/haltcl" line 42)
1753
Stopping realtime threads
Unloading hal components
RTAPI_PCI: Unmapped 65536 bytes at 0x7fa50857e000
Note: Using POSIX realtime
This is also the case if I exclude loadusr -W serialcon from my hal file.
smal@LinuxCNC:~/linuxcnc-2.8$ sudo halcompile --install ./src/hal/components/serialcon.comp
[sudo] password for smal:
gcc -I/usr/include -I/usr/include/linuxcnc -URTAPI -U__MODULE__ -DULAPI -Os -o serialcon /tmp/tmpHtNDaY/serialcon.c -Wl,-rpath,/lib -L/lib -llinuxcnchal
smal@LinuxCNC:~/linuxcnc-2.8$
But now I have completely different problems which I was not having before:
Some problems with jog whb04
Debug file information:
Note: Using POSIX realtime
Nonstandard layout:<2 (required: 1|2 are supported)>
trying: 2 (required: 1|2 are supported)
find_file_in_hallib_path: cannot find: <2 (required: 1|2 are supported)>
while executing
"find_file_in_hallib_path $cfg"
(file "./xhc-hb04.tcl" line 473)
invoked from within
"source $filename"
invoked from within
"set result [source $filename]"
(file "/home/smal/linuxcnc-2.8/scripts/haltcl" line 42)
1753
Stopping realtime threads
Unloading hal components
RTAPI_PCI: Unmapped 65536 bytes at 0x7fa50857e000
Note: Using POSIX realtime
This is also the case if I exclude loadusr -W serialcon from my hal file.
Please Log in or Create an account to join the conversation.
- Aciera
- Offline
- Administrator
Less
More
- Posts: 4001
- Thank you received: 1728
25 Aug 2023 07:50 #278908
by Aciera
Also running halcompile with sudo is not something you want to do on a rip installation because it will lead to permission issues.
Replied by Aciera on topic Problems with including comp userspace application file to LinuxCNC project
I'm certainly no expert but seeing this in your terminal output:Yes I were on run-in-place install (git clone) but using sudo helped somehow.
Gives me the impression that linuxcnc may have also been installed by some sort of package because on a rip install there should be no 'halcompile' in '/usr/bin'. There certainly isn't on my system. Running rip installations alongside deb installations can lead to problems that are very difficult to troubleshoot.File "/usr/bin/halcompile", line 1478, in main
Also running halcompile with sudo is not something you want to do on a rip installation because it will lead to permission issues.
Please Log in or Create an account to join the conversation.
- smal
- Offline
- Senior Member
Less
More
- Posts: 60
- Thank you received: 4
25 Aug 2023 09:11 #278912
by smal
Replied by smal on topic Problems with including comp userspace application file to LinuxCNC project
I made it 2 years ago like this (my log file):
7. avgust 2021
Compiling your own linuxcnc:
1. Get linuxcnc 2.8.2 from the github -> github.com/LinuxCNC/linuxcnc -> switch from master to 2.8, the button is in the upper left corner.
2. unzip the package and copy from download to home
3. > cd linuxcnc-dev/src
> ./autogen.sh
> ./configure --with-realtime=uspace
> make -> you can use option -j4 for processor with 4 cores. It will speed up the process of compiling
> sudo make setuid
but before make check dependencies with:
> dpkg-checkbuilddeps
if not present:
> sudo apt-get install dpkg-dev
There should be no packages which need to be installed. If not:
Install them all with sudo apt-get install, followed by the package names
Then:
> cd linuxcnc-dev/debian
> ./configure uspace
> cd ..
But the question is now what should I do to get existing 2.8 package working? Because after proposed changes I have problems running my whb04B-6. This was not the case before. Now I am not even so far to test if loadusr -W serialcon is working.
Do you propose I should take a new package and start from the scratch? If yes which package do you propose?
7. avgust 2021
Compiling your own linuxcnc:
1. Get linuxcnc 2.8.2 from the github -> github.com/LinuxCNC/linuxcnc -> switch from master to 2.8, the button is in the upper left corner.
2. unzip the package and copy from download to home
3. > cd linuxcnc-dev/src
> ./autogen.sh
> ./configure --with-realtime=uspace
> make -> you can use option -j4 for processor with 4 cores. It will speed up the process of compiling
> sudo make setuid
but before make check dependencies with:
> dpkg-checkbuilddeps
if not present:
> sudo apt-get install dpkg-dev
There should be no packages which need to be installed. If not:
Install them all with sudo apt-get install, followed by the package names
Then:
> cd linuxcnc-dev/debian
> ./configure uspace
> cd ..
But the question is now what should I do to get existing 2.8 package working? Because after proposed changes I have problems running my whb04B-6. This was not the case before. Now I am not even so far to test if loadusr -W serialcon is working.
Do you propose I should take a new package and start from the scratch? If yes which package do you propose?
Please Log in or Create an account to join the conversation.
- smal
- Offline
- Senior Member
Less
More
- Posts: 60
- Thank you received: 4
25 Aug 2023 11:17 #278922
by smal
Replied by smal on topic Problems with including comp userspace application file to LinuxCNC project
"Gives me the impression that linuxcnc may have also been installed by some sort of package because on a rip install there should be no 'halcompile' in '/usr/bin'. "
Maybe this is the case because I have took linuxcnc install CD iso file. On that I have downloaded 2.8 which was basis for my work.
Maybe this is the case because I have took linuxcnc install CD iso file. On that I have downloaded 2.8 which was basis for my work.
Please Log in or Create an account to join the conversation.
- LinuxCNC
- General LinuxCNC Questions
- Problems with including comp userspace application file to LinuxCNC project
Time to create page: 0.399 seconds