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.69k stars 2.16k forks source link

examples/database/mysql.v fails on MacOS #20475

Open AllanCochrane opened 8 months ago

AllanCochrane commented 8 months ago

V doctor:

V full version: V 0.4.4 89f06d3.4640627
OS: macos, macOS, 14.1, 23B74
Processor: 16 cpus, 64bit, little endian, Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz

getwd: /Users/allancochrane/Vlang/v/examples/database
vexe: /Users/allancochrane/Vlang/v/v
vexe mtime: 2024-01-10 19:07:13

vroot: OK, value: /Users/allancochrane/Vlang/v
VMODULES: OK, value: /Users/allancochrane/.vmodules
VTMP: OK, value: /tmp/v_501

Git version: git version 2.42.0
Git vroot status: 0.4.4-11-g46406277-dirty
.git/config present: true

CC version: Apple clang version 15.0.0 (clang-1500.1.0.2.5)
thirdparty/tcc status: thirdparty-macos-amd64 46662e20

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

import db.mysql

#flag macos -I/opt/brew/opt/mysql/include/mysql -Wl,-rpath /opt/brew/opt/mysql/lib -Wl,-rpath /opt/brew/Cellar/mysql-client/8.1.0/lib

fn main() {
    mut conn := mysql.connect(
        host: 'localhost'
        port: 3306
        username: 'root'
        password: 'xxxxxx'
        dbname: 'development'
    )!
    res := conn.query('show tables')!
    for row in res.rows() {
        println(row.vals.join(', '))
    }
    conn.close()
}

What did you expect to see?

A running program

What did you see instead?

==================
      _db__mysql__DB_use_result in mysql-11ecbf.o
clang: error: linker command failed with exit code 1 (use -v to see invocation)
...
==================
(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

[!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.

Avey777 commented 4 months ago

https://github.com/vlang/v/issues/21555

Avey777 commented 4 months ago

On macos, using db.mysql has never been successful