Closed barracuda156 closed 5 months ago
It is better to discuss one problem per issue. File additional issues for additional problems. That way each issue can be investigated and marked as solved after it has been dealt with.
Could someone say why this fails?
I see the problem with llvm.org clang (version 10 or 18) on macOS 12 as well. It probably occurs for exactly the reason stated: a function is being called with a different number of arguments than it expects.
A bit more context on those errors:
In file included from /opt/local/var/macports/build/_Volumes_Shared_macports-ports_shells_ngs/ngs/work/ngs-0.2.16/ngs.c:11:
syntax.leg:360:57: error: too few arguments to function call, expected 4, have 3
{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; yyEnter(yy, 3); yyDo(yy, yyPush, 3, 0, (int []){0, 0, 0 ,0});
^~~~~~~~~~~~~~
syntax.leg:535:39: note: expanded from macro 'yyEnter'
#define yyEnter(YY, N) yyPush(YY, 0, N)
~~~~~~ ^
syntax.leg:517:16: note: 'yyPush' declared here
YY_LOCAL(void) yyPush(yycontext *yy, char *text, int count, int location[4])
^
syntax.leg:361:135: error: too few arguments to function call, expected 4, have 3
yyprintf((stderr, "%s\n", "unquoted_basic_command_word")); if (!yy_unquoted_basic_command_word_node(yy)) goto l14; yySet(yy, 0, -3); yyDo(yy, yySet, -3, 0, (int []){0, 0, 0 ,0});
~~~~~ ^
syntax.leg:529:16: note: 'yySet' declared here
YY_LOCAL(void) yySet(yycontext *yy, char *text, int count, int location[4]) { yy->__val[count]= yy->__; }
^
Looking into this
Here is my theory. The error is in the syntax.include
file, generated during the build. It's a leg
output patched by NGS. Since I can't see yyEnter
in my file, I assume it's an older version of leg
. @barracuda156, Please test in one of the following ways:
leg
yyEnter
. If this works, we can include the fix in NGS.Edit: yyEnter
, not yyPush
Not so sure now. It might be that I'm not seeing yyEnter
because the macro was already expanded. Looking into it.
It's newer version of peg/leg parser. NGS uses the following one (excerpt from CMakeLists.txt
)
URL https://www.piumarta.com/software/peg/peg-0.1.18.tar.gz
URL_HASH SHA1=2390bcf91299aa61c5fa93895151ffeb988357a5
@barracuda156 you can try either modifying the patching script as mentioned above or to try with older peg/leg parser (0.1.18).
MacPorts has peg/leg 0.1.20. https://ports.macports.org/port/peg
modifying the patching script as mentioned above
I tried this:
--- build-scripts/patch-leg-output.sed.orig 2023-05-17 01:23:22.000000000 -0500
+++ build-scripts/patch-leg-output.sed 2024-06-18 01:37:21.000000000 -0500
@@ -2,7 +2,7 @@
# YY_LOCAL(void) yyDo(yycontext *yy, yyaction action, int begin, int end, int location[4])
# +++++++++++++++++
/^YY_LOCAL/ {
- s/\(yyDo\|yyPush\|yyPop\|yySet\)(\(.\+\))/\1(\2, int location[4])/
+ s/\(yyDo\|yyEnter\|yyPush\|yyPop\|yySet\)(\(.\+\))/\1(\2, int location[4])/
t
}
# YY_ACTION(void) yy...(yycontext *yy, char *yytext, int yyleng, int location[4])
No change.
@ryandesign , the change looks good. just to make sure - delete the build directory and try again please
It was from a fresh build using MacPorts.
It builds fine with peg/leg 0.1.19, which I note is also the latest stable version. I'm not sure why we updated to the unstable 0.1.20 in MacPorts, except perhaps that we might have thought the project was dead since the last release was five years ago and wanted to get the very latest changes.
I see. It makes sense that NGS would support 0.1.19
, not 0.1.20
then. Any thoughts on how to proceed?
Actually although the peg/leg web site says 0.1.20 was released 2019-11-19 it was actually released 2023-11-19. The changelog for 0.1.20 is very short. Maybe this entry is the relevant one:
- src/compile.c (allocateVariables): Separated from defineVariables. (Node_compile_c_ko): Allocates and sets local variables during parse. (Rule_compile_c2): Generate yyEnter and yyLeave if rule has variables. (preamble): Macros yyEnter and yyLeave manage local variable space on stack during parsing.
Hmm, 0.1.19 was also released 2023-11-19.
The development version is 0.1.20 and is updated periodically.
... which explains the dates. Also, this even more solidifies the choice of using 0.1.19 for NGS... and for pretty much any other project unless there is a very good reason to do otherwise.
Yes one option is to downgrade peg in MacPorts to the stable 0.1.19. I'll propose that.
Did the downgrade help? Can this issue be closed?
I already verified prior to suggesting the downgrade that the build would then succeed.
You can close the issue if you intend never to support peg 0.1.20. If you think this is a bug in peg 0.1.20 I hope you'll report it to its developer.
Could someone say why this fails?
P. S. There are two minor issues too, missing
MAP_ANONYMOUS
on Darwin < 15 (trivial fix, define toMAP_ANON
) and Pandoc (which is broken on powerpc) being pulled by documentation building, which unfortunately does not have a configure argument (but can be just removed).