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

Compilation error with clang++ 17 #1446

Closed
Ecordonnier opened this issue Apr 8, 2024 · 3 comments
Closed

Compilation error with clang++ 17 #1446

Ecordonnier opened this issue Apr 8, 2024 · 3 comments

Comments

@Ecordonnier
Copy link
Contributor

Ecordonnier commented Apr 8, 2024

I am trying to consume libcrun in a c++ program compiled with clang++ 17 by including libcrun/container.h in "extern C" blocks.

#ifdef __cplusplus
extern "C" {
#include <libcrun/container.h>
#endif

#ifdef __cplusplus
}
#endif

The issue is that container.h includes ocispec/runtime_spec_schema_config_schema.h, which contains the following code which uses the reserved c++ keyword "class":

typedef struct {
    char *class;
    int32_t priority;
    yajl_val _residual;
    unsigned int priority_present : 1;
}

Thus the compilation fails.

I am not familiar with the crun repository. Should this be fixed by replacing the "class" keyword while generating the C header-file in https://github.com/containers/libocispec/blob/main/src/ocispec/headers.py ?

@giuseppe
Copy link
Member

giuseppe commented Apr 8, 2024

yes, I think we need to solve that by changing class with something else. Perhaps adding a underscore at the end?

This must be solved in the libocispec repo though: https://github.com/containers/libocispec

@Ecordonnier
Copy link
Contributor Author

yes, I think we need to solve that by changing class with something else. Perhaps adding a underscore at the end?

This must be solved in the libocispec repo though: https://github.com/containers/libocispec

OK, I cloned the issue to containers/libocispec#132 . Do you want to close this one?

@giuseppe
Copy link
Member

giuseppe commented Apr 8, 2024

thanks, closing it now

@giuseppe giuseppe closed this as completed Apr 8, 2024
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

2 participants