Boost logo

Boost-Build :

Subject: [Boost-build] how to remove auto added, exports files for shared libs ?
From: Avi Bahra (avibahra_at_[hidden])
Date: 2010-09-09 07:43:16


>I am trying to fix an issue that is specific to AIX.
>In my case I know the fix, but don't know how to change jamfile's
>to remove a automatically added exports file.
>
>Using boost 1.43, python2.5 64 bit, new acc compiler v11.1
>Everything links and runs ok, but I end up having
>*hundreds* of warnings about duplicate symbols,
>when building. i.e of the type:
>
>ld: 0711-224 WARNING: Duplicate symbol: PyUnicodeUCS2_AsWideChar
>ld: 0711-224 WARNING: Duplicate symbol: PyUnicodeUCS2_
>FromEncodedObject
>ld: 0711-224 WARNING: Duplicate symbol: PyWeakref_NewRef
>ld: 0711-224 WARNING: Duplicate symbol: Py_InitModule4_64
>ld: 0711-224 WARNING: Duplicate symbol: _PyObject_New
>ld: 0711-224 WARNING: Duplicate symbol: _PyType_Lookup
>
> The problem can be reproduced with an example in the boost installation:
> boost_1_43_0/libs/python/example/quickstart
>
>bjam -d2: gives:
>
>xlC_r -brtl -bnoipath -g -qfullpath -o
>"bin/vacpp/debug/threading-multi/embedding" -L/usr/local/python64/lib
>-L/usr/local/python64/lib/python2.5/config
>"bin/vacpp/debug/threading-multi/embedding.o"
>"../../../../bin.v2/libs/python/build/vacpp/debug/threading-multi/libboost_python.so"
> -lpython2.5 -lpthread -ldl
>-Wl,-bI:/usr/local/python64/lib/python2.5/config/python.exp
>
>The symbol duplication is caused by linking with:
> -Wl,-bI:/usr/local/python64/lib/python2.5/config/python.exp
>since the symbols have already been defined in -lpython2.5.a
>
>When the file(python.exp) is removed from the link line,
>no more duplicate symbols and test still runs ok.
>
>I suspect the same issue exists with boost 1.44. Its not clear
>if this is only a problem for python2.5. By I need this fix, to
>avoid my users, from seeing the duplicate symbol warnings.
>
>My only issue is, how can I remove the automatic
>addition of python.exp exports file from the link line ?
>
>Any help appreciated.

Guessing that for AIX that exports file should only be used when
linking with a shared library and not when linking with
a static system python lib

boost_1_43_0/libs/python/example/quickstart/Jamroot:

# Declare an executable called embedding that embeds Python
exe embedding : embedding.cpp /python//python ;

Looking in tools/python.jam

local rule configure ( version ? : cmd-or-prefix ? : includes * : libraries ? :
    condition * : extension-suffix ? )
{
   ......

    # On AIX we need Python extensions and Boost.Python to import symbols from
    # the Python interpreter. Dynamic libraries opened with dlopen() do not
    # inherit the symbols from the Python interpreter.
     else if $(target-os) = aix
    {
        alias python_for_extensions
            :
            : $(target-requirements)
            :
            : $(usage-requirements)
<linkflags>-Wl,-bI:$(libraries[1])/python.exp
            ;
    }
    else
    {
        alias python_for_extensions
            :
            : $(target-requirements)
            :
            : $(usage-requirements)
            ;
    }
}

I have commented out the # <linkflags>-Wl,-bI:$(libraries[1])/python.exp
as the boost_1_43_0/libs/python/example/quickstart
links statically with system python lib, and hence does not need python.exp
The same applies to my own application which used the
quickstart example as guide for using embedded python.

Was the system python lib, linked dynamically at point ?

Currently with vacpp v11.1 and python 2.5 the above rule is wrong

   Best regards,
Ta,
    Avi


Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk