Opened 7 years ago

Closed 7 years ago

Last modified 7 years 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 by Even Rouault, 7 years ago

Resolution: fixed
Status: newclosed

In 37996:

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

comment:2 by Even Rouault, 7 years ago

In 37997:

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

comment:3 by Even Rouault, 7 years ago

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