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

All.bash exits with "opnames" undeclared error #406

Closed
gopherbot opened this issue Dec 10, 2009 · 13 comments
Closed

All.bash exits with "opnames" undeclared error #406

gopherbot opened this issue Dec 10, 2009 · 13 comments

Comments

@gopherbot
Copy link
Contributor

by srlegoking:

Before filing a bug, please check whether it has been fixed since
the latest release: run "hg pull -u" and retry what you did to
reproduce the problem.  Thanks.

What steps will reproduce the problem?
1. Run $GOROOT/src/all.bash

What is the expected output? What do you see instead?
Expected:
--- cd ../test
N known bugs; 0 unexpected bugs

Got:
(after a long list of compilations, under the "making gc" header)
quietgcc -ggdb -I"/home/seth/go"/include -O2 -fno-inline -c 
"/home/seth/go/src/cmd/gc"/subr.c
quietgcc -ggdb -I"/home/seth/go"/include -O2 -fno-inline -c 
"/home/seth/go/src/cmd/gc"/swt.c
/home/seth/go/src/cmd/gc/subr.c:800: error: 'opnames' undeclared (first use 
in this function)
make: *** [subr.o] Error 1
make: *** Waiting for unfinished jobs....
(and exit)

What is your $GOOS?  $GOARCH?
$GOOS is linux
$GOARCH is 386

Which revision are you using?  (hg identify)
9e96a82d9844 tip

Please provide any additional information below.
Not much else, it was *trying* to be installed on Debian without root.
@rsc
Copy link
Contributor

rsc commented Dec 10, 2009

Comment 1:

Do you have ed installed?

Owner changed to r...@golang.org.

Status changed to WaitingForReply.

@gopherbot
Copy link
Contributor Author

Comment 2 by srlegoking:

Yes, Version:
GNU Ed 0.7

@rsc
Copy link
Contributor

rsc commented Dec 15, 2009

Comment 3:

Okay, interesting.  Try
cd $GOROOT/src/cmd/gc
./mkopnames
and see if it produces any output.
It should print something like
// auto generated by mkopnames
static char*
opnames[] = 
{
    [OADD] =    "ADD",
    [OADDR] =   "ADDR",
    [OADDSTR] = "ADDSTR",
    [OAND] =    "AND",
    [OANDAND] = "ANDAND",
    [OANDNOT] = "ANDNOT",
    [OAPPENDSTR] =  "APPENDSTR",
    [OARRAY] =  "ARRAY",
    [OARRAYBYTESTR] =   "ARRAYBYTESTR",
    [OARRAYLIT] =   "ARRAYLIT",
    [OARRAYRUNESTR] =   "ARRAYRUNESTR",
        ...
};

@gopherbot
Copy link
Contributor Author

Comment 4 by srlegoking:

