-
Notifications
You must be signed in to change notification settings - Fork 223
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
Fix build with yaml-cpp installed system-wise #160
Conversation
Is
So in the install space Of course one could change rviz_yaml_cpp_vendor-extras.cmake.in to figure out the value of It might actually be better to use the modern-cmake target provided by yaml_cpp instead of /usr/lib/cmake/yaml-cpp/yaml-cpp-targets.cmake, lines 47-48:
/usr/lib/cmake/yaml-cpp/yaml-cpp-targets-release.cmake:
We can see that |
You're right on availability of System-installed yaml-cpp does not have to set additional include directories, as it's placed in the global |
I've updated the PR. Now the generated (...)
if(0)
set(rviz_yaml_cpp_vendor_INCLUDE_DIRS ${YAML_CPP_INCLUDE_DIR})
endif() |
set(rviz_yaml_cpp_vendor_INCLUDE_DIRS ${YAML_CPP_INCLUDE_DIR}) | ||
|
||
if(@rviz_yaml_cpp_vendor_LOCAL_YAML@) | ||
set(rviz_yaml_cpp_vendor_INCLUDE_DIRS ${YAML_CPP_INCLUDE_DIR}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can't make this assumption. If I install yaml cpp to ~/local
and add that to my CMAKE_PREFIX_PATH
this assumption won't hold.
Also, it doesn't buy you anything to special case this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This in fact has fixed the fatal error: stdlib.h: No such file or directory
error - if /usr/include
, which system-wise installed yaml-cpp reports in YAML_CPP_INCLUDE_DIR
, is passed to compiler as -isystem
it breaks everything.
What would you suggest then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest that you have a special case (this version of yaml-cpp on Linux for example) and in that case iterate over the headers and remove/change the /usr/include
instance. Assuming the include directory is not needed when we don't build it locally isn't a safe assumption to make.
is passed to compiler as -isystem it breaks everything.
Separate question, why is the content of YAML_CPP_INCLUDE_DIR
getting passed after -isystem
rather than -I
? Is something using include_directories(SYSTEM ...)
somewhere?
I've finally got time to dig into the issue a bit more. It's quite a whack-a-mole...
For now, I've simply disabled the I'll open a separate issue for optionally using system-wise yaml-cpp and another one for ament's |
This might also be a fix/workaround for #224. |
@wjwwood FYI: I put the |
merging this.. |
thanks @mjbogusz for the investigation and the contribution! |
EDIT: Reduced the scope of the PR. Now it only fixes using system-wise installed yaml-cpp's
INCLUDE_DIR
which resulted in passing-isystem /usr/include
to compiler.Below is the comment for original scope of this PR.
This fixes issues mentioned in #152:
-isystem /usr/include
to compiler (resulting infatal error: stdlib.h: No such file or directory
) ifyaml-cpp
is installed system-wiseyaml-cpp
(thus requiring to additionally download and compile)unrecognized command line option ‘-Wno-gnu-zero-variadic-macro-arguments’
)I can split this PR into two (yaml-cpp and variadic macros) if that's the preferred workflow.