OCL-dev / ocl-icd

OpenCL ICD Loader (free software)
BSD 2-Clause "Simplified" License
76 stars 23 forks source link

icd_generator.rb: fix build failure against gcc-10 #10

Closed trofi closed 4 years ago

trofi commented 4 years ago

On gcc-10 (and gcc-9 -fno-common) build fails as:

libtool: link: gcc -shared  -fPIC -DPIC  .libs/libdummy_icd.o .libs/libdummy_icd_gen.o \
    -ldl  -g -O2   -Wl,-soname -Wl,libdummycl.so.0 -o .libs/libdummycl.so.0.0.0
ld: .libs/libdummy_icd_gen.o:/home/slyfox/dev/git/ocl-icd/libdummy_icd_gen.h:226:
  multiple definition of `master_dispatch'; .libs/libdummy_icd.o:/home/slyfox/dev/git/ocl-icd/libdummy_icd_gen.h:226: first defined here

gcc-10 will change the default from -fcommon to fno-common: https://gcc.gnu.org/PR85678.

The error also happens if CFLAGS=-fno-common passed explicitly.

Reported-by: Anthony Parsons Bug: https://bugs.gentoo.org/706098

Kerilk commented 4 years ago

Thanks for the patch. I confirmed the bug and that the fix works.