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

Latest change result in dll.h not found error #1036

Closed
manoj-freyr opened this issue Sep 27, 2021 · 10 comments · Fixed by #1038
Closed

Latest change result in dll.h not found error #1036

manoj-freyr opened this issue Sep 27, 2021 · 10 comments · Fixed by #1038

Comments

@manoj-freyr
Copy link

With recent changes , da1c8d3, removing dll.h from the source code and using generate_export_header to generate dll.h is not working as it fails to generate dll.h and I am erroring out with errors in my main CMakeList with,
fatal error: 'yaml-cpp/dll.h' file not found
#include "yaml-cpp/dll.h"

@jimmieliu
Copy link

same here

@jimmieliu
Copy link

@manoj-freyr build with tag=yaml-cpp-0.7.0 could avoid the recent update

@jbeder
Copy link
Owner

jbeder commented Sep 27, 2021

Could you post the full error message please?

@manoj-freyr
Copy link
Author

Context: I am using yaml-cpp as external project via ExternalProject_Add(). Earlier dll.h was part of source tree in include/yaml-cpp/dll.h and references in the my own client code pointed to #include<yaml-cpp/dll.h> . My include_directories() was having yaml-src/include. And all worked well.

With latest change, the dll.h will be created in build/include/yaml-cpp folder. This breaks my code build unless I add build/include/yaml-cpp to include_directories().
It results in errors like ,
include/yaml-cpp/node/node.h:13:10: fatal error: 'yaml-cpp/dll.h' file not found
#include "yaml-cpp/dll.h"

PS: Adding build/include/yaml-cpp to include_directories() fixes the error. Is this right enough way?

@jbeder
Copy link
Owner

jbeder commented Sep 28, 2021

I'm honestly not sure. I reverted the PR that broke this, and asked the original author to figure out the issue. If you'd like to help as well, please do :)

@pinotree
Copy link
Contributor

Context: I am using yaml-cpp as external project via ExternalProject_Add(). Earlier dll.h was part of source tree in include/yaml-cpp/dll.h and references in the my own client code pointed to #include<yaml-cpp/dll.h> . My include_directories() was having yaml-src/include. And all worked well.

ExternalProject_Add() is basically "build that other project as if it was an embedded code copy". Hence, the burden on making sure that you use the "embedded copy" is yours, and it includes using the copy properly.

With latest change, the dll.h will be created in build/include/yaml-cpp folder. This breaks my code build unless I add build/include/yaml-cpp to include_directories(). It results in errors like , include/yaml-cpp/node/node.h:13:10: fatal error: 'yaml-cpp/dll.h' file not found #include "yaml-cpp/dll.h"

Now dll.h is generated by cmake, so it is correctly placed in the build directory.

PS: Adding build/include/yaml-cpp to include_directories() fixes the error. Is this right enough way?

Since you embed yaml-cpp (via ExternalProject_Add()), yes, that's what you have to do.

@pinotree
Copy link
Contributor

Also, forgot to ask: please provide full references to your sources. Without them, it is hard to debug why it fails by only a "this commit breaks, here is a single line error string".

@jbeder
Copy link
Owner

jbeder commented Sep 28, 2021

Thanks for the explanation, @pinotree. It sounds like the original PR was correct, but may break end-users who had misconfigured setups (e.g. using ExternalProject-Add but not include_directories build/include/yaml-cpp) - is that correct?

If so, I think resubmitting the change is fine, and it would be nice to add some documentation in the README about how to include yaml-cpp from another project, including a note about this way.

@manoj-freyr
Copy link
Author

@pinotree @jbeder Yes since I am using it as external project, handling it the way I mentioned above works.
@pinotree I will make sure I add detailed description in the issue description. Thanks for the detailed answer.

@pinotree
Copy link
Contributor

pinotree commented Oct 9, 2021

@pinotree @jbeder Yes since I am using it as external project, handling it the way I mentioned above works. @pinotree I will make sure I add detailed description in the issue description.

Can you please describe exactly how you use ExternalProject_Add()? Please provide actual code snippets, links to the code, anything. ExternalProject_Add() is a cmake function with many parameters that affect the way it works. I cannot debug issues when all I get is "it fails"...

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

Successfully merging a pull request may close this issue.

4 participants