v
v copied to clipboard
addr2line: 'v': No such file, instead of meaningful output, when build fails due to internal bug
Describe the bug
I have the given code, which triggers a known bug in V's ORM module. Running it, results in lots of addr2line errors, instead of meaningful output.
Reproduction Steps
module main
import db.sqlite
@[table: 'visits']
struct Visit {
id int @[primary; sql: serial]
site string
}
@[table: 'sites']
struct Site {
hostname string @[primary]
owner int
visits []Visit @[fkey: 'site']
}
@[table: 'users']
struct User {
id int @[primary; sql: serial]
name string
sites []Site @[fkey: 'owner']
}
fn init_db(path string) !sqlite.DB {
mut db := sqlite.connect(path)!
sql db {
create table User
create table Site
create table Visit
}!
return db
}
Expected Behavior
I expect to see the line number and/or memory address, instead of an addr2line error.
Current Behavior
Running v src/dbtest.v results in following output on my machine:
signal 11: segmentation fault
addr2line: 'v': No such file
v() [0x6cff71]
addr2line: 'v': No such file
v() [0x6cfd12]
addr2line: 'v': No such file
v() [0x482afd]
addr2line: 'v': No such file
v() [0x47ddbb]
addr2line: 'v': No such file
v() [0x4a2d48]
addr2line: 'v': No such file
v() [0x475101]
addr2line: 'v': No such file
v() [0x6c83fe]
addr2line: 'v': No such file
v() [0x602a17]
addr2line: 'v': No such file
v() [0x60660a]
addr2line: 'v': No such file
v() [0x608dba]
addr2line: 'v': No such file
v() [0x40272a]
| 0x7ff3970cd14a | /lib64/libc.so.6(+0x2814a)
| 0x7ff3970cd20b | /lib64/libc.so.6(__libc_start_main+0x8b)
addr2line: 'v': No such file
v() [0x402765]
Possible Solution
No response
Additional Information/Context
The bug was discussed here, before I posted the issue: https://github.com/vlang/v/discussions/20765
V version
V 0.4.4 410bd9d
Environment details (OS name and version, etc.)
V full version: V 0.4.4 a79a9cb.410bd9d OS: linux, Linux version 6.6.13-200.fc39.x86_64 (mockbuild@72f11b2996ed4699b0f705186172808f) (gcc (GCC) 13.2.1 20231205 (Red Hat 13.2.1-6), GNU ld version 2.40-13.fc39) #1 SMP PREEMPT_DYNAMIC Sat Jan 20 18:03:28 UTC 2024 Processor: 16 cpus, 64bit, little endian, AMD Ryzen 7 PRO 5850U with Radeon Graphics
getwd: /home/n/src/pkg/gitly vexe: /home/n/pkg/v/v vexe mtime: 2024-02-08 18:03:24
vroot: OK, value: /home/n/pkg/v VMODULES: OK, value: /home/n/.vmodules VTMP: OK, value: /tmp/v_1000
Git version: git version 2.43.0 Git vroot status: weekly.2024.06-21-g410bd9db (4 commit(s) behind V master) .git/config present: true
CC version: cc (GCC) 13.2.1 20231205 (Red Hat 13.2.1-6) thirdparty/tcc status: thirdparty-linux-amd64 12f392c3
[!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.
I do get a failure, but I don't see anything about addr2line on Manjaro Linux:
I get a failure here, but nothing about addr2line:
/tmp/v_1000/v2.01HP6XQK1AQ2T2CXFDNASBPEYW.tmp.c:47430: at v__ast__Scope_find: RUNTIME ERROR: invalid memory access
/tmp/v_1000/v2.01HP6XQK1AQ2T2CXFDNASBPEYW.tmp.c:47469: by v__ast__Scope_find_var
/tmp/v_1000/v2.01HP6XQK1AQ2T2CXFDNASBPEYW.tmp.c:11543: by v__checker__Checker_check_field_of_inserting_struct_is_uninitialized
/tmp/v_1000/v2.01HP6XQK1AQ2T2CXFDNASBPEYW.tmp.c:11166: by v__checker__Checker_sql_stmt_line
/tmp/v_1000/v2.01HP6XQK1AQ2T2CXFDNASBPEYW.tmp.c:11174: by v__checker__Checker_sql_stmt_line
/tmp/v_1000/v2.01HP6XQK1AQ2T2CXFDNASBPEYW.tmp.c:11045: by v__checker__Checker_sql_stmt
/tmp/v_1000/v2.01HP6XQK1AQ2T2CXFDNASBPEYW.tmp.c:62955: by v__checker__Checker_stmt
/tmp/v_1000/v2.01HP6XQK1AQ2T2CXFDNASBPEYW.tmp.c:63403: by v__checker__Checker_stmts_ending_with_expression
/tmp/v_1000/v2.01HP6XQK1AQ2T2CXFDNASBPEYW.tmp.c:63379: by v__checker__Checker_stmts
/tmp/v_1000/v2.01HP6XQK1AQ2T2CXFDNASBPEYW.tmp.c:4835: by v__checker__Checker_fn_decl
/tmp/v_1000/v2.01HP6XQK1AQ2T2CXFDNASBPEYW.tmp.c:62913: by v__checker__Checker_stmt
/tmp/v_1000/v2.01HP6XQK1AQ2T2CXFDNASBPEYW.tmp.c:60965: by v__checker__Checker_check
/tmp/v_1000/v2.01HP6XQK1AQ2T2CXFDNASBPEYW.tmp.c:61032: by v__checker__Checker_check_files
/tmp/v_1000/v2.01HP6XQK1AQ2T2CXFDNASBPEYW.tmp.c:50880: by v__builder__Builder_middle_stages
/tmp/v_1000/v2.01HP6XQK1AQ2T2CXFDNASBPEYW.tmp.c:50914: by v__builder__Builder_front_and_middle_stages
/tmp/v_1000/v2.01HP6XQK1AQ2T2CXFDNASBPEYW.tmp.c:53360: by v__builder__cbuilder__gen_c
/tmp/v_1000/v2.01HP6XQK1AQ2T2CXFDNASBPEYW.tmp.c:53343: by v__builder__cbuilder__build_c
/tmp/v_1000/v2.01HP6XQK1AQ2T2CXFDNASBPEYW.tmp.c:53333: by v__builder__cbuilder__compile_c
/tmp/v_1000/v2.01HP6XQK1AQ2T2CXFDNASBPEYW.tmp.c:53239: by v__builder__Builder_rebuild
/tmp/v_1000/v2.01HP6XQK1AQ2T2CXFDNASBPEYW.tmp.c:52344: by v__builder__compile
/tmp/v_1000/v2.01HP6XQK1AQ2T2CXFDNASBPEYW.tmp.c:53674: by main__rebuild
/tmp/v_1000/v2.01HP6XQK1AQ2T2CXFDNASBPEYW.tmp.c:53622: by main__main
/tmp/v_1000/v2.01HP6XQK1AQ2T2CXFDNASBPEYW.tmp.c:54331: by main
On Debian, addr2line is part of the binutils package.
Try searching for it, and install it.
https://github.com/vlang/v/pull/20774 may fix this specific compilation problem.
(addr2line still has to be installed separately for others).
Fedora has addr2line installed as part of the binutils package.
addr2line is installed. One of the error messages is coming from addr2line:
addr2line: 'v': No such file
This says addr2line was found, but v was not.
addr2lineis installed. One of the error messages is coming fromaddr2line:addr2line: 'v': No such fileThis says
addr2linewas found, butvwas not.
This looks like a red herring. v was obviously installed, because it executed the tests:
v src/dbtest.v
Then something crashed. The error message "addr2line: 'v': No such file" appears to have nothing in common with it. It's pointing to v, which is being already executed, as the stack frame shows:
signal 11: segmentation fault
addr2line: 'v': No such file
v() [0x6cff71]
I started getting the same error on Linux (GitHub VM) some time ago, when executing vpopen, in a publishing tool, which uses git to commit and push and GitHub REST API to publish a new release. It also complained about the binary name, which was already being executed and which wasn't re-executed from within itself (vp here). I worked around it by running the publishing from the Mac VM instead of from the Linux VM. I get no segmentation faults on Mac.
prepared version 0.0.2 for pushing <<< the beginning is logged
signal 11: segmentation fault
addr2line: 'vp': No such file
vp(+0xeb593) [0x55ca378d7593]
pushed version 0.0.2 <<< no failure, although something crashed
addr2line: 'vp': No such file
vp(+0xf75e8) [0x55ca378e35e8]
addr2line: 'vp': No such file
vp(+0xd347) [0x55ca377f9347]
| 0x7ff4fa829d90 | /lib/x86_64-linux-gnu/libc.so.6(+0x29d90)
| 0x7ff4fa829e40 | /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x80)
addr2line: 'vp': No such file
vp(+0xd385) [0x55ca377f9385]
Error: Process completed with exit code 139. <<< failure from a later system call
The code:
cmd := git push --atomic origin HEAD "v${ver}"
f := vpopen(cmd)
if isnil(f) { return error('executing "${cmd}" failed') }
fd := os.fileno(f)
out := read_all(fd, opts)
exit_code := vpclose(f)
if exit_code != 0 { return error('"${cmd}"" exited with ${exit_code}: ${first_line(out)}') }
But I'd need a local Linux VM and some time to debug it.
What is looks like is that v symlink was never run.
When addr2line was called, it couldn't find v in the path, so gave the No such file message.
What is looks like is that
v symlinkwas never run.When
addr2linewas called, it couldn't findvin the path, so gave theNo such filemessage.
Well, v symlink wasn't run, because I installed v using brew and then continued upgrading it in-place by v up. Homebrew places symlinks to /usr/local/bin:
❯ ll `which v`
lrwxr-xr-x 1 prantlf admin 27 Mar 21 20:47 /usr/local/bin/v -> ../Cellar/vlang/0.4.5/bin/v*
The binary and symlink are installed like this in vlang.rb:
libexec.install "cmd", "thirdparty", "v", "v.mod", "vlib"
bin.install_symlink libexec/"v"
Do you see a problem with this setup?
It's good that the symlink is there. Just saying that's what it looked like. When addr2line tried to run V, it couldn't find it, so it gave the message.
I don't know why it couldn't find it, with that link in place.