traefik / yaegi

Yaegi is Another Elegant Go Interpreter
https://pkg.go.dev/github.com/traefik/yaegi
Apache License 2.0
6.94k stars 343 forks source link

Arm64 Linux /usr/local/go/pkg/tool/linux_arm64/link #1504

Closed JewishLewish closed 1 year ago

JewishLewish commented 1 year ago

The following program sample.go triggers an unexpected result

var i *interp.Interpreter = interp.New(interp.Options{})

func getGo(loc string) {
    resp, err := http.Get(loc)
    if err != nil {
        fmt.Println(err)
        return
    }
    defer resp.Body.Close()

    body, err := io.ReadAll(resp.Body)
    if err != nil {
        fmt.Println(err)
        return
    }

    i.Use(stdlib.Symbols)

    _, err = i.Eval(`` + string(body) + ``)
    if err != nil {
        println(err)
    }

    fmt.Print("Succesfully parsed the data! \n")
}

Expected result

Successful Build (or atleast on my windows main pc)

Got

/usr/local/go/pkg/tool/linux_arm64/link: mapping output file failed: no space left on device

Yaegi Version

latest

Additional Notes

Context: I am working on a database system and wanted to use a GO Interpreter for people who wanted to add onto the database. However, when I run it on my Linux Arm64 server, it fails and gives me the error: /usr/local/go/pkg/tool/linux_arm64/link: mapping output file failed: no space left on device

I tried doing someone online research and found nothing. I did some github and tested older models of the code and found out that me adding yaegi onto the code was causing this error.

JewishLewish commented 1 year ago

More Details:

Dockerfile is a normal Debian dockerfile made for pterodactyl (type of hosting panel)

Bash Script:

#!/bin/bash

if [ ! -d /mnt/server/ ]; then
mkdir -p /mnt/server/
fi
cd /mnt/server
TAR=<insert history>
curl -o main.go https://raw.githubusercontent.com/JewishLewish/PolygonDB/$TAR/main.go
curl -o go.mod https://raw.githubusercontent.com/JewishLewish/PolygonDB/$TAR/go.mod
curl -o go.sum https://raw.githubusercontent.com/JewishLewish/PolygonDB/$TAR/go.sum
mkdir -p /mnt/server/sysadmin/
cd sysadmin
curl -o sysadmin.c https://raw.githubusercontent.com/JewishLewish/PolygonDB/$TAR/sysadmin/sysadmin.c
cd /mnt/server
go get
go build
rm -f main.go
rm -f go.mod
rm -f go.sum
rm -f sysadmin/sysadmin.c
rm -r sysadmin
#settings.json file
if [ ! -f /mnt/server/settings.json ]; then
curl -o settings.json https://raw.githubusercontent.com/JewishLewish/PolygonDB/$TAR/settings.json
fi
#database folder
if [ ! -d /mnt/server/databases ]; then
mkdir -p databases
mkdir -p databases/ExampleDB
cd databases/ExampleDB
curl -o config.json https://raw.githubusercontent.com/JewishLewish/PolygonDB/$TAR/databases/CatoDB/config.json
curl -o database.json https://raw.githubusercontent.com/JewishLewish/PolygonDB/$TAR/databases/CatoDB/database.json
fi
cd /mnt/server

If TAR = 10a6bb2f8df81a4833bd879f84e5cbdbb9481674 (this is the github commit BEFORE yaegi was introduced)

if TAR = f11bb01912148dd1bf26fc15d27c3436bdd88168 (next commit included it)

And the target main.go is: https://github.com/JewishLewish/PolygonDB/blob/main/main.go

JewishLewish commented 1 year ago

As for Linux Amd64, the error I get:

/usr/local/go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1
/usr/bin/ld: final link failed: No space left on device
collect2: error: ld returned 1 exit status

And if use the github version commit that doesn't use yaegi, it works perfectly.

JewishLewish commented 1 year ago

Update. Code has been fixed. Apparently using Cgo can somehow break the code...?