0

I have two Raspberry Pis (model 3b) running Raspbian. One of them was on Buster, and one on Bullseye.

I have a small software project that uses the lcrypto and lssl compiler flags and that uses openssl/bio.h (judging by the error warnings I get if I don't have it installed).

On Raspbian Buster, the software compiles and runs just fine.

However, when I updated the machine to Raspbian Bullseye, I keep getting:

/usr/bin/ld: /tmp/(bunch of letters).o(.bss+0x0): multiple definition of 'bio_err'; /tmp/(bunch of letters).o(.bss+0x0): first defined here
collect2: error: ld returned 1 exit status

(The "bunch of letters" portions look something like "cctQpGnH" or "ccxvj07F" and change every time I attempt to compile the software.)

This happens on both the machine I updated and the one that I installed a fresh Bullseye image on.

Can anyone shed some light on this or suggest a possible fix?

Once again, relevant points:

  • Compiling software on a Pi 3b
  • Software needs lcrypto and lssl
  • Software compiles on Buster
  • Software generates above error when updated or freshly imaged to Bullseye

Thanks in advance.

ZeroKelvin
  • 89
  • 8
  • 2
    I'll take a guess. There is probably (e.g.) `int bio_err;` in a .h file (without `extern` or an initializer). The version of `gcc` is different between the distro revs. For a long time, the default compile option was `-fcommon`. Newer `gcc` revs change the default to `-fno-common`. Look at `man gcc` and these options (re. possible multiple definition error with `-fno-common`). If so, you can either edit the source. Or, you can add `-fcommon` to (e.g.) `CFLAGS` in your make. – Craig Estey Jan 27 '22 at 21:39
  • If one version of GCC is 9.x or earlier and the other is 10.x or later, then Craig’s diagnosis is almost certainly correct. – Jonathan Leffler Jan 27 '22 at 21:55
  • @CraigEstey Interesting. Thanks for the perspective. I'm going to try both options and let you know my results. – ZeroKelvin Jan 27 '22 at 22:34
  • For more background, see my answer: https://stackoverflow.com/questions/64626917/global-variables-and-the-data-section/64627070#64627070 It does _not_ have info on the `-fcommon/-fno-common` change but I had been considering adding it. – Craig Estey Jan 27 '22 at 22:42
  • Update: this fixed the issue. I've posted it below for anyone reading this later. Thanks, Craig! – ZeroKelvin Jan 27 '22 at 22:52

1 Answers1

0

Craig Estey's comment above provided the solution. Adding the flag:

-fcommon

to the instructions in my makefile resolved this issue.

Looks like it was, as he pointed out, a change in the default flags for gcc between the versions.

ZeroKelvin
  • 89
  • 8