Yep, here is the output:
seth@server:~/go/src/cmd/gc$ ./mkopnames
// auto generated by mkopnames
static char*
opnames[] =
{
        [OADD] =        "ADD",
        [OADDR] =       "ADDR",
        [OADDSTR] =     "ADDSTR",
        [OAND] =        "AND",
        [OANDAND] =     "ANDAND",
        [OANDNOT] =     "ANDNOT",
        [OAPPENDSTR] =  "APPENDSTR",
        [OARRAY] =      "ARRAY",
        [OARRAYBYTESTR] =       "ARRAYBYTESTR",
        [OARRAYLIT] =   "ARRAYLIT",
        [OARRAYRUNESTR] =       "ARRAYRUNESTR",
        [OAS] = "AS",
        [OAS2] =        "AS2",
        [OAS2DOTTYPE] = "AS2DOTTYPE",
        [OAS2FUNC] =    "AS2FUNC",
        [OAS2MAPR] =    "AS2MAPR",
        [OAS2MAPW] =    "AS2MAPW",
        [OAS2RECV] =    "AS2RECV",
        [OASOP] =       "ASOP",
        [OBAD] =        "BAD",
        [OBLOCK] =      "BLOCK",
        [OBREAK] =      "BREAK",
        [OCALL] =       "CALL",
        [OCALLFUNC] =   "CALLFUNC",
        [OCALLINTER] =  "CALLINTER",
        [OCALLMETH] =   "CALLMETH",
        [OCAP] =        "CAP",
        [OCASE] =       "CASE",
        [OCLOSE] =      "CLOSE",
        [OCLOSED] =     "CLOSED",
        [OCLOSURE] =    "CLOSURE",
        [OCMP] =        "CMP",
        [OCMPIFACE] =   "CMPIFACE",
        [OCMPSTR] =     "CMPSTR",
        [OCOM] =        "COM",
        [OCOMPLIT] =    "COMPLIT",
        [OCONTINUE] =   "CONTINUE",
        [OCONV] =       "CONV",
        [OCONVIFACE] =  "CONVIFACE",
        [OCONVNOP] =    "CONVNOP",
        [OCONVSLICE] =  "CONVSLICE",
        [OCOPY] =       "COPY",
        [ODCL] =        "DCL",
        [ODCLCONST] =   "DCLCONST",
        [ODCLFIELD] =   "DCLFIELD",
        [ODCLFUNC] =    "DCLFUNC",
        [ODCLTYPE] =    "DCLTYPE",
        [ODEC] =        "DEC",
        [ODEFER] =      "DEFER",
        [ODIV] =        "DIV",
        [ODOT] =        "DOT",
        [ODOTINTER] =   "DOTINTER",
        [ODOTMETH] =    "DOTMETH",
        [ODOTPTR] =     "DOTPTR",
        [ODOTTYPE] =    "DOTTYPE",
        [OEMPTY] =      "EMPTY",
        [OEQ] = "EQ",
        [OEXTEND] =     "EXTEND",
        [OFALL] =       "FALL",
        [OFOR] =        "FOR",
        [OGE] = "GE",
        [OGOTO] =       "GOTO",
        [OGT] = "GT",
        [OHMUL] =       "HMUL",
        [OIF] = "IF",
        [OINC] =        "INC",
        [OIND] =        "IND",
        [OINDEX] =      "INDEX",
        [OINDEXMAP] =   "INDEXMAP",
        [OINDEXSTR] =   "INDEXSTR",
        [OINDREG] =     "INDREG",
        [OIOTA] =       "IOTA",
        [OKEY] =        "KEY",
        [OLABEL] =      "LABEL",
        [OLE] = "LE",
        [OLEN] =        "LEN",
        [OLITERAL] =    "LITERAL",
        [OLRC] =        "LRC",
        [OLSH] =        "LSH",
        [OLT] = "LT",
        [OMAKE] =       "MAKE",
        [OMAKECHAN] =   "MAKECHAN",
        [OMAKEMAP] =    "MAKEMAP",
        [OMAKESLICE] =  "MAKESLICE",
        [OMAPLIT] =     "MAPLIT",
        [OMINUS] =      "MINUS",
        [OMOD] =        "MOD",
        [OMUL] =        "MUL",
        [ONAME] =       "NAME",
        [ONE] = "NE",
        [ONEW] =        "NEW",
        [ONONAME] =     "NONAME",
        [ONOT] =        "NOT",
        [OOR] = "OR",
        [OOROR] =       "OROR",
        [OPACK] =       "PACK",
        [OPANIC] =      "PANIC",
        [OPANICN] =     "PANICN",
        [OPARAM] =      "PARAM",
        [OPLUS] =       "PLUS",
        [OPRINT] =      "PRINT",
        [OPRINTN] =     "PRINTN",
        [OPROC] =       "PROC",
        [ORANGE] =      "RANGE",
        [ORECV] =       "RECV",
        [OREGISTER] =   "REGISTER",
        [ORETURN] =     "RETURN",
        [ORRC] =        "RRC",
        [ORSH] =        "RSH",
        [ORUNESTR] =    "RUNESTR",
        [OSELECT] =     "SELECT",
        [OSELRECV] =    "SELRECV",
        [OSEND] =       "SEND",
        [OSENDNB] =     "SENDNB",
        [OSLICE] =      "SLICE",
        [OSLICEARR] =   "SLICEARR",
        [OSLICESTR] =   "SLICESTR",
        [OSTRUCTLIT] =  "STRUCTLIT",
        [OSUB] =        "SUB",
        [OSWITCH] =     "SWITCH",
        [OTARRAY] =     "TARRAY",
        [OTCHAN] =      "TCHAN",
        [OTFUNC] =      "TFUNC",
        [OTINTER] =     "TINTER",
        [OTMAP] =       "TMAP",
        [OTSTRUCT] =    "TSTRUCT",
        [OTYPE] =       "TYPE",
        [OTYPECASE] =   "TYPECASE",
        [OTYPESW] =     "TYPESW",
        [OXCASE] =      "XCASE",
        [OXDOT] =       "XDOT",
        [OXFALL] =      "XFALL",
        [OXOR] =        "XOR",
        [OXXX] =        "XXX",
};

