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

multiple definition of `RAM' #8

Open
DNSGeek opened this issue Jul 17, 2020 · 3 comments
Open

multiple definition of `RAM' #8

DNSGeek opened this issue Jul 17, 2020 · 3 comments

Comments

@DNSGeek
Copy link

DNSGeek commented Jul 17, 2020

Trying to build on a stock Fedora 32 system (x86_64) gives me the following error:

[tdknox@fedoravm cbmbasic]$ make
cc -Wall -O3   -c -o cbmbasic.o cbmbasic.c
cbmbasic.c: In function ‘main’:
cbmbasic.c:1201:17: warning: variable ‘llvm_cbe_tmp1038410385_2e_lobit’ set but not used [-Wunused-but-set-variable]
 1201 |   unsigned char llvm_cbe_tmp1038410385_2e_lobit;
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cbmbasic.c:1200:17: warning: variable ‘llvm_cbe_tmp1038210383’ set but not used [-Wunused-but-set-variable]
 1200 |   unsigned char llvm_cbe_tmp1038210383;
      |                 ^~~~~~~~~~~~~~~~~~~~~~
cbmbasic.c:195:18: warning: variable ‘llvm_cbe_tmp1845’ set but not used [-Wunused-but-set-variable]
  195 |   unsigned char *llvm_cbe_tmp1845;
      |                  ^~~~~~~~~~~~~~~~
cbmbasic.c:194:18: warning: variable ‘ltmp_2_1’ set but not used [-Wunused-but-set-variable]
  194 |   unsigned char *ltmp_2_1;
      |                  ^~~~~~~~
cbmbasic.c:193:18: warning: variable ‘ltmp_1_1’ set but not used [-Wunused-but-set-variable]
  193 |   unsigned char *ltmp_1_1;
      |                  ^~~~~~~~
cbmbasic.c:192:18: warning: variable ‘ltmp_0_1’ set but not used [-Wunused-but-set-variable]
  192 |   unsigned char *ltmp_0_1;
      |                  ^~~~~~~~
cc -Wall -O3   -c -o runtime.o runtime.c
runtime.c: In function ‘OPEN’:
runtime.c:290:45: warning: pointer targets in passing argument 1 of ‘fopen’ differ in signedness [-Wpointer-sign]
  290 |         kernal_files[kernal_lfn] = fopen(RAM+kernal_filename, mode);
      |                                          ~~~^~~~~~~~~~~~~~~~
      |                                             |
      |                                             unsigned char *
In file included from runtime.c:30:
/usr/include/stdio.h:246:44: note: expected ‘const char * restrict’ but argument is of type ‘unsigned char *’
  246 | extern FILE *fopen (const char *__restrict __filename,
      |                     ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
runtime.c: In function ‘LOAD’:
runtime.c:552:17: warning: variable ‘savedbyte’ set but not used [-Wunused-but-set-variable]
  552 |   unsigned char savedbyte;
      |                 ^~~~~~~~~
runtime.c: In function ‘SAVE’:
runtime.c:695:17: warning: variable ‘savedbyte’ set but not used [-Wunused-but-set-variable]
  695 |   unsigned char savedbyte;
      |                 ^~~~~~~~~
cc -Wall -O3   -c -o plugin.o plugin.c
plugin.c: In function ‘plugin_gone’:
plugin.c:242:18: warning: variable ‘b’ set but not used [-Wunused-but-set-variable]
  242 |    unsigned char b;
      |                  ^
cc -Wall -O3   -c -o console.o console.c
cc -o cbmbasic cbmbasic.o runtime.o plugin.o console.o
/usr/bin/ld: runtime.o:(.bss+0x120): multiple definition of `RAM'; cbmbasic.o:(.bss+0x20): first defined here
collect2: error: ld returned 1 exit status
make: *** [Makefile:10: cbmbasic] Error 1
@ifohancroft
Copy link

I am getting the exact same thing when trying to compile on Manjaro

@bwack
Copy link

bwack commented Jan 10, 2021

I guess this is related to GCC 10. I'm on GCC 9 and don't get that error, however if I set -fno-common option I get the same error. You can read about this here:
https://gcc.gnu.org/gcc-10/porting_to.html (Default to -fno-common)

You can either try fixing the source code by setting RAM to extern in all but one c file, or you can try in the makefile to add -fcommon to CFLAGS

@bwack
Copy link

bwack commented Jan 10, 2021

unsigned char RAM[65536];

this should be extern i think. Yep, just tried this now and it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants