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

Need help: gir-generated tests fail? #1587

Closed
zaaarf opened this issue Jul 6, 2024 · 2 comments
Closed

Need help: gir-generated tests fail? #1587

zaaarf opened this issue Jul 6, 2024 · 2 comments

Comments

@zaaarf
Copy link

zaaarf commented Jul 6, 2024

I've tried several times, from scratch, but it still seems to fail.

I'm trying to generate the FFI library for libinsane. The result builds, but the tests pretty much all fail. A few examples from the error logs:

tests/layout.c:11:51: error: ‘LibinsaneApi’ undeclared (first use in this function)
   11 |     printf("%s;%zu;%zu\n", "LibinsaneApi", sizeof(LibinsaneApi), alignof(LibinsaneApi));
      |                                                   ^~~~~~~~~~~~
tests/constant.c: In function ‘main’:
tests/layout.c:19:57: error: ‘LibinsaneImgFormat’ undeclared (first use in this function)
   19 |     printf("%s;%zu;%zu\n", "LibinsaneImgFormat", sizeof(LibinsaneImgFormat), alignof(LibinsaneImgFormat));
      |                                                         ^~~~~~~~~~~~~~~~~~
tests/constant.c:32:21: error: ‘guint’ undeclared (first use in this function); did you mean ‘int’?
   32 |     PRINT_CONSTANT((guint) LIBINSANE_CAPABILITY_AUTOMATIC);
      |                     ^~~~~
tests/constant.c:11:22: note: in definition of macro ‘PRINT_CONSTANT’
   11 |     printf(_Generic((CONSTANT_NAME), \
      |                      ^~~~~~~~~~~~~
tests/constant.c:32:21: note: each undeclared identifier is reported only once for each function it appears in
   32 |     PRINT_CONSTANT((guint) LIBINSANE_CAPABILITY_AUTOMATIC);
      |                     ^~~~~
tests/constant.c:11:22: note: in definition of macro ‘PRINT_CONSTANT’
   11 |     printf(_Generic((CONSTANT_NAME), \
      |                      ^~~~~~~~~~~~~
tests/constant.c:32:28: error: expected ‘)’ before ‘LIBINSANE_CAPABILITY_AUTOMATIC’
   32 |     PRINT_CONSTANT((guint) LIBINSANE_CAPABILITY_AUTOMATIC);
      |                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I have built and installed the library succesfully (if ld can find it, why shouldn't gir?). I've had to edit the gir file to fix a couple minor issues, but nothing that should cause this sort of disruption.

Any idea on what could be causing this, or at least on where I could begin looking?

If it helps, I'm attaching my edited gir file. Everything else is pretty much a 1:1 of what the book does.

@jreidinger
Copy link
Contributor

Hi, I had similar output and basically what helps is to add include of project header files to manual.h. Of course then I found that some types is in gir and not in header files, so it needs to be fixed upstream.

@bilelmoussaoui
Copy link
Member

Yes, what @jreidinger said.

Usually that means the gir file doesn't contain all the necessary information to generate the tests

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

3 participants