- Posts: 63
- Thank you received: 0
Getting Halcompile to work
I crate a very simple hal component, but could not get it to compile. One of the other forum member tried compiling my basic program and it worked, so obviously I am doing something wrong when I try to compile. The name of the component and the filename are exactly the same, except that the file name ends with ".comp". When I try to compile I get the error messages of:
john@tree325 ~ $ sudo halcompile --install Drawbar2.comp
Traceback (most recent call last):
File "/usr/bin/halcompile", line 1353, in <module>
main()
File "/usr/bin/halcompile", line 1322, in main
process(f, mode, outfile)
File "/usr/bin/halcompile", line 1192, in process
a, b = parse(filename)
File "/usr/bin/halcompile", line 417, in parse
a, b = f.split("\n;;\n", 1)
ValueError: need more than 1 value to unpack
Since several of the error lines deal with outfile and filename, I am wondering if my problem is that I am not putting my comp file in the correct directory prior to compiling. As I said, halcompile is in the usr/bin folder. I have placde my comp file in the top level folder for my user account which is /home/john/, but I am thinking this is probably not correct even if I fully specify the filename in the halcompile command. I know what I want, and what I need to do in the component file itself, I just need to figure out how to compile these component files. It is like being stuck on the "hello world" program for C.
Any assistance would be greatly appreciated. Thanks.
Please Log in to join the conversation.
- tommylight
-
- Away
- Administrator
-
- Posts: 22010
- Thank you received: 3
Please Log in to join the conversation.
Please Log in to join the conversation.
If you are trying to compile a hal component using halcompile and you are getting errors like the following:
Traceback (most recent call last):
File "/usr/bin/halcompile", line 1353, in <module>
main()
File "/usr/bin/halcompile", line 1322, in main
process(f, mode, outfile)
File "/usr/bin/halcompile", line 1192, in process
a, b = parse(filename)
File "/usr/bin/halcompile", line 417, in parse
a, b = f.split("\n;;\n", 1)
ValueError: need more than 1 value to unpack
There is a good chance that the problem is because the original Hal component file was created on a windows system. When I initially created my Hal file, I used Microsoft Visual Studio just like I would to create a standard C program. Apparently Windows and Linux use different control characters within their files for things like the carriage return at the end of a line and possibly other things. It appears that HalCompile does not like the windows version of these hidden characters.
To fix my problem, I took my original hal component file and retyped it in on my linux machine using the linux text editor and the file compiled just fine.
Please Log in to join the conversation.
jwsigler wrote: To fix my problem, I took my original hal component file and retyped it in on my linux machine using the linux text editor and the file compiled just fine.
Yikes!
Easier ways include asking Notepad++ (Windows) to fix it for you,
I think edit may also be able to do it. If nit, a copy/replace can be used.
No help to you, but at least the error is less cryptic now:
github.com/LinuxCNC/linuxcnc/commit/f13a...df78d0ef02cd04740000
Please Log in to join the conversation.
Please Log in to join the conversation.
jwsigler wrote: If people like to use a Windows based system to create their HAL component files, I have found that WordPad can be used to create Hal Component files.
Notepad++ is probably a better bet, it does syntax highlighting and other nice things.
Ithe sooner they release the Linux version the better
Please Log in to join the conversation.
andypugh wrote:
jwsigler wrote: If people like to use a Windows based system to create their HAL component files, I have found that WordPad can be used to create Hal Component files.
Notepad++ is probably a better bet, it does syntax highlighting and other nice things.
Ithe sooner they release the Linux version the better
I use it on Linux, emulated with wine.
For me is one of the first things to do when installs Linux
Please Log in to join the conversation.
In my case I had forgotten to put the double semi-colon at the start of my custom component.
To get halcompile to work, try copying one of the examples into your text editor saving as example.comp and then try to halcompile --preprocess example.comp
That should at least prove that halcompile is working even if it doesn't make your error apparent.
Please Log in to join the conversation.
There could probably be a specific test for this step going wrong, wrapping the split in a try/except
Please Log in to join the conversation.
