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

Commit 089f627 leads to library linking errors due to header file missing <stdbool.h> #38

Closed
sbates130272 opened this issue Oct 8, 2020 · 0 comments · Fixed by #39
Closed

Comments

@sbates130272
Copy link

In 089f627 we added bounds_checks and introduced the bool type in ubpf.h which requires that <stdbool.h> be added to the include path. Since <stdbool.h> was already used internally this did not impact the compilation of libubpf.a. However this does cause a regression issue when linking to the library from a program that does currently include <stdbool.h>.

For example prior to commit 089f627 the following would compile using gcc:

#include <ubpf.h>                                                                                                                                                                                                                                                               
int main(void) { ubpf_create(); return 0; }

but post this commit this now fails with

/usr/local/include/ubpf.h:36:1: error: unknown type name 'bool'
   36 | bool toggle_bounds_check(struct ubpf_vm *vm, bool enable);
      | ^~~~
/usr/local/include/ubpf.h:36:46: error: unknown type name 'bool'
   36 | bool toggle_bounds_check(struct ubpf_vm *vm, bool enable);
      |                                              ^~~~

I think the correct way to solve this is to add <stdbool.h> to the external facing header file (ubpf.h) and optionally remove this from the internal files. I am happy to do a patch for this if required.

@sbates130272 sbates130272 changed the title Commit 089f6279752adfb01386600d119913403ed326ee leads to library linking errors due to header file Commit 089f627 leads to library linking errors due to header file missing <stdbool.h> Oct 8, 2020
sbates130272 added a commit to sbates130272/ubpf that referenced this issue Oct 8, 2020
Commit 089f627 added the bool type to an external function but did not
add the approriate header to define that type. This still allowed the
library to be built because <stdbool.h> was included in the internal
library source files. However it causes issues when linking to this
library from other programs.

Fixes iovisor#38
iomartin added a commit to Eideticom/eid-hermes-qemu that referenced this issue Oct 19, 2020
uBPF[1] is a userspace eBPF virtual machine, which includes an
assembler, disassembler, interpreter and JIT compiler for x86-64.

Because it is not part of the kernel, it can be used by userspace tools
that need to operate on programs in the eBPF ISA.

We need this to enable the hermes device model.

There is currently an open issue on uBPF[2] that requires the inclusion
of stdbool.h as well as ubpf.h. A PR has been opened[3], but has not yet
been merged into upstream, so we add that header to our configure script.

[1]: https://github.com/iovisor/ubpf
[2]: iovisor/ubpf#38
[3]: iovisor/ubpf#39

Signed-off-by: Martin Oliveira <martin.oliveira@eideticom.com>
pchaigno pushed a commit that referenced this issue Jan 19, 2021
Commit 089f627 added the bool type to an external function but did not
add the approriate header to define that type. This still allowed the
library to be built because <stdbool.h> was included in the internal
library source files. However it causes issues when linking to this
library from other programs.

Fixes #38
niclashedam pushed a commit to niclashedam/eid-hermes-qemu that referenced this issue Feb 17, 2021
uBPF[1] is a userspace eBPF virtual machine, which includes an
assembler, disassembler, interpreter and JIT compiler for x86-64.

Because it is not part of the kernel, it can be used by userspace tools
that need to operate on programs in the eBPF ISA.

We need this to enable the hermes device model.

There is currently an open issue on uBPF[2] that requires the inclusion
of stdbool.h as well as ubpf.h. A PR has been opened[3], but has not yet
been merged into upstream, so we add that header to our configure script.

[1]: https://github.com/iovisor/ubpf
[2]: iovisor/ubpf#38
[3]: iovisor/ubpf#39

Signed-off-by: Martin Oliveira <martin.oliveira@eideticom.com>
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.

1 participant