vlang / c2v

C/C++ to V translator
GNU General Public License v3.0
223 stars 31 forks source link

Cannot translate DWM #96

Open ghost opened 1 year ago

ghost commented 1 year ago

Hi. I downloaded dwm source code from their git repo, compiled c2v and then ran it. But when I ran it, I got this:

dwm on master via C v12.2.1-gcc
❯ ../c2v/c2v .
C to V translator 0.3.1
"." is a directory, processing all C files in it recursively...

  translating ./drw.c         ... In file included from ./drw.c:6:
In file included from /usr/include/X11/Xft/Xft.h:40:
./ft2build.h:37:10: fatal error: 'freetype/config/ftheader.h' file not found
#include <freetype/config/ftheader.h>
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

The file ./drw.c could not be parsed as a C source file.
ArtemkaKun commented 1 year ago

Hi @TenTypekMatus,

please read the Configuration section in the README

ArtemkaKun commented 1 year ago

Let me know if you will have any problems

ghost commented 1 year ago

@ArtenkaKun Ok, I'll do that.

ArtemkaKun commented 1 year ago

Ah ok, excuse me, I understood your issue in a wrong way

ArtemkaKun commented 1 year ago

Can you please add a link to a code you want to translate?

ghost commented 1 year ago

Sure. https://dwm.suckless.org/

ghost commented 1 year ago

It's the most simple WM that exists.

ArtemkaKun commented 1 year ago

Ok, so drw.c imports Xft.h, which imports freetype/config/ftheader.h header file. For some reasons, C2V has problems with it.

Can you try to compile dwm on your PC and make sure it works as intended?

ghost commented 1 year ago

Here it is. (compiled w/ make) Screenshot from 2023-02-17 13-37-01

ArtemkaKun commented 1 year ago

Can you try to seak for this ftheader.h file on your computer, and then include it in C2V configuration with -I parameter?

ghost commented 1 year ago

Sure. I had to pass those args manually since c2v didn't detect config.toml, and now it says that I don't have permission to open the file. I tried it with sudo, but now, it gave me this:

dwm on  master [!?] via C v12.2.1-gcc
❯ sudo c2v . -std=c99 -pedantic -Wall -Wno-deprecated-declarations -Os -I /usr/X11R6/include -I /usr/i
nclude/freetype2 -I /usr/include/freetype2/ft2build.h
C to V translator 0.3.1
  translating /usr/include/freetype2/ft2build.h ... /usr/include/freetype2/ft2build.h:37:10: error: 'freetype/config/ftheader.h' file not found with <angled> include; use "quotes" instead
#include <freetype/config/ftheader.h>
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
         "freetype/config/ftheader.h"
1 error generated.

The file /usr/include/freetype2/ft2build.h could not be parsed as a C source file.
ghost commented 1 year ago

image Also, there's the image.

ArtemkaKun commented 1 year ago

Let me try it on my PC, one sec

ArtemkaKun commented 1 year ago

Ok, I can reproduce it. So, it's a bug and it needs to be resolved. Unfortunately, I have no time for C2V right now, maybe you can try to resolve it?

ghost commented 1 year ago

Maybe... ig.

ArtemkaKun commented 1 year ago

I think this issue should stay so we can fix it in the future