kevinboone / cpicom

A CP/M 2.2 emulator for the Raspberry Pi Pico
35 stars 5 forks source link

Build Error #3

Open Elephant42 opened 2 years ago

Elephant42 commented 2 years ago

Any clues?

[build] [100%] Linking CXX executable cpicom.elf [build] c:/util/devel/gcc-arm/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: CMakeFiles/cpicom.dir/fs/src/ffdiskio.c.obj:C:\Users\steve\source\repos\Temp\cpicom\fs\include/fs/ffdiskio.h:11: multiple definition of bdp'; CMakeFiles/cpicom.dir/fs/src/ff.c.obj:C:\Users\steve\source\repos\Temp\cpicom\fs\include/fs/ffdiskio.h:11: first defined here [build] c:/util/devel/gcc-arm/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: CMakeFiles/cpicom.dir/fs/src/filesystemfat.c.obj:C:\Users\steve\source\repos\Temp\cpicom\fs\include/fs/ffdiskio.h:11: multiple definition ofbdp'; CMakeFiles/cpicom.dir/fs/src/ff.c.obj:C:\Users\steve\source\repos\Temp\cpicom\fs\include/fs/ffdiskio.h:11: first defined here [build] collect2.exe: error: ld returned 1 exit status

wcg commented 2 years ago

I have the same issue. Any fix?

Elephant42 commented 2 years ago

I have the same issue. Any fix?

None so far...

wcg commented 2 years ago

The problem lies in the file fs/include/fs/ffdiskio.h has a definition of bsp as a global variable. But every source file that includes it duplicates the global causing that link error. I changed the definition to:

extern BlockDeviceParams bdp[FF_VOLUMES];

and added the global declaration to fs/src/ffdiskio.c:

BlockDeviceParams bdp[FF_VOLUMES];

Elephant42 commented 2 years ago

The problem lies in the file fs/include/fs/ffdiskio.h has a definition of bsp as a global variable. But every source file that includes it duplicates the global causing that link error. I changed the definition to:

extern BlockDeviceParams bdp[FF_VOLUMES];

and added the global declaration to fs/src/ffdiskio.c:

BlockDeviceParams bdp[FF_VOLUMES];

Thanks - I'm working on other stuff right now but will try your fix when I get some time.

wcg commented 2 years ago

Seems to be running. I'm wondering how this got built like this :)

kevinboone commented 2 years ago

Sorry -- while I'm sure I've made an error here, the binary that gets attached to github is built on every commit. So I can only imagine that some compiler versions are fussier than others. I'll look into this when I'm back at my desk, probably next week.

wcg commented 2 years ago

No shade meant by my comment. I was just surprised this wasn't picked up. I built this on Manjaro Linux. I did notice a difference in size of the .uf2 file between my build and the binary your provide. Both seem to work the same though.