Comments (8)
I'll fix the C driver issue for all 3 DBs today.
The C driver will be included, and none of this will be needed.
from v.
A thing you could do already, is adding the different flags directly in you program.
To give an example of the concept:
// Intel, M1 brew, and MacPorts
#flag darwin -I/usr/local/opt/openblas/include -I/opt/homebrew/opt/openblas/include -I/opt/local/opt/openblas/include
#flag darwin -L/usr/local/opt/openblas/lib -L/opt/homebrew/opt/openblas/lib -L/opt/local/opt/openblas/lib
#flag darwin -L/usr/local/opt/lapack/lib -L/opt/homebrew/opt/lapack/lib -L/opt/local/opt/lapack/lib
The above is taken from: https://github.com/vlang/vsl/blob/main/vlas/cflags_d_vsl_vlas_cblas.v:
Also checking for the existence of a pkg-config is possible:
$if $pkgconfig('mysqlclient') {
#pkgconfig mysqlclient
} $else $if $pkgconfig('mariadb') {
#pkgconfig mariadb
}
from v.
Do . After that, the compilation should succeed.
brew install mariadb-connector-c
avey@avey vprod % brew install mariadb-connector-c
==> Auto-updating Homebrew...
Adjust how often this is run with HOMEBREW_AUTO_UPDATE_SECS or disable with
HOMEBREW_NO_AUTO_UPDATE. Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
==> Auto-updated Homebrew!
Updated 2 taps (homebrew/core and homebrew/cask).
==> New Formulae
vedic
==> New Casks
blitz-gg font-playwrite-es-deco font-playwrite-nz
font-playwrite-au-nsw font-playwrite-fr-moderne font-playwrite-tz
font-playwrite-au-qld font-playwrite-id font-playwrite-us-modern
font-playwrite-au-sa font-playwrite-ie font-playwrite-us-trad
font-playwrite-au-tas font-playwrite-in font-playwrite-za
font-playwrite-au-vic font-playwrite-it-moderna hopper-disassembler
font-playwrite-ca font-playwrite-it-trad mac-mouse-fix@2
font-playwrite-de-la font-playwrite-mx
font-playwrite-es font-playwrite-ng-modern
==> Fetching mariadb-connector-c
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/mariadb-connector-c-3.3.8.ventura.bo
########################################################################################## 100.0%
==> Pouring mariadb-connector-c-3.3.8.ventura.bottle.tar.gz
🍺 /usr/local/Cellar/mariadb-connector-c/3.3.8: 154 files, 1.4MB
==> Running `brew cleanup mariadb-connector-c`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
avey@avey vprod % v run .
==================
^
/tmp/v_501/vprod.01HYTDZGRX2RM40608QES0N7XJ.tmp.c:35966:6: error: call to undeclared function 'mysql_refresh'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
if (mysql_refresh(db->conn, options) != 0) {
^
/tmp/v_501/vprod.01HYTDZGRX2RM40608QES0N7XJ.tmp.c:36018:42: warning: passing 'const char *' to parameter of type 'u8 *' (aka 'unsigned char *') discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
string _t1 = db__mysql__resolve_nil_str(mysql_info(db->conn));
^~~~~~~~~~~~~~~~~~~~
/tmp/v_501/vprod.01HYTDZGRX2RM40608QES0N7XJ.tmp.c:6966:55: note: passing argument to parameter 'ptr' here
VV_LOCAL_SYMBOL string db__mysql__resolve_nil_str(u8* ptr);
^
/tmp/v_501/vprod.01HYTDZGRX2RM40608QES0N7XJ.tmp.c:36023:26: warning: passing 'const char *' to parameter of type 'u8 *' (aka 'unsigned char *') discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
string _t1 = u8_vstring(mysql_get_host_info(db->conn));
...
==================
(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 .
avey@avey vprod %
I have executed brew install mysql-connector-c
before, but I still get this error. It should not be a problem with the mysql environment configuration.
from v.
1、
run find /opt/homebrew/ |grep mysql.h$ and paste the results
if that fails, do
find /usr/local/Cellar/ |grep mysql.h$ and paste the results
2、
brew install pkg-config
3、
pkg-config libmariadb --cflags --libs
pkg-config mysqlclient --cflags --libs
4、
brew install mariadb-connector-c
instead of
brew install mysql-clinet
5、
v -cflags '-I/usr/local/Cellar/mariadb-connector-c/3.3.8/include/mariadb/ -L/usr/local/Cellar/mariadb-connector-c/3.3.8/lib/mariadb/ -lmariadb' run main.v
eg: the mysql 8.3 headers lack the mysql_refresh function and some others (they were deprecated)
from v.
@JalonSolov
Can you help me with this issue? I'm going to change my development machine to MacOS, but the same code doesn't work properly.
from v.
Do brew install mariadb-connector-c
. After that, the compilation should succeed.
from v.
I'll fix the C driver issue for all 3 DBs today.
The C driver will be included, and none of this will be needed.
Has this been fixed? I didn't find a similar fix code commit
from v.
No, it is not fixed.
The C driver will be included, and none of this will be needed.
It can be done cleanly only for db.sqlite
, since SQLite provides an amalgamation that contains the whole DB. You can use v install sqlite
and then import sqlite
, instead of import db.sqlite
.
This issue however is for mysql, and mysql's client side libraries, are not unfortunately as easy to compile and use, as SQLite ones are, that is why we try to use pkgconfig, so that we can link to the already compiled ones.
Given this strategy, the issue happens, because our version of pkgconfig, on macos looks for /opt/homebrew/lib/pkgconfig
for the .pc files on macos, while brew on macos for Intel, stores its files under /usr/local/Cellar
, not under /opt/homebrew
.
from v.
Related Issues (20)
- https://vlang.io/ REPL example doesn't work HOT 1
- Provide easier installer like Rust HOT 5
- fmt: a regression was introduced in #22025 (vfmt struct init) HOT 3
- Precision format ignored in string interpolation HOT 4
- sum types should have a default 0 value for the first type mentioned in the list of types. HOT 4
- Passing a map to a generic argument changes a key value from int to an empty string HOT 1
- Module resolution depends on working directory HOT 3
- Free an optional structure HOT 7
- C error when comparing array to nil
- Compiler error when trying to convey a variadic argument set HOT 3
- Invalid conversion from camel to snake string with numbers HOT 5
- C error when returning a fixed-size array (NOTE: initialization with a for loop doesn't help) HOT 2
- C error when initializing fixed-size array HOT 2
- Returning fixed size arrays is still making C errors, even with the size being a normal int HOT 2
- C error - multiple returns values and fixed arrays
- Issue with Sokol and STBI openning images.
- cgen: Free optional string
- const name shadowing HOT 3
- -autofree fails on if statement containing strings
- rand.pcg32 breaks -autofree
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from v.