jrl-umi3218 / jrl-cmakemodules

CMake utility toolbox
https://jrl-cmakemodules.readthedocs.io/en/master/
Other
57 stars 45 forks source link

New modification (June 2022 / septembre 2022) in deprecated.hh.cmake create compilation errors for some packages with C++ clang 13 #563

Closed ymontmarin closed 1 year ago

ymontmarin commented 1 year ago

When maintaining conda packages of the HPP stack, I notice that now deprecated type defined using jrl-cmakemodules now raise compiling errors on OSX with clang 13.

For exemple, in the case of hpp-pinocchio I have:

#  define HPP_PINOCCHIO_DEPRECATED [[deprecated]]

    ~~~~~~          ~~~~~~~^~~~~~~
In file included from /Users/runner/miniforge3/conda-bld/hpp-pinocchio_1667492786290/work/src/device.cc:53:
In file included from /Users/runner/miniforge3/conda-bld/hpp-pinocchio_1667492786290/work/include/hpp/pinocchio/liegroup-space.hh:34:
/Users/runner/miniforge3/conda-bld/hpp-pinocchio_1667492786290/work/include/hpp/pinocchio/liegroup.hh:57:9: error: 'deprecated' attribute cannot be applied to types
typedef HPP_PINOCCHIO_DEPRECATED RnxSOnLieGroupMap LieGroupTpl;
        ^
/Users/runner/miniforge3/conda-bld/hpp-pinocchio_1667492786290/work/build/include/hpp/pinocchio/deprecated.hh:26:38: note: expanded from macro 'HPP_PINOCCHIO_DEPRECATED'
#  define HPP_PINOCCHIO_DEPRECATED [[deprecated]]
                                     ^
