Opened 6 weeks ago

Closed 6 weeks ago

Last modified 6 weeks ago

#6860 closed enhancement (fixed)

libgdal.so exposes symbols from libshapefile

Reported by: pnicolas Owned by: warmerdam
Priority: normal Milestone: 2.2.0
Component: default Version: unspecified
Severity: normal Keywords:
Cc:

Description

In our Linux application we use both gdal and shapelib, compiled as a shared library (.so).

Gdal internally uses shapelib as well and exposes the symbols. If we do not pay attention to the order of parameters in the linking phase, functions like SHPOpen will link to libgdal.so instead of libshp.so.

This can be solved by adding -fvisibility=hidden to CPPFLAGS in ogr/ogrsf_frmts/shape/GNUmakefile

without fsivility flag: global symbol

nm gdal.so | grep 'SHPOpen$'
0000000000bb82af T SHPOpen

with fsivility flag: local symbol

nm gdal.so | grep 'SHPOpen$'
0000000000bb3cd3 t SHPOpen

Change History (3)

comment:1 Changed 6 weeks ago by Even Rouault

Resolution: fixed
Status: newclosed

In 37996:

Shape: do not export Shapelib symbols for builds --with-hide-internal-symbols (fixes #6860)

comment:2 Changed 6 weeks ago by Even Rouault

In 37997:

Shape: do not export Shapelib symbols for builds --with-hide-internal-symbols (fixes #6860)

comment:3 Changed 6 weeks ago by Even Rouault

Milestone: 2.2.0
Note: See TracTickets for help on using tickets.