@gopherbot
Copy link
Contributor Author

Comment 5 by srlegoking:

However, after running that $GOROOT/src/all.bash still exits with the same error.
Complete log attached.
Additional error(s):
conflicts: 3 shift/reduce
/bin/sh: ./mkbuiltin: Permission denied
go.y:977.9-980.9: warning: rule useless in parser due to conflicts: non_expr_type: 
'(' non_expr_type ')'
make: *** [subr.o] Error 1
make: *** Waiting for unfinished jobs....

Attachments:

  1. log.txt (41918 bytes)

@rsc
Copy link
Contributor

rsc commented Dec 16, 2009

Comment 6:

This is very strange.  You've run into at least three seemingly
unrelated problems.
1. It looks like maybe the first attempt at building
opnames.h failed, and because make clean doesn't
delete it (I'll fix that), all.bash doesn't try to recreate it.
Open $GOROOT/src/cmd/gc/opnames.h.
It should look like the output you pasted in earlier.
If it doesn't, try doing
cd $GOROOT/src/cmd/gc
rm opnames.h
make opnames.h
and see if that makes it look better.
2. I don't see this in the log.txt you uploaded, but your message
said that you had this error:
/bin/sh: ./mkbuiltin: Permission denied
This makes it look like either you don't have an executable
/bin/sh (pretty unlikely) or /bin/sh cannot open ./mkbuiltin
(also unlikely).  Try to run 
cd $GOROOT/src/cmd/gc
./mkbuiltin
by hand and see if it runs ok.  If not, that's another thing
to debug.  But your log.txt makes it look like mkbuiltin ran
okay.
3. Bison seems to be misbehaving on the input grammar.
conflicts: 3 shift/reduce
go.y:977.9-980.9: warning: rule useless in parser due to conflicts: non_expr_type: 
'(' non_expr_type ')'
This shouldn't happen - there should be no shift/reduce conflicts
reported by bison.  What version of bison do you have
(bison --version)?  My Ubuntu system says Bison 2.3.
Another user had a problem where there was another program
called Bison++ installed instead of Bison, and that program 
wasn't quite implementing the right parsing algorithms.
In that case, though, it compiled and just produced different
syntax errors.
#1 and #2 might both be explained by your Mercurial checkout
for some reason dropping the executable bits on the scripts
and then you having to fix them up by hand.  Did something 
like that happen?

@dhobsd
Copy link
Contributor

dhobsd commented Dec 16, 2009

Comment 7:

I get the same for #3:
> bison -V
bison (GNU Bison) 2.4.1
Written by Robert Corbett and Richard Stallman.
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
> bison --report-file=/tmp/report -v -y -d go.y
go.y:950.9-953.9: warning: rule useless in parser due to conflicts: non_expr_type:
'(' non_expr_type ')'
Additionally:
> bison --report-file=/tmp/report -v -y -d cc.y
conflicts: 3 shift/reduce
Attached are report files in case that's useful.

Attachments:

  1. go-report.gz (27101 bytes)
  2. cc-report.gz (17746 bytes)

@gopherbot
Copy link
Contributor Author

Comment 8 by srlegoking:

1. It was blank when I viewed it, so after following these instructions the file 
seems normal now.
2. seth@server:~/go/src/cmd/gc$ ./mkbuiltin
-bash: ./mkbuiltin: Permission denied
3. seth@server:~/go/src/cmd/gc$ bison --version
bison (GNU Bison) 2.4
Written by Robert Corbett and Richard Stallman.
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
> #1 and #2 might both be explained by your Mercurial checkout
> for some reason dropping the executable bits on the scripts
> and then you having to fix them up by hand.  Did something 
> like that happen?
I didn't modify any files. I simply checked as stated in 
<http://golang.org/doc/install.html>;:
hg clone -r release https://go.googlecode.com/hg/
Except I had to checkout on my own (Windows) machine, then upload 
the files to the machine that has the problem because Mercurial
would not install there.
Attached new log file reflecting changes.
***NOTE*** Apparently when logging the text of all.bash I typed the wrong syntax, 
which left stderr from being redirected to the file. This new log contains both 
stdout and stderr.

@gopherbot
Copy link
Contributor Author

Comment 9 by srlegoking:

1. It was blank when I viewed it, so after following these instructions the file 
seems normal now.
2. seth@server:~/go/src/cmd/gc$ ./mkbuiltin
-bash: ./mkbuiltin: Permission denied
3. seth@server:~/go/src/cmd/gc$ bison --version
bison (GNU Bison) 2.4
Written by Robert Corbett and Richard Stallman.
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
> #1 and #2 might both be explained by your Mercurial checkout
> for some reason dropping the executable bits on the scripts
> and then you having to fix them up by hand.  Did something 
> like that happen?
I didn't modify any files. I simply checked as stated in 
<http://golang.org/doc/install.html>;:
hg clone -r release https://go.googlecode.com/hg/
Except I had to checkout on my own (Windows) machine, then upload 
the files to the machine that has the problem because Mercurial
would not install there.
Attached new log file reflecting changes.
***NOTE*** Apparently when logging the text of all.bash I typed the wrong syntax, 
which left stderr from being redirected to the file. This new log contains both 
stdout and stderr.

Attachments:

  1. log.txt (50863 bytes)

@rsc
Copy link
Contributor

rsc commented Dec 17, 2009

Comment 10:

> I didn't modify any files. I simply checked as stated in
> <http://golang.org/doc/install.html>;:
>
> hg clone -r release https://go.googlecode.com/hg/
>
> Except I had to checkout on my own (Windows) machine, then upload
> the files to the machine that has the problem because Mercurial
> would not install there.
I think this is your problem.  The checkout on windows
discards many of the important permission bits, and then
the build doesn't run cleanly.
Mercurial should install fine on any Linux box; there is a
Debian package, or you can use easy_install.
I think if you install check the tree out using Mercurial
on Linux, you will find that it works much better.
Russ

@rsc
Copy link
Contributor

rsc commented Jan 8, 2010

Comment 11:

Assuming the native Mercurial checkout fixes your problems.

Status changed to Retracted.

@gopherbot
Copy link
Contributor Author

Comment 12 by dclinton:

I was also experiencing this issue on one machine because I had exported 
"GREP_OPTIONS=--color=always" in my environment, thus corrupting the 
opnames.h created by the mkopnames script.
In my case, I fixed it by switching to the much more sane "GREP_OPTIONS=--
color=auto" instead.  But to prevent others from being tripped up in the same way we 
could patch every occurrence of 'grep' in the build scripts with 'GREP_OPTIONS= 
grep'.
Please let me know if you'd like a CL for that.

@rsc
Copy link
Contributor

rsc commented Feb 10, 2010

Comment 13:

This issue was closed by revision 1ca39fb.

Status changed to Fixed.

Merged into issue #-.

@golang golang locked and limited conversation to collaborators Jun 24, 2016
@rsc rsc removed their assignment Jun 22, 2022
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants