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

Failed to compile C2V #22116

Closed
jorgeluismireles opened this issue Aug 25, 2024 · 7 comments · Fixed by vlang/c2v#181
Closed

Failed to compile C2V #22116

jorgeluismireles opened this issue Aug 25, 2024 · 7 comments · Fixed by vlang/c2v#181
Labels
Bug This tag is applied to issues which reports bugs. Status: Confirmed This bug has been confirmed to be valid by a contributor.

Comments

@jorgeluismireles
Copy link

jorgeluismireles commented Aug 25, 2024

Describe the bug

Error after running v translate hello.c

Reproduction Steps

$ v translate hello.w
Compiling c2v ...
src/c2v.v:53:6: error: duplicate of a const name `clang`
   51 | fn find_clang_in_path() string {
   52 |     clangs := ['clang-17', 'clang-14', 'clang-13', 'clang-12', 'clang-11', 'clang-10', 'clang']
   53 |     for clang in clangs {
      |         ~~~~~
   54 |         os.find_abs_path_of_executable(clang) or { continue }
   55 |         return clang

Failed to compile C2V. This should not happen. Please report it via GitHub.

Expected Behavior

Compile c into v

Current Behavior

Bug in C2V

Possible Solution

No response

Additional Information/Context

No response

V version

V 0.4.7 caa0c46

Environment details (OS name and version, etc.)

V full version: V 0.4.7 99da572.caa0c46
OS: linux, Ubuntu 18.04.6 LTS
Processor: 4 cpus, 64bit, little endian, Intel(R) Core(TM) i7-7567U CPU @ 3.50GHz

getwd: /home/nuchw/gitlab.com/jmireles/v/can
vexe: /home/nuchw/v/v
vexe mtime: 2024-08-25 18:44:08

vroot: OK, value: /home/nuchw/v
VMODULES: OK, value: /home/nuchw/.vmodules
VTMP: OK, value: /tmp/v_1000

Git version: git version 2.17.1
Git vroot status: weekly.2024.32-103-gcaa0c464
.git/config present: true

CC version: cc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
thirdparty/tcc status: thirdparty-linux-amd64 0134e9b9

Note

You can use the 👍 reaction to increase the issue's priority for developers.

Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.

@jorgeluismireles jorgeluismireles added the Bug This tag is applied to issues which reports bugs. label Aug 25, 2024
@JalonSolov JalonSolov added the Status: Confirmed This bug has been confirmed to be valid by a contributor. label Aug 25, 2024
@JalonSolov
Copy link
Contributor

Recent change in V caused this. It's a conflict with a constant here:

https://github.com/vlang/c2v/blob/e2d8b6d10407011082ce0b0a58e06c2af4c5f6f1/src/c2v.v#L42

The problem was allowing a variable to shadow a constant... and that is not allowed any longer.

@medvednikov
Copy link
Member

Don't we compile c2v in V's CI?

@JalonSolov
Copy link
Contributor

Normally, yes, but it's currently disabled. Not sure why. Maybe that macos problem causing it to always fail?

@spytheman
Copy link
Member

Because it depends on building and then checking that Doom can be translated, but that is not the case, since c2v changed, and afaik is not fixed yet.

@JalonSolov
Copy link
Contributor

c2v compiles cleanly with the PR I did, but it is failing the tests on MacOS only due to some changes in Mac headers (according to Alex).

@spytheman
Copy link
Member

spytheman commented Aug 26, 2024

It (the Doom translation) broke in vlang/c2v#179 , then I tried to fix it, but could not, and then I disabled the CI for it in the main V repo in 43baa88 .

@spytheman
Copy link
Member

c2v compiles cleanly with the PR I did, but it is failing the tests on MacOS only due to some changes in Mac headers (according to Alex).

Oh, that is nice. I'll try again then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This tag is applied to issues which reports bugs. Status: Confirmed This bug has been confirmed to be valid by a contributor.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants