yabasic icon indicating copy to clipboard operation
yabasic copied to clipboard

/usr/bin/ld: bison.c:(.text+0x34e9): undefined reference to `<function defined in .c code>'

Open jfhbrook opened this issue 1 year ago • 1 comments

After getting past #55 by commenting out the 'matrix' require, I tried a rake and got another series of errors, this time from ld:

make bison
Updated ChangeLog
cp lang/ChangeLog ../ChangeLog.org
cd lang
cc     bison.c   -o bison
bison.c: In function ‘collect_missing_clauses’:
bison.c:154:20: warning: implicit declaration of function ‘strcat’ [-Wimplicit-function-declaration]
  154 |     if (string[0]) strcat(string,"; ");
      |                    ^~~~~~
bison.c:94:1: note: include ‘<string.h>’ or provide a declaration of ‘strcat’
   93 | #include <malloc.h>
  +++ |+#include <string.h>
   94 | #else
bison.c:154:20: warning: incompatible implicit declaration of built-in function ‘strcat’ [-Wbuiltin-declaration-mismatch]
  154 |     if (string[0]) strcat(string,"; ");
      |                    ^~~~~~
bison.c:154:20: note: include ‘<string.h>’ or provide a declaration of ‘strcat’
bison.c:156:5: warning: incompatible implicit declaration of built-in function ‘strcat’ [-Wbuiltin-declaration-mismatch]
  156 |     strcat(string, buff);
      |     ^~~~~~
bison.c:156:5: note: include ‘<string.h>’ or provide a declaration of ‘strcat’
bison.c:160:20: warning: incompatible implicit declaration of built-in function ‘strcat’ [-Wbuiltin-declaration-mismatch]
  160 |     if (string[0]) strcat(string,"; ");
      |                    ^~~~~~
bison.c:160:20: note: include ‘<string.h>’ or provide a declaration of ‘strcat’
bison.c:162:5: warning: incompatible implicit declaration of built-in function ‘strcat’ [-Wbuiltin-declaration-mismatch]
  162 |     strcat(string, buff);
      |     ^~~~~~
bison.c:162:5: note: include ‘<string.h>’ or provide a declaration of ‘strcat’
bison.c:166:20: warning: incompatible implicit declaration of built-in function ‘strcat’ [-Wbuiltin-declaration-mismatch]
  166 |     if (string[0]) strcat(string,"; ");
      |                    ^~~~~~
bison.c:166:20: note: include ‘<string.h>’ or provide a declaration of ‘strcat’
bison.c:168:5: warning: incompatible implicit declaration of built-in function ‘strcat’ [-Wbuiltin-declaration-mismatch]
  168 |     strcat(string, buff);
      |     ^~~~~~
bison.c:168:5: note: include ‘<string.h>’ or provide a declaration of ‘strcat’
bison.c:172:20: warning: incompatible implicit declaration of built-in function ‘strcat’ [-Wbuiltin-declaration-mismatch]
  172 |     if (string[0]) strcat(string,"; ");
      |                    ^~~~~~
bison.c:172:20: note: include ‘<string.h>’ or provide a declaration of ‘strcat’
bison.c:174:5: warning: incompatible implicit declaration of built-in function ‘strcat’ [-Wbuiltin-declaration-mismatch]
  174 |     strcat(string, buff);
      |     ^~~~~~
bison.c:174:5: note: include ‘<string.h>’ or provide a declaration of ‘strcat’
bison.c:178:20: warning: incompatible implicit declaration of built-in function ‘strcat’ [-Wbuiltin-declaration-mismatch]
  178 |     if (string[0]) strcat(string,"; ");
      |                    ^~~~~~
bison.c:178:20: note: include ‘<string.h>’ or provide a declaration of ‘strcat’
bison.c:180:5: warning: incompatible implicit declaration of built-in function ‘strcat’ [-Wbuiltin-declaration-mismatch]
  180 |     strcat(string, buff);
      |     ^~~~~~
bison.c:180:5: note: include ‘<string.h>’ or provide a declaration of ‘strcat’
bison.c: In function ‘yyparse’:
bison.c:4774:18: warning: implicit declaration of function ‘strcmp’ [-Wimplicit-function-declaration]
 4774 |             {if (strcmp(pop(stSTRING)->pointer,dotify((yyvsp[0].symbol),FALSE)))
      |                  ^~~~~~
bison.c:4774:18: note: include ‘<string.h>’ or provide a declaration of ‘strcmp’
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/12/../../../../lib64/crt1.o: in function `_start':
(.text+0x1b): undefined reference to `main'
/usr/bin/ld: /tmp/ccoh9IzA.o: in function `report_if_missing':
bison.c:(.text+0x54): undefined reference to `error_without_position'
/usr/bin/ld: bison.c:(.text+0x6e): undefined reference to `string'
/usr/bin/ld: bison.c:(.text+0x82): undefined reference to `string'
/usr/bin/ld: bison.c:(.text+0x90): undefined reference to `string'
/usr/bin/ld: bison.c:(.text+0x9d): undefined reference to `error_without_position'
/usr/bin/ld: /tmp/ccoh9IzA.o: in function `report_conflicting_close':
bison.c:(.text+0xcd): undefined reference to `string'
/usr/bin/ld: bison.c:(.text+0xde): undefined reference to `string'
/usr/bin/ld: /tmp/ccoh9IzA.o: in function `yyparse':
bison.c:(.text+0xb93): undefined reference to `yylex'
/usr/bin/ld: bison.c:(.text+0xf18): undefined reference to `severity_so_far'
/usr/bin/ld: bison.c:(.text+0xf2c): undefined reference to `in_short_if'
/usr/bin/ld: bison.c:(.text+0xf74): undefined reference to `add_command'
/usr/bin/ld: bison.c:(.text+0xf83): undefined reference to `add_command'
/usr/bin/ld: bison.c:(.text+0xf8d): undefined reference to `create_mybreak'
/usr/bin/ld: bison.c:(.text+0xfc7): undefined reference to `add_command'
/usr/bin/ld: bison.c:(.text+0xfdd): undefined reference to `create_mybreak'
/usr/bin/ld: bison.c:(.text+0x1017): undefined reference to `add_command'
/usr/bin/ld: bison.c:(.text+0x1021): undefined reference to `add_command_with_switch_state'
/usr/bin/ld: bison.c:(.text+0x1052): undefined reference to `create_call'
/usr/bin/ld: bison.c:(.text+0x105c): undefined reference to `add_command'
/usr/bin/ld: bison.c:(.text+0x1070): undefined reference to `create_call'
/usr/bin/ld: bison.c:(.text+0x107a): undefined reference to `add_command'
/usr/bin/ld: bison.c:(.text+0x10e1): undefined reference to `dotify'
/usr/bin/ld: bison.c:(.text+0x10f2): undefined reference to `create_goto'
/usr/bin/ld: bison.c:(.text+0x1115): undefined reference to `dotify'
/usr/bin/ld: bison.c:(.text+0x1126): undefined reference to `create_gosub'
/usr/bin/ld: bison.c:(.text+0x1135): undefined reference to `create_exception'
/usr/bin/ld: bison.c:(.text+0x1144): undefined reference to `create_exception'
/usr/bin/ld: bison.c:(.text+0x1153): undefined reference to `add_command'
/usr/bin/ld: bison.c:(.text+0x1162): undefined reference to `add_command'
/usr/bin/ld: bison.c:(.text+0x1171): undefined reference to `add_command'
/usr/bin/ld: bison.c:(.text+0x1180): undefined reference to `add_command'
/usr/bin/ld: bison.c:(.text+0x11a3): undefined reference to `dotify'
/usr/bin/ld: bison.c:(.text+0x11b9): undefined reference to `create_label'
/usr/bin/ld: bison.c:(.text+0x11c8): undefined reference to `add_command'
/usr/bin/ld: bison.c:(.text+0x11d7): undefined reference to `add_command'
/usr/bin/ld: bison.c:(.text+0x11e6): undefined reference to `add_command'
/usr/bin/ld: bison.c:(.text+0x11f5): undefined reference to `add_command'
...

I figure the warnings/notes up until the ld errors are no big deal. But bison seems really unhappy about these undefined references! Having read the source code, I believe these are all defined in other source files, such as main.c or symbol.c. I'm wondering if there's a different order the make tasks need to be run in?

jfhbrook avatar May 14 '23 21:05 jfhbrook