Skip to content
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

Header files have ambiguous names. #2603

Open
dwmw2 opened this issue Apr 21, 2021 · 2 comments
Open

Header files have ambiguous names. #2603

dwmw2 opened this issue Apr 21, 2021 · 2 comments

Comments

@dwmw2
Copy link
Contributor

dwmw2 commented Apr 21, 2021

The standard installation of libopenzwave puts header files into a certain directory (e.g /usr/local/include/openzwave) and then the pkg-config file libopenconnect.pc adds that directory itself to the compiler's include search path, so that header files are included by an application as e.g.

#include <Node.h>

This is a problem because those header names are very ambiguous. Especially on case-insensitive systems where any "node.h" on the compiler include path is going to get included instead.

Applications can't just do #include <openzwave/Node.h> because the actual include directory is configurable and might not even have openzwave as the final component of the pathname — and even if it did, the parent directory (in the above example /usr/local/include) might not even be on the compiler's search path anyway; OpenZWave's own pkg-config file would need to specify it correctly.

This is causing build failures on Mac OS for Domoticz: domoticz/domoticz#4114

@dwmw2
Copy link
Contributor Author

dwmw2 commented Apr 21, 2021

The solution here is probably to start guaranteeing that the final component of the include pathname will be openzwave and then for the pkg-config file to add both the parent and the actual directories to CFLAGS.

That way we don't immediately break applications which include the ambiguous <node.h>; we can deprecate those include directives and move applications to <openzwave/Node.h> over time before finally dropping the directory itself from CFLAGS?

@dwmw2
Copy link
Contributor Author

dwmw2 commented Apr 21, 2021

Or a trick like this..

# cd /opt/zwave/include/openzwave
# mkdir openzwave
# mv * openzwave
# for a in `find openzwave -name \*.h` ; do echo -e "#warning Please include <$a> not just <${a#openzwave/*}>\\n#include <openzwave/${a#openzwave/*}>" > ${a#openzwave/*}; done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant