v
v copied to clipboard
Can't run any examples for gg or sokol
V doctor:
V full version: V 0.4.3 57a33c3.4690fec
OS: macos, macOS, 14.2.1, 23C71
Processor: 12 cpus, 64bit, little endian, Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
getwd: /Users/avrameisner/Dev/v
vexe: /Users/avrameisner/Dev/v/v
vexe mtime: 2023-12-30 05:56:16
vroot: OK, value: /Users/avrameisner/Dev/v
VMODULES: OK, value: /Users/avrameisner/.vmodules
VTMP: OK, value: /tmp/v_501
env VFLAGS: "-use-os-system-to-run"
Git version: git version 2.39.3 (Apple Git-145)
Git vroot status: weekly.2023.52-25-g4690fecd
.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 examples/gg/rectangles.v
module main
import gg
import gx
import os
const win_width = 600
const win_height = 300
struct App {
mut:
gg &gg.Context = unsafe { nil }
image int // gg.Image
}
fn main() {
mut app := &App{
gg: 0
}
app.gg = gg.new_context(
bg_color: gx.white
width: win_width
height: win_height
create_window: true
window_title: 'Rectangles'
frame_fn: frame
user_data: app
init_fn: init_images
)
mut logo_path := os.resource_abs_path(os.join_path('..', 'assets', 'logo.png'))
app.image = app.gg.create_image(logo_path)!.id
app.gg.run()
}
fn init_images(mut app App) {
// app.image = gg.create_image('logo.png')
}
fn frame(app &App) {
app.gg.begin()
app.draw()
app.gg.end()
}
fn (app &App) draw() {
// app.gg.draw_text_def(200,20, 'hello world!')
// app.gg.draw_text_def(300,300, 'привет')
app.gg.draw_rect_filled(10, 10, 100, 30, gx.blue)
app.gg.draw_rect_empty(110, 150, 80, 40, gx.black)
app.gg.draw_image_by_id(230, 30, 200, 200, app.image)
}
What did you expect to see?
Some rectangles in a window
What did you see instead?
examples/gg/rectangles.v:18:3: notice: assigning `0` to a reference field is only allowed in `unsafe` blocks
16 | fn main() {
17 | mut app := &App{
18 | gg: 0
| ~~~~~
19 | }
20 | app.gg = gg.new_context(
==================
clang: error: SDK does not contain 'libarclite' at the path '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_macosx.a'; try increasing the minimum deployment target
...
==================
(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.
I was unable to reproduce your problem. The main difference that I can see between your setup and mine is that I am running on a M1 instead of an Intel processor.
$ v doctor
V full version: V 0.4.3 ae82b67.54ff7a2
OS: macos, macOS, 14.2.1, 23C71
Processor: 10 cpus, 64bit, little endian, Apple M1 Max
getwd: /Users/kim/Projects/v/from_github/v
vexe: /Users/kim/Projects/v/from_github/v/v
vexe mtime: 2024-01-01 22:51:08
vroot: OK, value: /Users/kim/Projects/v/from_github/v
VMODULES: OK, value: /Users/kim/.vmodules
VTMP: OK, value: /tmp/v_1002
env VFLAGS: "-use-os-system-to-run"
Git version: git version 2.39.3 (Apple Git-145)
Git vroot status: weekly.2023.52-46-g54ff7a2d-dirty (1 commit(s) behind V master)
.git/config present: true
CC version: Apple clang version 15.0.0 (clang-1500.1.0.2.5)
thirdparty/tcc status: thirdparty-macos-arm64 a668e5a0
Since I don't have the directory where I have the v repository checked out in my PATH environment variable, I slightly modified your command to be:
./v -g -o vdbg cmd/v && ./vdbg examples/gg/rectangles.v
Running that I see:
$ ./v -g -o vdbg cmd/v && ./vdbg examples/gg/rectangles.v
examples/gg/rectangles.v:18:3: notice: assigning `0` to a reference field is only allowed in `unsafe` blocks
16 | fn main() {
17 | mut app := &App{
18 | gg: 0
| ~~~~~
19 | }
20 | app.gg = gg.new_context(
$
Executing the compiled program does pop up a window with rectangles.
$ examples/gg/rectangles
I wonder if you are running into the problem discussed in https://developer.apple.com/forums/thread/728021
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_macosx.a
This is because your macos system is missing this file ⬆️ , so you need to check that xcode is fully installed. This happened to me too, but after the installation was complete, the issue was resolved.
Thanks @shove70 - I'll try this when I'm home from work
@shove70 I re-installed xcode but still didn't see the files in /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/
. However, I no longer get that error message. I put the files in your zip there anyway but now I get a blank window instead of the expected rectangles.
you are welcome.
It could be that my files don't match your sdk version, or it could be something else
@shove70 Yeah so after updating V to 0.4.4 the examples now compile but they show blank white windows. Do you think I should create a new ticket now that the problem has changed?
I think so