halcompile missing additionnal include file

More
8 years 1 week ago #119326 by oro06
Hi,

i'm working on userspace wj200_vfd
i've added a local include file wj200_vfd.h in the declaration section of the comp file
and halcompile --preprocess works fine and generate .c file to the local folder
when invoking
halcompile --compile wj200_vfd.comp
i get
fatal error: wj200_vfd.h: No such file or directory
it seems .h file is not copied to the temp directory where the wj200_vfd.c file is generated

as a workaround i added it manually to the gcc cmd line generated using halcompile --compile wj200_vfd.comp

but is there a way to properly add missing .h file either by having the missing file copied to the temp directory or to force
halcompile --compile not to use a temp dir or something else ?

thanks
OR

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

More
8 years 1 week ago #119334 by andypugh
An inelegant workaround is to give the include directive a relative path from the temp file location.

github.com/LinuxCNC/linuxcnc/blob/master...s/mesa_uart.comp#L38

For an example.

I agree that it would be better if halcompile made a copy of the include file in the temp file location. (or modified the path)

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

More
8 years 1 week ago #119338 by oro06
thanks for the update

for the record, there is also a an hidden option "extra_compile_args"
not in the doc here linuxcnc.org/docs/html/hal/comp.html#_options
but looking at the source here
github.com/LinuxCNC/linuxcnc/blob/master...l/utils/halcompile.g
line 715

i just tried to add this in the declaration of the .comp file
option extra_compile_args "-I/home/linuxcnc/dev/linuxcnc-oro06.git/src/hal/user_comps/wj200_vfd/";
and that did the trick but it's not a relative path, not sure it's nice for a
future pull request to come !

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

More
8 years 1 week ago #119340 by oro06
still this was usefull with modbus.h which is not in the path

option extra_compile_args "-I/home/linuxcnc/dev/linuxcnc-oro06.git/src/hal/user_comps/wj200_vfd;-I/usr/include/modbus";

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

More
8 years 1 week ago #119341 by oro06
typo
option extra_compile_args "-I/home/linuxcnc/dev/linuxcnc-oro06.git/src/hal/user_comps/wj200_vfd -I/usr/include/modbus -std=c99";

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

More
8 years 6 days ago #119477 by andypugh
I have looked at this some more, and I am not actually sure what the problem is. I made a test .comp that required a .h file, and it compiled fine with both 2.7 and master when placed in my root folder. (ie, out-of-tree).

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

Time to create page: 0.253 seconds
Powered by Kunena Forum