conda-forge / pyarrow-feedstock

A conda-smithy repository for pyarrow.
BSD 3-Clause "New" or "Revised" License
6 stars 26 forks source link

pyarrow-core library uses default visibility instead of hidden #123

Open WillAyd opened 4 months ago

WillAyd commented 4 months ago

Solution to issue cannot be found in the documentation.

Issue

It looks like the pyarrow-core library exposes symbols that are not explicitly exported by Arrow:

$ nm -CD libarrow.so | grep TemporalScalar
00000000002e3e20 t arrow::TemporalScalar<arrow::Date32Type>::~TemporalScalar()
00000000002e3440 t arrow::TemporalScalar<arrow::Date32Type>::~TemporalScalar()
00000000002e3440 t arrow::TemporalScalar<arrow::Date32Type>::~TemporalScalar()
00000000002e4320 t arrow::TemporalScalar<arrow::Date64Type>::~TemporalScalar()
00000000002e30c0 t arrow::TemporalScalar<arrow::Date64Type>::~TemporalScalar()
...

Setting the CXXFLAG -fvisibility-hidden should get rid of these and help shave off some package size (locally I saw about a 5% reduction)

Installed packages

pyarrow-core              16.1.0          py312h5429d62_1_cpu    conda-forge

Environment info

active environment : scratchpad
    active env location : /home/willayd/mambaforge/envs/scratchpad
            shell level : 2
       user config file : /home/willayd/.condarc
 populated config files : /home/willayd/mambaforge/.condarc
                          /home/willayd/.condarc
          conda version : 23.3.1
    conda-build version : not installed
         python version : 3.10.12.final.0
       virtual packages : __archspec=1=x86_64
                          __glibc=2.35=0
                          __linux=6.8.0=0
                          __unix=0=0
       base environment : /home/willayd/mambaforge  (writable)
      conda av data dir : /home/willayd/mambaforge/etc/conda
  conda av metadata url : None
           channel URLs : https://conda.anaconda.org/conda-forge/linux-64
                          https://conda.anaconda.org/conda-forge/noarch
                          https://conda.anaconda.org/nodefaults/linux-64
                          https://conda.anaconda.org/nodefaults/noarch
          package cache : /home/willayd/mambaforge/pkgs
                          /home/willayd/.conda/pkgs
       envs directories : /home/willayd/mambaforge/envs
                          /home/willayd/.conda/envs
               platform : linux-64
             user-agent : conda/23.3.1 requests/2.31.0 CPython/3.10.12 Linux/6.8.0-76060800daily20240311-generic pop/22.04 glibc/2.35
                UID:GID : 1000:1000
             netrc file : None
           offline mode : False
h-vetinari commented 4 months ago

It looks like the pyarrow-core library exposes symbols that are not explicitly exported by Arrow:

I'm not sure I understand what you mean. Let's distinguish between libarrow the library and pyarrow-core the python bindings that build on the library.

You show that libarrow contains some symbols that could apparently be hidden - presumably they are not being used by pyarrow-core then? If we're on the same page w.r.t. that, great!

WillAyd commented 4 months ago

Yea sorry - should have been clearer that I was talking about libarrow. The more I look at this I think there are a few gaps upstream in Arrow - need to investigate further

WillAyd commented 4 months ago

ref https://github.com/apache/arrow/pull/41872