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

‘loadsys’ undeclared at building #626

Closed
gopherbot opened this issue Feb 24, 2010 · 15 comments
Closed

‘loadsys’ undeclared at building #626

gopherbot opened this issue Feb 24, 2010 · 15 comments

Comments

@gopherbot
Copy link
Contributor

by erevfall:

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)
/home/erwan/usr/go/src/cmd/gc/yerr.h:17: error: ‘loadsys’ undeclared here 
(not in a 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)
At first :
4a0661b86e50 tip
After a pull -u it shows :
4a0661b86e50 release/release.2010-02-23

Please provide any additional information below.
GNU Bison 2.4.1
GNU Ed 1.4
GNU Awk 3.1.7
GCC 4.4.1

Thanks in advance.
@rsc
Copy link
Contributor

rsc commented Feb 25, 2010

Comment 1:

yerr.h is generated by the script bisonerrors from go.errors.
It sounds like, for whatever reason, that script is not replacing
the % lines in go.errors with their translation on the way to 
being yerr.h.
I haven't seen this on any systems here.  If you'd like to investigate,
cd $GOROOT/src/cmd/gc
make -B yerr.h
and then try to figure out why that command (make -B yerr.h,
which runs bisonerrors) doesn't translate the % lines.

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

Status changed to Accepted.

@gopherbot
Copy link
Contributor Author

Comment 2 by erevfall:

I get :
$ make -B yerr.h
LANG=C bison -v -y -d go.y
conflicts: 1 shift/reduction
awk -f bisonerrors y.output go.errors >yerr.h

@rsc
Copy link
Contributor

rsc commented Feb 26, 2010

Comment 3:

yerr.h is supposed to begin:
// Copyright 2010 The Go Authors.  All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Example-based syntax error messages.
// See bisonerrors, Makefile, go.y.
static struct {
    int yystate;
    int yychar;
    char *msg;
} yymsg[] = {
    // Each line of the form % token list
    // is converted by bisonerrors into the yystate and yychar caused
    // by that token list.
    
    76, ',',
    "unexpected comma during import block",
    
    479, ';',
    "unexpected semicolon or newline before {",
but in your case I expect that lines 17-18 say
    % loadsys package LIMPORT '(' LLITERAL import_package import_there ','
    "unexpected comma during import block",
I don't know why it says that.  Perhaps you can help debug
what is going on.  The awk script bisonerrors says
# First // comment marks the beginning of the pattern file.
/^\/\// { bison = 0; grammar = 0; state = 0 }
bison { next }
# Treat % as first field on line as introducing a pattern (token sequence).
# Run it through the LR machine and print the induced "yystate, yychar,"
# at the point where the error happens.
$1 == "%" {
    ... processing of % line here ...
}
{ print }
We know that the bison rule is not firing, because that would keep
the script from printing anything, and lines are being printed.
So the question is why $1 == "%" is not matching the % lines.

Status changed to WaitingForReply.

@gopherbot
Copy link
Contributor Author

Comment 4 by erevfall:

yerr.h is a bit strange : yystate is always 0, and yychar is always loadsys.
I print it here, free of its comments :
static struct {
    int yystate;
    int yychar;
    char *msg;
} yymsg[] = {
    0, loadsys,
    "unexpected comma during import block",
    
    0, loadsys,
    "unexpected semicolon or newline before {",
    
    0, loadsys,
    "unexpected semicolon or newline before {",
    
    0, loadsys,
    "unexpected semicolon or newline before {",
    
    0, loadsys,
    "unexpected semicolon or newline before {",
    
    0, loadsys,
    "unexpected semicolon or newline before {",
    
    0, loadsys,
    "unexpected semicolon or newline in type declaration",
    
    0, loadsys,
    "unexpected semicolon or newline before else",
    
    0, loadsys,
    "name list not allowed in interface type",
    
    0, loadsys,
    "var declaration not allowed in for initializer",
};

@rsc
Copy link
Contributor

rsc commented Feb 26, 2010

Comment 5:

Cool.  That's progress.
Can you please reply and attach the y.output file from that directory?
Probably Bison 2.4.1 (I am using 2.3) has a different output file format
and the awk script didn't quite understand it.

@gopherbot
Copy link
Contributor Author

Comment 6 by erevfall:

Here it is.

Attachments:

  1. y.output (307784 bytes)

@gopherbot
Copy link
Contributor Author

Comment 7 by kacper.ciesla:

if it helps, I'm on gentoo, bison 2.3 installed, awk 3.1.6, same problem

@gopherbot
Copy link
Contributor Author

Comment 8 by kacper.ciesla:

Older releases compiled fine, so I did some bisect, here is the result:
Changeset 4696:7427b07b5042: bad
The first bad revision is:
changeset:   4696:7427b07b5042
user:        Russ Cox <rsc@golang.org>
date:        Tue Jan 26 23:13:22 2010 -0800
summary:     gc: improved syntax errors

@gopherbot
Copy link
Contributor Author

Comment 9 by patrick@sinz.fr:

The bug is related to bison.
The y.output file is generated with messages depending on the current locale.
So using a mandriva version in "french" I get: aller à l'état
instead of "goto state"
so the "grammar" in bisonerror being "english centric" is "wrong".
running bison in an "english" environnement is a work around.

@rsc
Copy link
Contributor

rsc commented Mar 22, 2010

Comment 10:

In response to #9, the Makefile tries to run bison in the C environment
to work around the problem of translated error messages.  In particular,
the bison action says:
    LANG=C bison -v -y $(YFLAGS) $(YFILES)
Does your copy of bison still print French with LANG=C?
If so, do you know what environment variable is supposed to be
used to get the English messages?

@gopherbot
Copy link
Contributor Author

Comment 11 by patrick@sinz.fr:

Applying this change fixes the problem (adds the LANGUAGE during the execution of bison).
52c52
<    LANG=C  bison -v -y $(YFLAGS) $(YFILES)
---
>    LANG=C  LANGUAGE="en_US.UTF8" bison -v -y $(YFLAGS) $(YFILES)

@rsc
Copy link
Contributor

rsc commented Mar 24, 2010

Comment 12:

This issue was closed by revision eaf45f2.

Status changed to Fixed.

@gopherbot
Copy link
Contributor Author

Comment 13 by kacper.ciesla:

thank you!

@gopherbot
Copy link
Contributor Author

Comment 14 by ENG.KHALED.LELA:

while installing >>
cd /opt/go/src
./all.bash
i expect to get output like this >>
N known bugs; 0 unexpected bugs
but i get this output>
LANG=C LANGUAGE="en_US.UTF8" bison -v -y -d cc.y 
/bin/sh: bison: not found
make: *** [y.tab.h] Error 127

@rsc
Copy link
Contributor

rsc commented Sep 6, 2010

Comment 15:

@ENG.KHALED.LELA: Install bison.
http://golang.org/doc/install.html

@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

2 participants