[  8%] Linking CXX executable serialization
cd $SRC_DIR/build/tests && $BUILD_PREFIX/bin/cmake -E cmake_link_script CMakeFiles/serialization.dir/link.txt --verbose=1
$BUILD_PREFIX/bin/x86_64-apple-darwin13.4.0-clang++  -pedantic -Wno-long-long -Wall -Wextra -Wcast-align -Wcast-qual -Wformat -Wwrite-strings -Wconversion -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -stdlib=libc++ -fvisibility-inlines-hidden -fmessage-length=0 -isystem $PREFIX/include -fdebug-prefix-map=$SRC_DIR=/usr/local/src/conda/hpp-pinocchio-4.14.0 -fdebug-prefix-map=$PREFIX=/usr/local/src/conda-prefix -fopenmp=libomp -O3 -DNDEBUG -isysroot /Applications/Xcode_13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -mmacosx-version-min=10.9 -Wl,-search_paths_first -Wl,-headerpad_max_install_names -Wl,-pie -Wl,-headerpad_max_install_names -Wl,-dead_strip_dylibs -Wl,-rpath,$PREFIX/lib -L$PREFIX/lib CMakeFiles/serialization.dir/serialization.cc.o -o serialization  $PREFIX/lib/libhpp-util.4.14.0.dylib $PREFIX/lib/libpinocchio.2.6.11.dylib $PREFIX/lib/libboost_thread.dylib $PREFIX/lib/libboost_unit_test_framework.dylib $PREFIX/lib/libboost_filesystem.dylib $PREFIX/lib/libboost_atomic.dylib $PREFIX/lib/libboost_system.dylib $PREFIX/lib/liburdfdom_sensor.3.0.dylib $PREFIX/lib/liburdfdom_model.3.0.dylib $PREFIX/lib/liburdfdom_world.3.0.dylib $PREFIX/lib/libtinyxml.dylib $PREFIX/lib/libconsole_bridge.1.0.dylib $PREFIX/lib/libhpp-fcl.dylib $PREFIX/lib/libboost_serialization.dylib $PREFIX/lib/libboost_chrono.dylib $PREFIX/lib/liboctomap.dylib $PREFIX/lib/liboctomath.dylib 
make[2]: Leaving directory '$SRC_DIR/build'
[  8%] Built target serialization
[ 11%] Building CXX object CMakeFiles/hpp-pinocchio.dir/src/device-data.cc.o
$BUILD_PREFIX/bin/x86_64-apple-darwin13.4.0-clang++ -DBOOST_ATOMIC_DYN_LINK -DBOOST_ATOMIC_NO_LIB -DBOOST_FILESYSTEM_DYN_LINK -DBOOST_FILESYSTEM_NO_LIB -DBOOST_MPL_LIMIT_LIST_SIZE=30 -DBOOST_MPL_LIMIT_VECTOR_SIZE=30 -DBOOST_SERIALIZATION_DYN_LINK -DBOOST_SERIALIZATION_NO_LIB -DBOOST_THREAD_DYN_LINK -DBOOST_THREAD_NO_LIB -DHPP_FCL_HAS_OCTOMAP -DHPP_FCL_HAVE_OCTOMAP -DOCTOMAP_MAJOR_VERSION=1 -DOCTOMAP_MINOR_VERSION=9 -DOCTOMAP_PATCH_VERSION=7 -DPINOCCHIO_WITH_HPP_FCL -DPINOCCHIO_WITH_URDFDOM -Dhpp_pinocchio_EXPORTS -I$SRC_DIR/build -I$SRC_DIR/build/include -I$SRC_DIR/include -isystem $PREFIX/include/eigen3 -pedantic -Wno-long-long -Wall -Wextra -Wcast-align -Wcast-qual -Wformat -Wwrite-strings -Wconversion -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -stdlib=libc++ -fvisibility-inlines-hidden -fmessage-length=0 -isystem $PREFIX/include -fdebug-prefix-map=$SRC_DIR=/usr/local/src/conda/hpp-pinocchio-4.14.0 -fdebug-prefix-map=$PREFIX=/usr/local/src/conda-prefix -O3 -DNDEBUG -isysroot /Applications/Xcode_13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -mmacosx-version-min=10.9 -fPIC -MD -MT CMakeFiles/hpp-pinocchio.dir/src/device-data.cc.o -MF CMakeFiles/hpp-pinocchio.dir/src/device-data.cc.o.d -o CMakeFiles/hpp-pinocchio.dir/src/device-data.cc.o -c $SRC_DIR/src/device-data.cc
/Users/runner/miniforge3/conda-bld/hpp-pinocchio_1667492786290/work/src/device-data.cc:95:26: warning: bitwise or with non-zero value always evaluates to true [-Wtautological-bitwise-compare]
    if (computationFlag_ | JACOBIAN)
        ~~~~~~~~~~~~~~~~~^~~~~~~~~~
1 warning and 1 error generated.
make[2]: *** [CMakeFiles/hpp-pinocchio.dir/build.make:79: CMakeFiles/hpp-pinocchio.dir/src/device.cc.o] Error 1
make[2]: *** Waiting for unfinished jobs....
1 warning generated.
make[2]: Leaving directory '$SRC_DIR/build'
make[1]: *** [CMakeFiles/Makefile2:1342: CMakeFiles/hpp-pinocchio.dir/all] Error 2
make[1]: Leaving directory '$SRC_DIR/build'
make: *** [Makefile:149: all] Error 2

To my knowledge hpp-constraints, hpp-core are also concerned with this issue.

Best, Yann

gergondet commented 1 year ago

Hi @ymontmarin

I have noticed a similar issue in another package where we used PACKAGE_API PACKAGE_DEPRECATED void somefunction(); which is accepted by GCC and MSVC but not clang. I think the proper fix is in the code of the package to put the deprecated declaration in the right location, in your case that would be:

HPP_PINOCCHIO_DEPRECATED typedef RnxSOnLieGroupMap LieGroupTpl;

(rinse and repeat for every occurrence of PACKAGE_DEPRECATED which is wrongly placed)

Note that it still works when building pre-C++17

ymontmarin commented 1 year ago

Hi @gergondet , and thank you for your answer ! It is done for the 3 recipes I am aware of

gergondet commented 1 year ago

@ymontmarin No problem, I'll close the issue now as I think there's not much we can do about it at the jrl-cmakemodules level