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

cmd/tools/vshare.v Fails Test Due to Linkage if Using Clang (All Other Tests Pass) #22692

Open
ThisNekoGuy opened this issue Oct 29, 2024 · 0 comments

Comments

@ThisNekoGuy
Copy link

ThisNekoGuy commented Oct 29, 2024

V doctor:

V full version: V 0.4.8 6e9a66d
OS: linux, "Gentoo Linux"
Processor: 16 cpus, 64bit, little endian, AMD Ryzen 7 3700X 8-Core Processor

getwd: /mnt/external-drive/vlang/v
vexe: /mnt/external-drive/vlang/v/v
vexe mtime: 2024-10-29 19:52:03

vroot: OK, value: /mnt/external-drive/vlang/v
VMODULES: OK, value: /home/username/.vmodules
VTMP: OK, value: /tmp/v_1000

env VFLAGS: "-cc clang-18 -cflags -static -prod"

Git version: git version 2.45.2
Git vroot status: weekly.2024.44
.git/config present: true

CC version: cc (Gentoo Hardened 13.3.1_p20240614 p17) 13.3.1 20240614 <- (This is returning GCC because Gentoo symlinks it)
thirdparty/tcc status: thirdparty-linux-amd64 0134e9b9

What did you do?
./v -g -o vdbg cmd/v && ./vdbg cmd/tools/vshare.v

module main

import net.http
import os
import clipboard
import json

struct Response {
	hash  string
	error string
}

fn main() {
	mut cb := clipboard.new()

	if os.args.len < 3 {
		eprintln('Please provide a file')
		exit(1)
	}

	if os.file_ext(os.args[2]) != '.v' {
		eprintln('Must be a V source file.')
		exit(1)
	}

	if !os.is_file(os.args[2]) {
		eprintln('File not found.')
		exit(1)
	}

	to_send := os.args[2]

	content := os.read_file(to_send) or {
		eprintln(err)
		exit(1)
	}

	share := http.post_form('https://play.vlang.io/share', {
		'code': content
	})!

	response := json.decode(Response, share.body)!
	url := 'https://play.vlang.io/p/${response.hash}'

	cb.copy(url)
	println(url)
	println('Copied URL to clipboard.')
}

What did you expect to see?

A passing test when running v build-tools.
I have X11 installed (even though I run Wayland), so the linker shouldn't be failing to find the library.

What did you see instead?

================== C compilation error (from clang-18): ==============
cc: 48 warnings generated.
cc: ld.lld: error: unable to find library -lX11
cc: clang-18: error: linker command failed with exit code 1 (use -v to see invocation)
... (the original output was 147 lines long, and was truncated to 3 lines)
======================================================================
(You can pass `-cg`, or `-show-c-output` as well, to print all the C error messages).
builder error: 
==================
C error found. It should never happen, when compiling pure V code.
This is a V compiler bug, please report it using `v bug file.v`,
or goto https://github.com/vlang/v/issues/new/choose .
You can also use #help on Discord: https://discord.gg/vlang .

Huly®: V_0.6-21141

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.

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

1 participant