Skip to content

[ORM] no such file or directory #26887

@Jengro777

Description

@Jengro777

Describe the bug

cc: clang: error: no such file or directory: '/Applications/v/thirdparty/sqlite/sqlite3.c'

Reproduction Steps

import db.sqlite
import time


@[table: 'sys_users']
struct User {
pub:
	id         string    @[primary; sql_type: 'VARCHAR(255)'; unique]
	name       ?string   @[sql_type: 'VARCHAR(255)']
	status     u8
	created_at time.Time @[omitempty; sql_type: 'TIMESTAMP']
}


fn main() {
	mut db := init_database()!
	defer { db.close() or {} }

	insert_test_data(mut db) or { panic(err) }

	update(mut db)!
}

fn update(mut db sqlite.DB) ! {
  req_status := true
  sql db {
    update User set
    name   = 'Jengro',
    status =  if req_status  { 1 } else { 0 }
    //  status =  fn [req_status] () u8 {return if req_status { u8(1) } else { u8(0) }}()
    //  status =  fn [req_status] () u8 { if req_status { return 1 } else { return 0 } }()
    where id == '100'
  }!
  println('update success')
}

fn init_database() !&sqlite.DB {
	mut db := sqlite.connect(':memory:')!

	sql db {
		create table User
	}!

	return &db
}
fn insert_test_data(mut db sqlite.DB) ! {
	user1 := User{
		id:         '100'
		name:       'Alice'
		status: 0
		created_at: time.now()
	}

	sql db {
		insert user1 into User
	}!
}

Expected Behavior

no. err

Current Behavior

no err================== C compilation error (from cc): ==============
cc: clang: error: no such file or directory: '/Applications/v/thirdparty/sqlite/sqlite3.c'
================================================================
Try passing `-g` when compiling, to see a .v file:line information, that correlates more with the C error.
(Alternatively, pass `-show-c-output`, to print the full C error message).
builder error:
==================
C error found while compiling generated C code.
This can be caused by invalid C interop code, C compiler flags, or a V compiler bug.
If your code is pure V and this still happens, 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 .

Possible Solution

No response

Additional Information/Context

avey@avey temp % v up
Updating V...
> git_command: git pull https://github.com/vlang/v master
V is already updated.
Current V version: V 0.5.1 e3faeb3, timestamp: 2026-04-18 03:13:29 +0300
avey@avey temp % v version
V 0.5.1 e3faeb3
avey@avey temp %

V version

V 0.5.1 e3faeb3

Environment details (OS name and version, etc.)

V full version V 0.5.1 4cfc93d.e3faeb3
OS macos, macOS, 13.2.1, 22D68
Processor 8 cpus, 64bit, little endian, Intel(R) Core(TM) i5-8257U CPU @ 1.40GHz
Memory 0.45GB/8GB
V executable /Applications/v/v
V last modified time 2026-04-18 01:29:17
V home dir OK, value: /Applications/v
VMODULES OK, value: /Users/avey/.vmodules
VTMP OK, value: /tmp/v_501
Current working dir OK, value: /Users/avey/Documents/Dev/RuoQi/RuoQi-v/temp
env LDFLAGS "-L/usr/local/opt/openssl@3/lib"
Git version git version 2.50.0
V git status 0.5.1-1004-ge3faeb3b
.git/config present true
cc version Apple clang version 14.0.3 (clang-1403.0.22.14.1)
gcc version Apple clang version 14.0.3 (clang-1403.0.22.14.1)
clang version Apple clang version 14.0.3 (clang-1403.0.22.14.1)
tcc version tcc version 0.9.27 (x86_64 Darwin)
tcc git status thirdparty-macos-amd64 975f1ad8
emcc version N/A
glibc version N/A

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugThis tag is applied to issues which reports bugs.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions