Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PY_ARRAY_UNIQUE_SYMBOL not unique enough #2039

Closed
bfroehle opened this issue May 21, 2013 · 0 comments · Fixed by #2042
Closed

PY_ARRAY_UNIQUE_SYMBOL not unique enough #2039

bfroehle opened this issue May 21, 2013 · 0 comments · Fixed by #2042

Comments

@bfroehle
Copy link
Contributor

I'm attempting to compile a statically linked Python interpreter which includes matplotlib. In general this works fine, except that I get errors during the linking phase:

multiple definition of `MPL_ARRAY_API'
.../matplotlib/_delaunay.a(_delaunay.o):.../build/matplotlib-1.2.1/lib/matplotlib/delaunay/_delaunay.cpp:313: first defined here
.../matplotlib/backends/_backend_agg.a(backend_agg.o): In function `__exchange_and_add_dispatch':
multiple definition of `MPL_ARRAY_API'
.../matplotlib/_delaunay.a(_delaunay.o):.../build/matplotlib-1.2.1/lib/matplotlib/delaunay/_delaunay.cpp:313: first defined here
.../matplotlib/_png.a(_png.o): In function `__exchange_and_add_dispatch':
multiple definition of `MPL_ARRAY_API'
.../matplotlib/_delaunay.a(_delaunay.o):.../build/matplotlib-1.2.1/lib/matplotlib/delaunay/_delaunay.cpp:313: first defined here
.../matplotlib/_tri.a(_tri.o): In function `__exchange_and_add_dispatch':
multiple definition of `MPL_ARRAY_API'
.../matplotlib/_delaunay.a(_delaunay.o):.../build/matplotlib-1.2.1/lib/matplotlib/delaunay/_delaunay.cpp:313: first defined here
.../matplotlib/ft2font.a(ft2font.o): In function `__exchange_and_add_dispatch':
multiple definition of `MPL_ARRAY_API'
.../matplotlib/_delaunay.a(_delaunay.o):.../build/matplotlib-1.2.1/lib/matplotlib/delaunay/_delaunay.cpp:313: first defined here
.../matplotlib/_path.a(path.o): In function `__exchange_and_add_dispatch':
multiple definition of `MPL_ARRAY_API'
.../matplotlib/_delaunay.a(_delaunay.o):.../build/matplotlib-1.2.1/lib/matplotlib/delaunay/_delaunay.cpp:313: first defined here

These errors are ignorable, using -Wl,-z,muldefs or similar, but if possible I'd like to clean them up.

Would there by any objection to using a differently named PY_ARRAY_UNIQUE_SYMBOL per extension module? This would be best-practice anyway.

I was thinking the name could be something like MPL_matplotlib__png_ARRAY_API which could be constructed like:

name = ext.name.replace('.', '_')
ext.define_macros.append(('PY_ARRAY_UNIQUE_SYMBOL',
                          'MPL_' + name + '_ARRAY_API'))

The change would be minimally intrusive in the master branch (only a few lines of code changed in the Numpy class in setupext.py). It would require more extensive changes in the 1.2.x branch so I would recommend not backporting the change.

I'm happy to provide a pull request if you think it would be accepted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant