You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
V full version: V 0.4.6 1a685c3
OS: macos, macOS, 13.6.7, 22G720
Processor: 12 cpus, 64bit, little endian, Apple M2 Pro
getwd: /Users/ben/git/scripts/vdi/v
vexe: /Users/ben/git/v/v
vexe mtime: 2024-06-17 19:40:40
vroot: OK, value: /Users/ben/git/v
VMODULES: OK, value: /Users/ben/.vmodules
VTMP: OK, value: /tmp/v_501
Git version: git version 2.39.3 (Apple Git-145)
Git vroot status: weekly.2024.24-14-g1a685c30
.git/config present: true
CC version: Apple clang version 15.0.0 (clang-1500.1.0.2.5)
thirdparty/tcc status: thirdparty-macos-arm64 5c1d002f
What did you do? v -g -o vdbg cmd/v && vdbg src/main.v
modulemain// Import the C library#flag darwin -I /opt/homebrew/include#flag darwin -I ext#flag darwin -L /opt/homebrew/lib#flag -lssh#include <libssh/libssh.h>// Declare the C functions and types you needstructC.ssh_session_struct {}
typeCssh_session=&C.ssh_session_struct
// Initialize a new SSH sessionfn C.ssh_new() Cssh_session
// Free an SSH sessionfn C.ssh_free(session Cssh_session)
// Connect to an SSH serverfn C.ssh_connect(session Cssh_session) int// Set server hostfn C.ssh_options_set(session Cssh_session, option_type int, value voidptr) int// Constantsconstssh_options_host=0// The option type for setting hostname, replace with actual constant from libssh// Wrap the ssh_new functionfnssh_new() &C.ssh_session_struct {
return C.ssh_new()
}
// Wrap the ssh_free functionfnssh_free(session &C.ssh_session_struct) {
C.ssh_free(session)
}
// Wrap the ssh_connect functionfnssh_connect(session &C.ssh_session_struct) int {
return C.ssh_connect(session)
}
// Wrap the ssh_options_set function for setting hostnamefnssh_set_host(session &C.ssh_session_struct, host string) int {
return C.ssh_options_set(session, ssh_options_host, host.str)
}
fnmain() {
// Example usagesession:=ssh_new()
ifsession==unsafe { nil } {
println('Failed to create session')
return
}
// Set the hostifssh_set_host(session, $env('ssh_host')) !=0 {
println('Failed to set host')
ssh_free(session)
return
}
// Connectifssh_connect(session) !=0 {
println('Connection failed')
} else {
println('Connected successfully')
}
// Clean upssh_free(session)
}
What did you expect to see?
Successful compilation
What did you see instead?
==================
/tmp/v_501/main.01J0M58M18T5E4D86MFNTGFDWY.tmp.c:1888:6: error: conflicting types for 'string_free'
void string_free(string* s);
^
/opt/homebrew/include/libssh/legacy.h:118:32: note: previous declaration is here
SSH_DEPRECATED LIBSSH_API void string_free(ssh_string str);
^
/tmp/v_501/main.01J0M58M18T5E4D86MFNTGFDWY.tmp.c:4350:5: warning: 'string_free' is deprecated [-Wdeprecated-declarations]
string_free(&s);
^
/opt/homebrew/include/libssh/legacy.h:118:1: note: 'string_free' has been explicitly marked deprecated here
SSH_DEPRECATED LIBSSH_API void string_free(ssh_string str);
^
...
==================
(Use `v -cg` to print the entire error message)
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 .
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.
The text was updated successfully, but these errors were encountered:
V doctor:
What did you do?
v -g -o vdbg cmd/v && vdbg src/main.v
What did you expect to see?
Successful compilation
What did you see instead?
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.
The text was updated successfully, but these errors were encountered: