Open BioBox opened 2 years ago
Did you try installing gnuplot? Maybe try using bison or other things or try updated versions of Yacc/bison
I tried installing gnuplot and got the exact thing from a clean make. Bison version is still 3.8.2 on Arch.
@BioBox I also use arch. And use yacc to build sc-im.. Could you please try rebuilding with yacc?
(I'm not BioBox but I'm having the same problem)
To use yacc, you uncomment YACC = bison -y
in the Makefile, right? Or change it to YACC = yacc
? Either way, I still get
make: Entering directory '/home/michael/src/exp/sc-im/src'
cc -Wall -g -DNCURSES -D_XOPEN_SOURCE_EXTENDED -D_GNU_SOURCE -DSNAME=\"sc-im\" -DHELP_PATH=\"/usr/local/share/sc-im\" -DLIBDIR=\"/usr/local/share/doc/sc-im\" -DDFLT_PAGER=\"less\" -DDFLT_EDITOR=\"vim\" -DUSECOLORS -DHISTORY_FILE=\"sc-iminfo\" -DHISTORY_DIR=\".cache\" -DCONFIG_FILE=\"scimrc\" -DCONFIG_DIR=\".config/sc-im\" -DINS_HISTORY_FILE=\"sc-iminfo\" -DUNDO -DMAXROWS=65536 -DUSELOCALE -DMOUSE -DDEFAULT_COPY_TO_CLIPBOARD_CMD=\""xclip -i -selection clipboard <"\" -DDEFAULT_PASTE_FROM_CLIPBOARD_CMD=\""xclip -o -selection clipboard"\" -DDEFAULT_OPEN_FILE_UNDER_CURSOR_CMD=\""scopen"\" -DAUTOBACKUP -DHAVE_PTHREAD -DGNUPLOT -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 -DODS -DXLSX -I/usr/include/libxml2 -DXLUA -c -o file.o file.c
In file included from file.c:79:
tui.h:84:6: error: conflicting types for ‘yyerror’; have ‘void(char *)’
84 | void yyerror(char *err); // error routine for yacc (gram.y)
| ^~~~~~~
In file included from file.c:75:
y.tab.h:593:6: note: previous declaration of ‘yyerror’ with type ‘void(const char *)’
593 | void yyerror (const char *msg);
| ^~~~~~~
make: *** [<builtin>: file.o] Error 1
make: Leaving directory '/home/michael/src/exp/sc-im/src'
Im using bison 3.8.2, and building completes without problem in my arch system. My generated y.tab.h does not have that definition of yyerror either. Please try building that y.tab.h manually with bison 3.8.2, and see if you still have that declaration of yyerror in your y.tab.h. I attach my y.tab.h just in case y.tab.h.txt
(I've also been using bison 3.8.2)
I'm not familiar with bison but from briefly looking at the documentation on their site, I think the command would be bison -yd gram.y
, which again generates a y.tab.h with this yyerror.
--- y.tab.h
+++ /home/michael/y.tab.h.txt
@@ -589,12 +589,6 @@
extern YYSTYPE yylval;
-#if !defined yyerror && !defined YYERROR_IS_DECLARED
-void yyerror (const char *msg);
-#endif
-#if !defined yylex && !defined YYLEX_IS_DECLARED
-int yylex (void);
-#endif
int yyparse (void);
I'm able to get it to compile if I do a lot of manual removing in response to these errors, but that doesn't solve the root of the problem
I dont know why bison in your case generates the y.tab.h with yyerror and the yylex, while that does not happen in my case. not a bison expert neither.
@BioBox Could you retest this? May be something changed on your system after some time..
(I'm still getting the same error)
@michaelskyba @BioBox could you please retry this? thanks.
Since Nov 4 2022, I have reinstalled my operating system and also switched laptops, but I'm still getting the same error:
sc-im: make -C src
make: Entering directory '/home/oboro/src/exp/sc-im/src'
cc -Wall -g -DNCURSES -D_XOPEN_SOURCE_EXTENDED -D_GNU_SOURCE -DSNAME=\"sc-im\" -DHELP_PATH=\"/usr/local/share/sc-im\" -DLIBDIR=\"/usr/local/share/doc/sc-im\" -DDFLT_PAGER=\"less\" -DDFLT_EDITOR=\"vim\" -DUSECOLORS -DHISTORY_FILE=\"sc-iminfo\" -DHISTORY_DIR=\".cache\" -DCONFIG_FILE=\"scimrc\" -DCONFIG_DIR=\".config/sc-im\" -DINS_HISTORY_FILE=\"sc-iminfo\" -DUNDO -DMAXROWS=65536 -DUSELOCALE -DMOUSE -DDEFAULT_COPY_TO_CLIPBOARD_CMD=\""xclip -i -selection clipboard <"\" -DDEFAULT_PASTE_FROM_CLIPBOARD_CMD=\""xclip -o -selection clipboard"\" -DDEFAULT_OPEN_FILE_UNDER_CURSOR_CMD=\""scopen"\" -DAUTOBACKUP -DHAVE_PTHREAD -DGNUPLOT -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 -DODS -DXLSX -I/usr/include/libxml2 -DXLUA -c -o file.o file.c
In file included from file.c:79:
tui.h:84:6: error: conflicting types for ‘yyerror’; have ‘void(char *)’
84 | void yyerror(char *err); // error routine for yacc (gram.y)
| ^~~~~~~
In file included from file.c:75:
y.tab.h:595:6: note: previous declaration of ‘yyerror’ with type ‘void(const char *)’
595 | void yyerror (const char *msg);
| ^~~~~~~
make: *** [<builtin>: file.o] Error 1
make: Leaving directory '/home/oboro/src/exp/sc-im/src'
I also tried setting YACC to a random, nonsense value like
YACC = alkjesfkwfaehfiaw
in the Makefile or just deleting the line entirely, and nothing changed when compiling, so I guess the YACC variable is not being called
GPT-4 recommended the following diff, which fixed it for me:
diff --git a/src/gram.y b/src/gram.y
index fec3876..500b1da 100755
--- a/src/gram.y
+++ b/src/gram.y
@@ -31,7 +31,7 @@
#include "vmtbl.h"
#include "cmds/cmds_command.h"
-void yyerror(char *err); // error routine for yacc (gram.y)
+void yyerror(const char *err); // error routine for yacc (gram.y)
int yylex();
extern struct session * session;
diff --git a/src/tui.c b/src/tui.c
index d66825b..2983184 100644
--- a/src/tui.c
+++ b/src/tui.c
@@ -1235,7 +1235,7 @@ void ui_show_celldetails() {
* \return none
*/
-void yyerror(char * err) {
+void yyerror(const char * err) {
mvwprintw(input_pad, 0, 0, "%s: %.*s<=%s", err, linelim, line, line + linelim);
ui_refresh_pad(0);
return;
diff --git a/src/tui.h b/src/tui.h
index fef0459..491e574 100644
--- a/src/tui.h
+++ b/src/tui.h
@@ -81,7 +81,7 @@ void ui_do_welcome();
void ui_update(int header);
int ui_get_formated_value(struct ent ** p, int col, char * value);
void ui_handle_cursor();
-void yyerror(char *err); // error routine for yacc (gram.y)
+void yyerror(const char *err); // error routine for yacc (gram.y)
void ui_show_text(char * val);
#ifdef XLUA
void ui_bail(lua_State *L, char * msg);
Would this be a breaking change for users not seeing this error? I don't know much about C
I'm using bison version 3.8.2, and it appears that it's generating function prototypes that conflict with other headers in the code when compiling version 0.8.2. This is the stderr from make:
This also occurs when compiling under the latest commit. Please help.