V: Fatal error: can't create /usr/lib/vlang/thirdparty/cJSON/cJSON.o: Permission denied

Created on 9 Apr 2020  路  3Comments  路  Source: vlang/v

V version: 0.1.19 79a98d7
OS: GNU/Linux Manjaro 5.2.11-1 x86_64

What did you do?

  1. Make a file and name it json.v
import json

struct User {
    name          string
    age           int
}

fn main() {
    s := '[{"name":"Frodo", "age":25}, {"name":"Bobby", "age":10}]'
    users := json.decode([]User, s) or { // json.decode untuk decode
        eprintln('Failed to parse json')
        return
    }
    for user in users {
        println('$user.name: $user.age')
    }
    //~ println(json.encode(users)) // untuk encode
}
  1. On terminal, I run v run json.v

What did you expect to see?

Frodo: 25
Bobby: 10

What did you see instead?

$ v run json.v 
/usr/lib/vlang/thirdparty/cJSON/cJSON.o not found, building it...
Assembler messages:
Fatal error: can't create /usr/lib/vlang/thirdparty/cJSON/cJSON.o: Permission denied
cc: error: /usr/lib/vlang/thirdparty/cJSON/cJSON.o: No such file or directory
V error: C error. This should never happen. Please create a GitHub issue: https://github.com/vlang/v/issues/new/choose
Bug

All 3 comments

V version: 0.1.24 0d93eeb

/usr/lib/vlang/thirdparty/cJSON/cJSON.o not found, building it...
failed thirdparty object build cmd: cc -fPIC -I "/usr/lib/vlang/thirdparty/cJSON" -c -o "/usr/lib/vlang/thirdparty/cJSON/cJSON.o" "/usr/lib/vlang/thirdparty/cJSON/cJSON.c"   
V error: Assembler messages:
Fatal error: can't create /usr/lib/vlang/thirdparty/cJSON/cJSON.o: Permission denied

@egodasa why you put v under root directory ?

NOT RECOMMENEDED

~$ sudo su
~$ v run json.v 

alternative, put v somewhere in your home directory. then create a symlink to/usr/bin/

@bokunodev V installed via AUR on manjaro. Looks like the executable are placed under root directory by AUR scripts. Looks like this is not a bug. I will close the issue now.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

penguindark picture penguindark  路  3Comments

elimisteve picture elimisteve  路  3Comments

vtereshkov picture vtereshkov  路  3Comments

lobotony picture lobotony  路  3Comments

choleraehyq picture choleraehyq  路  3Comments