Open madebr opened 1 month ago
When configuring DethRace with -DBUILD_SHARED_LIBS=ON -DCMAKE_POSITION_INDEPENDENT_CODE=ON, linking fails due to missing symbols.
-DBUILD_SHARED_LIBS=ON -DCMAKE_POSITION_INDEPENDENT_CODE=ON
(eventually add -DCMAKE_EXE_LINKER_FLAGS="-Wl,--no-undefined" to emit an error on missing symbols)
-DCMAKE_EXE_LINKER_FLAGS="-Wl,--no-undefined"
/usr/bin/ld: lib/BRender-v1.3.2/drivers/pentprim/libsoftprmf.so: undefined reference to `TrapezoidRenderPIZ2TIA_RGB_555' /usr/bin/ld: lib/BRender-v1.3.2/drivers/pentprim/libsoftprmf.so: undefined reference to `TrapezoidRenderPIZ2TIA_RGB_888' /usr/bin/ld: lib/BRender-v1.3.2/drivers/pentprim/libsoftprmf.so: undefined reference to `TrapezoidRenderPIZ2TAN' /usr/bin/ld: lib/BRender-v1.3.2/drivers/pentprim/libsoftprmf.so: undefined reference to `ScanLinePITPD64' /usr/bin/ld: lib/BRender-v1.3.2/drivers/pentprim/libsoftprmf.so: undefined reference to `TrapezoidRenderPITA' /usr/bin/ld: lib/BRender-v1.3.2/drivers/pentprim/libsoftprmf.so: undefined reference to `ScanLinePITPD1024' /usr/bin/ld: lib/BRender-v1.3.2/drivers/pentprim/libsoftprmf.so: undefined reference to `TrapezoidRenderPITA24' /usr/bin/ld: lib/BRender-v1.3.2/drivers/pentprim/libsoftprmf.so: undefined reference to `TrapezoidRenderPITIA' /usr/bin/ld: lib/BRender-v1.3.2/drivers/pentprim/libsoftprmf.so: undefined reference to `ScanLinePITIPB256_RGB_565' /usr/bin/ld: lib/BRender-v1.3.2/drivers/pentprim/libsoftprmf.so: undefined reference to `TrapezoidRenderPIZ2TA24' /usr/bin/ld: lib/BRender-v1.3.2/drivers/pentprim/libsoftprmf.so: undefined reference to `TrapezoidRenderPIZ2TIA' /usr/bin/ld: lib/BRender-v1.3.2/drivers/pentprim/libsoftprmf.so: undefined reference to `TrapezoidRenderPITAN' /usr/bin/ld: lib/BRender-v1.3.2/drivers/pentprim/libsoftprmf.so: undefined reference to `TrapezoidRenderPITIA_RGB_555' /usr/bin/ld: lib/BRender-v1.3.2/drivers/pentprim/libsoftprmf.so: undefined reference to `TrapezoidRenderPIZ2TA15' /usr/bin/ld: lib/BRender-v1.3.2/drivers/pentprim/libsoftprmf.so: undefined reference to `TrapezoidRenderPITA15' /usr/bin/ld: lib/BRender-v1.3.2/drivers/pentprim/libsoftprmf.so: undefined reference to `TrapezoidRenderPITIA_RGB_888' /usr/bin/ld: lib/BRender-v1.3.2/drivers/pentprim/libsoftprmf.so: undefined reference to `ScanLinePITIPB256_RGB_555' /usr/bin/ld: lib/BRender-v1.3.2/drivers/pentprim/libsoftprmf.so: undefined reference to `TrapezoidRenderPIZ2TA' /usr/bin/ld: lib/BRender-v1.3.2/drivers/pentprim/libsoftprmf.so: undefined reference to `ScanLinePITPD128' /usr/bin/ld: lib/BRender-v1.3.2/drivers/pentprim/libsoftprmf.so: undefined reference to `ScanLinePITPD256' /usr/bin/ld: lib/BRender-v1.3.2/drivers/pentprim/libsoftprmf.so: undefined reference to `ScanLinePITIP256_RGB_555'
We either should disallow building shared libraries, or merge some libraries together.
note: I had to apply this patch to fix the double definition of _BrDefaultDiagHandler in core/fw/defdiag.c and core/std/defdiag.c.
_BrDefaultDiagHandler
core/fw/defdiag.c
core/std/defdiag.c
--- a/core/fw/CMakeLists.txt +++ b/core/fw/CMakeLists.txt @@ -75,7 +75,7 @@ set(FW_FILES brqsort.c bswap.c datafile.c - defdiag.c + # defdiag.c # core/std/stddiag.c and core/fw/defdiag.c both define _BrDefaultDiagHandler deffile.c defmem.c devlist.c
I think the better fix is to only export public BRender symbols from the shared libraries. This error occurs because libbrender.so exports _BrDefaultDiagHandler twice, which is not possible.
libbrender.so
When configuring DethRace with
-DBUILD_SHARED_LIBS=ON -DCMAKE_POSITION_INDEPENDENT_CODE=ON
, linking fails due to missing symbols.(eventually add
-DCMAKE_EXE_LINKER_FLAGS="-Wl,--no-undefined"
to emit an error on missing symbols)We either should disallow building shared libraries, or merge some libraries together.
note: I had to apply this patch to fix the double definition of
_BrDefaultDiagHandler
incore/fw/defdiag.c
andcore/std/defdiag.c
.I think the better fix is to only export public BRender symbols from the shared libraries. This error occurs because
libbrender.so
exports_BrDefaultDiagHandler
twice, which is not possible.