Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not able to make executables #52

Open
alanjds opened this issue Aug 21, 2018 · 5 comments
Open

Not able to make executables #52

alanjds opened this issue Aug 21, 2018 · 5 comments
Labels
good first issue Good for newcomers imported Imported from google/grumpy

Comments

@alanjds
Copy link

alanjds commented Aug 21, 2018

google#366 opened by @gregoff82 on Jul 19, 2017

Hi all,

I'm trying to create an executeable by following the steps here:
https://github.com/google/grumpy#method-2-grumpc

The issue is when I try to build the go file. It creates a file roughly 21kB which seems too small nor is it executeable. Also, even after making a chmod +x on the file it cannot be run. The error that occurs is:

dev@mymachine:~/grumpy$ ./hello
./hello: line 1: syntax error near unexpected token `newline'
./hello: line 1: `!<arch>'

the go file produced from the command 'build/bin/grumpc hello.py > hello.go' is:

package __main__
import (
        πg "grumpy"
)
func initModule(πF *πg.Frame, _ []*πg.Object) (*πg.Object, *πg.BaseException) {
        var πTemp001 []*πg.Object
        _ = πTemp001
        var πE *πg.BaseException; _ = πE
        for ; πF.State() >= 0; πF.PopCheckpoint() {
                switch πF.State() {
                case 0:
                default: panic("unexpected function state")
                }
                // line 1: print "hello, world"
                πF.SetLineno(1)
                πTemp001 = make([]*πg.Object, 1)
                πTemp001[0] = πg.NewStr("hello, world").ToObject()
                if πE = πg.Print(πF, πTemp001, true); πE != nil {
                        continue
                }
                return nil, nil
        }
        return nil, πE
}
var Code *πg.Code
func init() {
        Code = πg.NewCode("<module>", "hello.py", nil, 0, initModule)
        πg.RegisterModule("__main__", Code)
}

if trying to build a simple go file with the code below, it works just fine (creates an executeable which i can run directly) so I don't think it's my Go installation that's been causing the issue.

package main

import "fmt"

func main() {
    fmt.Printf("hello, world\n")
}

I'm using go version go1.8.3 linux/amd64

@alanjds
Copy link
Author

alanjds commented Aug 21, 2018

Comment by trotterdylan
Thursday Jul 20, 2017 at 16:41 GMT


Thanks for reporting this. There was a similar issue reported on the mailing list: https://groups.google.com/forum/#!forum/grumpy-users

Basically, I've been messing around with the toolchain and those instructions no longer work. I've since updated that section of the README.

I want to make it easier to build one-off binaries like in the old instructions, so I'm going to leave this issue open to track progress on that work.

@alanjds
Copy link
Author

alanjds commented Aug 21, 2018

Comment by gregoff82
Thursday Jul 20, 2017 at 17:33 GMT


Hi,

Thanks for input! Now I know that that part is still a work in progress. Looking forward to the future instructions to build one-off binaries.

Thanks again!

@alanjds
Copy link
Author

alanjds commented Aug 21, 2018

Comment by jwalters-gpsw
Thursday Jan 04, 2018 at 22:46 GMT


Need any help with this?

@alanjds
Copy link
Author

alanjds commented Aug 21, 2018

Comment by ymy0
Friday May 25, 2018 at 03:00 GMT


I need help please,I have the same problem!!!
So if it can't work ,how should I deal with? Can I continue to use the GRUMPY?
Please

@alanjds alanjds added the imported Imported from google/grumpy label Aug 21, 2018
@alanjds
Copy link
Author

alanjds commented Sep 1, 2018

I was able to produce a binary changing the go run... line on

return subprocess.Popen('go run ' + go_main, shell=True).wait()
to go build..., but had not committed this on any branch. Needs proper polishing.

The plan is to create a grumpy build myscript.py command that outputs a binary instead of compiling and running the code.

This should be an easy 1st PR for someone willing to help.

@alanjds alanjds added the good first issue Good for newcomers label Sep 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers imported Imported from google/grumpy
Projects
None yet
Development

No branches or pull requests

1 participant