New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add relative path to orignal folder to include dirs for easier header… #515
Conversation
I will try to test this tonight. (Might need to change the path in mesa_uart.comp) |
If I understand correctly, the problem you're trying to address is that a header "next to" a .comp file isn't found during compilation, due to the way the generated .c file is in a temporary location. I believe the added directive should be a "-iquote", and the .comp file should use the ""-include syntax, not the <>-include syntax, if the goal is to include a header that is relative to the input, rather than a system header. Please see the documentation snipped below from the manual of gnu cpp: But you also mention an in-tree component by name. That's weird; those should all build without problems during the usual build process. Perhaps there's something else going on, and more background would be helpful in understanding the problem.
|
The mesa_uart.comp is a sample file that includes hostmot2.h but isn't in the hostmot2 folder. That currently compile OK. I wanted to make sure that it still compiles OK with this change. |
Looking at the Travis log, it seems that mesa_uart does not currently get built, but mesa_7i65 (in the same folder) does. linuxcnc/src/hal/components/Submakefile Line 13 in 0f91c55
Seems to be a uspace thing. |
yes the "-iquote" did the trick. this is what i tried yesterday. as an example, working on wj200_vfd.comp i needed to add: what is proposed here is to add automatically this directory wherever it is. |
OK, in theory I like this, but there is a problem. If I change the (messy) reference in mesa_uart.comp and mesa_7i65.comp to "hostmot2/hostmot2.h" then halcompile works nicely when compiling with halcompile --install. objects/hal/drivers/mesa_uart.c:13:36: fatal error: mesa-hostmot2/hostmot2.h: No such file or directory With this change I haven't found an "include" for comp that works both standalone halcompile and when running "Make" This might not actually be a problem. Is there a requirement to compile built-in comps outside "Make"?It did work nicely when I made a test comp in my home folder with an "adjacent" .h file. |
Can we step back and state what the problem is? Maybe it is: Using just the headers in linuxcnc-dev, or just the headers that are It seems to me that this is different from what you're saying, which is that we should commit to having any single source file (including .comp files) be able to be built separately from LinuxCNC. There could be legitimate reasons for this, such as that they are using APIs that are NOT intended to be part of a stable public interface. |
as reference a took mesa_7i65 and mesa_uart to try to reproduce the issue a)i cloned a fresh linuxcnc tree from github so i'm unable to reproduce this issue |
I think I failed to do a proper A B A comparision. (It was past midnight when I finally found the time) I did build a .comp with associated .h out-of-tree successfully with the patch, but didn't try to build it without the patch, so can't actually say if the patch helped. |
I have now tried what I thought was the problem, with your patch, with base master and with base 2.7. I am pretty sure I have seen the problem you have seen, but the issue is finding an example that proves the fix. #516 includes two useful thing that have been prompted by looking in this area, but Both Jeff and I are need a bit of help to see what your patch fixes. I apologise that part of this confusion is my fault. I made an assumption about what was fixed, and then tested it badly. |
part of this message came from this post As a concrete example, of out-of-tree compiling component, with the current master now if one want to use an additionnal include file wj200_vfd.h, located in the same directory as the comp updating the corresponding .comp file like this so keeping now, reverting the change in halcompile.g and doing this last step again |
I think that the second problem is avoided (without your patch) by not using but instead using (As mentioned by jepler earlier: |
i thought "-iquote" needed a full relative or absolute filepathname |
This is a test for LinuxCNC#515.
I think I finally understand! Thanks for your patience, @oro06 and your help @andypugh I would still prefer to use "-iquote". but aside from that I am in favor of the proposed change. I have added another pull request which shows a test that fails now but works after this change (or the -iquote version of the change), #517. We can merge that one in after this one. @SebKuzminsky do you want any of these fixes (#515, #516) in 2.7? |
imho, if this patch is not required, better not to add it, particularly if it's a matter of but it seems, there is still an issue a) <>-include syntax b) ""-include syntax single filename and in-tree c) ""-include syntax absolute fullfilepathname and in-tree note: using instead |
so unless another path is followed (like copying next-to .h in the temp directory together with the .comp file) , it's imho still usefull |
Yes, I agree that without a change That's why I would like to This is almost the same as the original pull request, but using |
I am a little confused now. In my testing include "..." for a header in the same directory as the .comp file passed with base master and with 2,7. However this was with the header and .comp in my root directory, I didn't test any alternative locations. |
No, my test was without "option userspace" |
changed -I to -iquote as per associated thread
it works for me for out of tree compilation