NiLuJe / FBInk

FrameBuffer eInker, a small tool & library to print text & images to an eInk Linux framebuffer
https://www.mobileread.com/forums/showthread.php?t=299110
GNU General Public License v3.0
315 stars 23 forks source link

Too many arguments build error #48

Closed tux-linux closed 3 years ago

tux-linux commented 3 years ago

Hi, I'm NiMa (from Mobileread) and as you probably saw in the last few days, I tried to get Xorg running on Kobos. I used this https://github.com/schuhumi/fbink-xdamage repository which refreshes the content of the eInk display when an X window's content is updated. Since then, I forked it (https://github.com/tux-linux/fbink-xdamage) and added the latest FBInk commit to be able to support the new Kobo Nia. I encountered the following build error on my Glo HD:

gcc -LFBInk/Release/ -IFBInk main.c -o fbink_xdamage -lX11 -lXext -lXdamage -lXfixes -lfbink
main.c: In function 'refresh':
main.c:104:66: warning: passing argument 6 of 'fbink_refresh' makes pointer from integer without a cast [-Wint-conversion]
  104 |     fbink_refresh(fbfd, area.y, area.x, area.width, area.height, HWD_ORDERED, &fbink_cfg);
      |                                                                  ^~~~~~~~~~~
      |                                                                  |
      |                                                                  int
In file included from main.c:12:
FBInk/fbink.h:594:36: note: expected 'const FBInkConfig * restrict' {aka 'const struct <anonymous> * restrict'} but argument is of type 'int'
  594 |        const FBInkConfig* restrict fbink_cfg);
      |        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
main.c:104:5: error: too many arguments to function 'fbink_refresh'
  104 |     fbink_refresh(fbfd, area.y, area.x, area.width, area.height, HWD_ORDERED, &fbink_cfg);
      |     ^~~~~~~~~~~~~
In file included from main.c:12:
FBInk/fbink.h:589:15: note: declared here
  589 | FBINK_API int fbink_refresh(int                         fbfd,
      |               ^~~~~~~~~~~~~
main.c: In function 'main':
main.c:243:34: warning: passing argument 6 of 'fbink_refresh' makes pointer from integer without a cast [-Wint-conversion]
  243 |     fbink_refresh(fbfd, 0,0,0,0, HWD_ORDERED, &fbink_cfg);
      |                                  ^~~~~~~~~~~
      |                                  |
      |                                  int
In file included from main.c:12:
FBInk/fbink.h:594:36: note: expected 'const FBInkConfig * restrict' {aka 'const struct <anonymous> * restrict'} but argument is of type 'int'
  594 |        const FBInkConfig* restrict fbink_cfg);
      |        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
main.c:243:5: error: too many arguments to function 'fbink_refresh'
  243 |     fbink_refresh(fbfd, 0,0,0,0, HWD_ORDERED, &fbink_cfg);
      |     ^~~~~~~~~~~~~
In file included from main.c:12:
FBInk/fbink.h:589:15: note: declared here
  589 | FBINK_API int fbink_refresh(int                         fbfd,
      |               ^~~~~~~~~~~~~
make: *** [Makefile:3: all] Error 1

I have GCC/G++ 9.3.0 running on an Alpine Linux chroot. Don't exactly know what to do, maybe I should fall back to a standard stable release submodule. Any clue? Thanks.

NiLuJe commented 3 years ago

Wow, that was an old pinned version.

There was an ABI break in 1.14.0.

Namely, this, because those options were folded into FBInkConfig.

NiLuJe commented 3 years ago

Oops, wrong ABI break ;p.

That's the one from 1.21.0.

The reasoning is still the same, though: the flag moved to FBInkConfig ;).

NiLuJe commented 3 years ago

TL;DR:

fbink_refresh(fbfd, 0, 0, 0, 0, HWD_ORDERED, &fbink_cfg); -> fbink_refresh(fbfd, 0, 0, 0, 0, &fbink_cfg);, and if you do want to keep the dithering (which'll only be honored on Mk. 7), set fbink_cfg's dithering_mode field to HWD_ORDERED.

Given the use-case, you probably do want to keep it ;).

tux-linux commented 3 years ago

Ok thanks, I'll try this and see if it works!

tux-linux commented 3 years ago

Question: if you clone my forked repository, is the FBInk version up-to-date? I don't know if I properly updated the submodule... It tells me it's up-to-date with the commit you made 9 days ago, but in some files it seems it has just kept the old versions.

NiLuJe commented 3 years ago

gut submodules are always pinned to a specific commit. Whenever you want to update it, you explicitly have to fetch/checkout whatever you want to update it to. That counts as a modification that you can them commit in the "parent" repo.

Anyone who then clones that repo will need to do the git submodule init/update dance as usual (and/or rely on --recurse-submodules).

tux-linux commented 3 years ago

Ok, thanks. I removed the HWD_ORDERED thing in the problematic line, but... I don't know where to put fbink_cfg / dithering_mode in main.c . Or is it in main.c ? And sorry, I didn't realize that the error was not coming from any FBInk compilation. I should have posted issue in schuhumi's repo.

Thanks.

NiLuJe commented 3 years ago

It's initialized as a global, so, anywhere before the refreshes you want affected, basically.

tux-linux commented 3 years ago

Thanks, that worked well!