Hello Noetic maintainers!
Starting now, I will be holding new Noetic ros/rosdistro release PRs with a plan to sync ROS Noetic packages to the main apt repo on 2024-08-16. Please comment here if there are any issues I should know about before performing the sync.
There are currently 47 packages waiting to sync and 0 regressions on amd64 . However, there 42 regressions in armhf . I’m giving this sync an extra long freeze to attempt to resolve those regressions.
stack-of-tasks:devel
← sloretz:sfinae_NumpyEquivalentType
opened 01:22AM - 31 Jul 24 UTC
The ROS Noetic armhf build for `eigenpy` is failing - likely caused by #455, and… it's causing [regressions blocking the Noetic Sync](https://repositories.ros.org/status_page/ros_noetic_ufhf.html?q=REGRESSION). May I request a release to Noetic when this PR or another fix for the issue is merged?
This fixes the issue by using SFINAE and partial template specialization([as suggested here](https://stackoverflow.com/a/4166592)) to remove the specializations of `NumpyEquivalentType<long long>` and `NumpyEquivalentType<unsigned long long>` when they're the same as `int64_t` and `uint64_t` respectively.
https://build.ros.org/view/Nbin_ufhf_uFhf/job/Nbin_ufhf_uFhf__eigenpy__ubuntu_focal_armhf__binary/96
```
23:06:42 /usr/lib/ccache/c++ -Deigenpy_EXPORTS -I/tmp/binarydeb/ros-noetic-eigenpy-3.7.0/.obj-arm-linux-gnueabihf -I/tmp/binarydeb/ros-noetic-eigenpy-3.7.0/include -isystem /tmp/binarydeb/ros-noetic-eigenpy-3.7.0/.obj-arm-linux-gnueabihf/include -isystem /usr/include/eigen3 -isystem /usr/lib/python3/dist-packages/numpy/core/include -isystem /usr/include/python3.8 -Wno-long-long -Wall -Wextra -Wcast-align -Wcast-qual -Wformat -Wwrite-strings -Wconversion -g -O2 -fdebug-prefix-map=/tmp/binarydeb/ros-noetic-eigenpy-3.7.0=. -fstack-protector-strong -Wformat -Werror=format-security -DNDEBUG -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Wno-conversion -std=gnu++14 -o CMakeFiles/eigenpy.dir/src/solvers/preconditioners.cpp.o -c /tmp/binarydeb/ros-noetic-eigenpy-3.7.0/src/solvers/preconditioners.cpp
23:06:50 In file included from /tmp/binarydeb/ros-noetic-eigenpy-3.7.0/include/eigenpy/fwd.hpp:87,
23:06:50 from /tmp/binarydeb/ros-noetic-eigenpy-3.7.0/include/eigenpy/solvers/BasicPreconditioners.hpp:11,
23:06:50 from /tmp/binarydeb/ros-noetic-eigenpy-3.7.0/src/solvers/preconditioners.cpp:8:
23:06:50 /tmp/binarydeb/ros-noetic-eigenpy-3.7.0/include/eigenpy/numpy.hpp:143:8: error: redefinition of ‘struct eigenpy::NumpyEquivalentType<long long int>’
23:06:50 143 | struct NumpyEquivalentType<long long> {
23:06:50 | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
23:06:50 /tmp/binarydeb/ros-noetic-eigenpy-3.7.0/include/eigenpy/numpy.hpp:115:8: note: previous definition of ‘struct eigenpy::NumpyEquivalentType<long long int>’
23:06:50 115 | struct NumpyEquivalentType<int64_t> {
23:06:50 | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
23:06:50 /tmp/binarydeb/ros-noetic-eigenpy-3.7.0/include/eigenpy/numpy.hpp:147:8: error: redefinition of ‘struct eigenpy::NumpyEquivalentType<long long unsigned int>’
23:06:50 147 | struct NumpyEquivalentType<unsigned long long> {
23:06:50 | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
23:06:50 /tmp/binarydeb/ros-noetic-eigenpy-3.7.0/include/eigenpy/numpy.hpp:119:8: note: previous definition of ‘struct eigenpy::NumpyEquivalentType<long long unsigned int>’
23:06:50 119 | struct NumpyEquivalentType<uint64_t> {
23:06:50 | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
23:06:50 make[4]: *** [CMakeFiles/eigenpy.dir/build.make:66: CMakeFiles/eigenpy.dir/src/solvers/preconditioners.cpp.o] Error 1
```
I tested that eigenpy builds with this PR on an amd64 machine, but that of course won't show the build failure. Instead I made sure the method for the fix works using godbolt.org with the 32bit `ARM GCC 9.3.0` compiler option with the code below:
```c++
#include <cstdint>
#include <type_traits>
template<typename S, typename Enable = void>
struct FoobarType{};
template<>
struct FoobarType<int64_t>{};
template<typename S>
struct FoobarType<S,
std::enable_if_t<
!std::is_same<int64_t, long long>::value &&
std::is_same<S, long long>::value>>{};
template<>
struct FoobarType<uint64_t>{};
template<typename S>
struct FoobarType<S,
std::enable_if_t<
!std::is_same<uint64_t, unsigned long long>::value &&
std::is_same<S, unsigned long long>::value>>{};
int main() {
FoobarType<long long> bar;
FoobarType<int64_t> baz;
FoobarType<unsigned long long> ubar;
FoobarType<uint64_t> ubaz;
}
```