From 49f56db5b8a7cf6dc1321eae3c2b758d4c320d7a Mon Sep 17 00:00:00 2001 From: Benjamin Perret Date: Wed, 8 May 2019 17:05:36 +0200 Subject: [PATCH 1/2] Explicit long long allocator instantiation --- include/xtensor-python/pycontainer.hpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/xtensor-python/pycontainer.hpp b/include/xtensor-python/pycontainer.hpp index 03a27e3..b71f177 100644 --- a/include/xtensor-python/pycontainer.hpp +++ b/include/xtensor-python/pycontainer.hpp @@ -455,6 +455,18 @@ namespace xt } #endif } + +#if defined(__GNUC__) && !defined(__clang__) + namespace workaround + { + // Fixes "undefined symbol" issues + inline void long_long_allocator() + { + std::allocator a; + std::allocator b; + } + } +#endif } #endif From 8b7ed6b5f8f65dca43271009b5f0d20523551b2b Mon Sep 17 00:00:00 2001 From: Benjamin Perret Date: Thu, 9 May 2019 20:36:26 +0200 Subject: [PATCH 2/2] Documentation: add compiler workaround page --- docs/source/compilers.rst | 20 ++++++++++++++++++++ docs/source/index.rst | 1 + 2 files changed, 21 insertions(+) create mode 100644 docs/source/compilers.rst diff --git a/docs/source/compilers.rst b/docs/source/compilers.rst new file mode 100644 index 0000000..62ef028 --- /dev/null +++ b/docs/source/compilers.rst @@ -0,0 +1,20 @@ +.. Copyright (c) 2016, Johan Mabille, Sylvain Corlay and Wolf Vollprecht + + Distributed under the terms of the BSD 3-Clause License. + + The full license is in the file LICENSE, distributed with this software. + +Compiler workarounds +==================== + +This page tracks the workarounds for the various compiler issues that we +encountered in the development. This is mostly of interest for developers +interested in contributing to xtensor-python. + +GCC and ``std::allocator`` +------------------------------------- + +GCC sometimes fails to automatically instantiate the ``std::allocator`` +class template for the types ``long long`` and ``unsigned long long``. +Those allocators are thus explicitly instantiated in the dummy function +``void long_long_allocator()`` in the file ``py_container.hpp``. diff --git a/docs/source/index.rst b/docs/source/index.rst index 72ff792..950559f 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -73,6 +73,7 @@ This software is licensed under the BSD-3-Clause license. See the LICENSE file f .. toctree:: :caption: DEVELOPER ZONE + compilers releasing .. _NumPy: http://www.numpy.org