vlang / v

Simple, fast, safe, compiled language for developing maintainable software. Compiles itself in <1s with zero library dependencies. Supports automatic C => V translation. https://vlang.io
MIT License
35.86k stars 2.17k forks source link

libssh #13890

Open hcpex opened 2 years ago

hcpex commented 2 years ago

V doctor:

OS: linux, Ubuntu 20.04.3 LTS (VM) (WSL)
Processor: 16 cpus, 64bit, little endian, Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz
CC version: cc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0

getwd: /mnt/c/Users/Admin/Desktop/coding/vlang/vssh
vmodules: /home/hcpex/.vmodules
vroot: /mnt/c/Users/Admin/Desktop/coding/vlang/v
vexe: /mnt/c/Users/Admin/Desktop/coding/vlang/v/v
vexe mtime: 2022-03-31 23:24:41
is vroot writable: true
is vmodules writable: true
V full version: V 0.2.4 9bbb52e.02c80bd

Git version: git version 2.25.1
Git vroot status: weekly.2022.13-28-g02c80bd4
.git/config present: true
thirdparty/tcc status: thirdparty-linux-amd64 3654d6a8

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

module main

#flag -lssh
#include <libssh/libssh.h>

fn main() {

}

What did you expect to see?

What did you see instead?

==================
/tmp/v_1000/ssh.17374166955247782938.tmp.c:1768: error: incompatible types for redefinition of 'string_free'
...
==================
(Use `v -cg` to print the entire error message)

builder error: 
==================
C error. This should never happen.

This is a compiler bug, please report it using `v bug file.v`.

https://github.com/vlang/v/issues/new/choose

You can also use #help on Discord: https://discord.gg/vlang
hungrybluedev commented 2 years ago

Try keeping the libssh.h file locally in your project. Like inside a thirdparty folder, for example. Here is a project that does that: https://github.com/erdetn/vplot

SurmanPP commented 2 years ago

Afaik the problem is that both V and libssh define function for stings. Both are note prefixed with a namespace. Both just call them string_whatever. Libssh does this for backwardscompatibility, while V just does this.