v
v copied to clipboard
Library not found on compilation
Describe the bug
Encountering a TCC error that "Library 'm' not found". There is many warnings before the error appears which may be leading to it.
My project has two files currently, database.v which handles interactions with the database and main.v which holds the endpoints and handles the requests/responses. I have attached the database code below and the repository is linked below too to see the full project.
I was having previous troubles getting it to compile but I was given support in the V Discord server which removed that error (could not find C compiler) and since I have gotten able to run using TCC, I am now encountering this problem.
https://github.com/BreathXV/ReforgerWhitelistAPI/tree/v
Reproduction Steps
// database.v
module components
import sqlite
@[table: 'clients']
pub struct Client {
id int @[primary; sql: 'serial']
server_id string
identity_id string
}
pub const db = sqlite.connect('clients.db') or { panic(err) }
// Creates the database as soon as the module is called.
fn init() {
sql components.db {
create table Client
} or { panic('${err} at ${@LOCATION}') }
}
// Inserts development data into the database for testing.
pub fn dev_database() bool {
dev_data := Client{
server_id: 'test'
identity_id: 'test'
}
sql components.db {
insert dev_data into Client
} or {
panic(err)
return false
}
return true
}
// Checks if a client/player is whitelisted.
pub fn is_whitelisted(serverId string, identityId string) bool {
exists := sql components.db {
select from Client where server_id == serverId && identity_id == identityId
} or { panic(err) }
if exists.len == 0 {
return false
} else {
return true
}
}
pub fn players_whitelisted(serverId string) ?[]Client {
al_players := sql components.db {
select from Client where server_id == serverId
} or { panic(err) }
return al_players
}
Expected Behavior
For the server to initiate and starting listening for requests.
Current Behavior
PS D:\repos\ReforgerWhitelistAPI> v -cg run .\src\main.v
C:/Users/kiera/AppData/Local/Temp/v_0/main.01HZFSXXQD7AYK4A51N1MX6V7R.tmp.c:781: warning: WINVER redefined
C:/Users/kiera/AppData/Local/Temp/v_0/main.01HZFSXXQD7AYK4A51N1MX6V7R.tmp.c:1200: warning: InterlockedIncrement64 redefined
In file included from C:/Users/kiera/AppData/Local/Temp/v_0/main.01HZFSXXQD7AYK4A51N1MX6V7R.tmp.c:1565:
d:/v/thirdparty/tcc/include/winapi/synchapi.h:13: warning: CreateEvent redefined
In file included from C:/Users/kiera/AppData/Local/Temp/v_0/main.01HZFSXXQD7AYK4A51N1MX6V7R.tmp.c:1565:
d:/v/thirdparty/tcc/include/winapi/synchapi.h:117: warning: OpenEvent redefined
In file included from C:/Users/kiera/AppData/Local/Temp/v_0/main.01HZFSXXQD7AYK4A51N1MX6V7R.tmp.c:1565:
d:/v/thirdparty/tcc/include/winapi/synchapi.h:167: warning: CreateMutex redefined
In file included from C:/Users/kiera/AppData/Local/Temp/v_0/main.01HZFSXXQD7AYK4A51N1MX6V7R.tmp.c:1732:
D:/v/thirdparty/vschannel/vschannel.c:284: warning: implicit declaration of function 'WSAConnectByNameW'
In file included from C:/Users/kiera/AppData/Local/Temp/v_0/main.01HZFSXXQD7AYK4A51N1MX6V7R.tmp.c:1732:
D:/v/thirdparty/vschannel/vschannel.c:300: warning: assignment from incompatible pointer type
C:/Users/kiera/AppData/Local/Temp/v_0/main.01HZFSXXQD7AYK4A51N1MX6V7R.tmp.c:14896: warning: implicit declaration of function 'tcc_backtrace'
C:/Users/kiera/AppData/Local/Temp/v_0/main.01HZFSXXQD7AYK4A51N1MX6V7R.tmp.c:27935: warning: implicit declaration of function 'GetFinalPathNameByHandleW'
C:/Users/kiera/AppData/Local/Temp/v_0/main.01HZFSXXQD7AYK4A51N1MX6V7R.tmp.c:29785: warning: implicit declaration of function 'CreateSymbolicLinkW'
C:/Users/kiera/AppData/Local/Temp/v_0/main.01HZFSXXQD7AYK4A51N1MX6V7R.tmp.c:34657: warning: assignment from incompatible pointer type
C:/Users/kiera/AppData/Local/Temp/v_0/main.01HZFSXXQD7AYK4A51N1MX6V7R.tmp.c:34671: warning: assignment from incompatible pointer type
C:/Users/kiera/AppData/Local/Temp/v_0/main.01HZFSXXQD7AYK4A51N1MX6V7R.tmp.c:34689: warning: assignment from incompatible pointer type
C:/Users/kiera/AppData/Local/Temp/v_0/main.01HZFSXXQD7AYK4A51N1MX6V7R.tmp.c:34696: warning: assignment from incompatible pointer type
C:/Users/kiera/AppData/Local/Temp/v_0/main.01HZFSXXQD7AYK4A51N1MX6V7R.tmp.c:34739: warning: assignment from incompatible pointer type
C:/Users/kiera/AppData/Local/Temp/v_0/main.01HZFSXXQD7AYK4A51N1MX6V7R.tmp.c:34749: warning: assignment from incompatible pointer type
C:/Users/kiera/AppData/Local/Temp/v_0/main.01HZFSXXQD7AYK4A51N1MX6V7R.tmp.c:35044: warning: implicit declaration of function 'inet_ntop'
C:/Users/kiera/AppData/Local/Temp/v_0/main.01HZFSXXQD7AYK4A51N1MX6V7R.tmp.c:35044: warning: cast between pointer and integer of different size
C:/Users/kiera/AppData/Local/Temp/v_0/main.01HZFSXXQD7AYK4A51N1MX6V7R.tmp.c:35057: warning: cast between pointer and integer of different size
C:/Users/kiera/AppData/Local/Temp/v_0/main.01HZFSXXQD7AYK4A51N1MX6V7R.tmp.c:35494: warning: assignment from incompatible pointer type
C:/Users/kiera/AppData/Local/Temp/v_0/main.01HZFSXXQD7AYK4A51N1MX6V7R.tmp.c:36102: warning: assignment from incompatible pointer type
C:/Users/kiera/AppData/Local/Temp/v_0/main.01HZFSXXQD7AYK4A51N1MX6V7R.tmp.c:36628: warning: assignment from incompatible pointer type
C:/Users/kiera/AppData/Local/Temp/v_0/main.01HZFSXXQD7AYK4A51N1MX6V7R.tmp.c:36641: warning: assignment from incompatible pointer type
tcc: error: library 'm' not found
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 .
Possible Solution
N/A
Additional Information/Context
Previous error and fix shown below:
V version
V 0.4.6 cc92dbc
Environment details (OS name and version, etc.)
V full version: V 0.4.6 8c24936.cc92dbc OS: windows, Microsoft Windows 11 Home v22631 64-bit Processor: 16 cpus, 64bit, little endian,
getwd: D:\repos\ReforgerWhitelistAPI vexe: D:\v\v.exe vexe mtime: 2024-06-03 19:41:18
vroot: OK, value: D:\v VMODULES: OK, value: C:\Users\kiera.vmodules VTMP: OK, value: C:\Users\kiera\AppData\Local\Temp\v_0
Git version: git version 2.45.1.windows.1 Git vroot status: weekly.2024.22-34-gcc92dbc8 .git/config present: true
CC version: Error: 'cc' is not recognized as an internal or external command, operable program or batch file.
thirdparty/tcc status: thirdparty-windows-amd64 b425ac82
[!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.
This issue could be slightly related to #21555
try passing -ldflags -lm
This issue could be slightly related to #21555
How so? The modules are different, the platform is different, the error is different too 🤔 .