asicsforthemasses / LunaPnR

LunaPnR is a place and router for integrated circuits
GNU General Public License v3.0
40 stars 1 forks source link

Build error in TinySVGPP #3

Closed GuzTech closed 1 year ago

GuzTech commented 1 year ago

I am trying to build LunaPnR on Arch Linux and when building it, I get the following error:

FAILED: core/CMakeFiles/lunacore.dir/globalroute/prim.cpp.o 
/usr/bin/cmake -E __run_co_compile --tidy="/usr/bin/clang-tidy;-checks=clang-diagnostic-*,clang-analyzer-*,modernize-*,-modernize-use-trailing-return-type;--extra-arg-before=--driver-mode=g++" --cppcheck="cppcheck;--enable=warning;--inconclusive;--force;--inline-suppr;--suppressions-list=/home/oguz286/Software/LunaPnR/core/cppcheck/CppCheckSuppressions.txt" --source=/home/oguz286/Software/LunaPnR/core/globalroute/prim.cpp -- /usr/bin/c++ -DCOMPILERVERSIONSTRING="\"GNU 12.2.0\"" -I/home/oguz286/Software/LunaPnR/version -I/home/oguz286/Software/LunaPnR/core -I/usr/include/python3.10 -I/home/oguz286/Software/LunaPnR/core/../contrib -isystem /usr/include/eigen3 -g -fPIC -std=gnu++17 -MD -MT core/CMakeFiles/lunacore.dir/globalroute/prim.cpp.o -MF core/CMakeFiles/lunacore.dir/globalroute/prim.cpp.o.d -o core/CMakeFiles/lunacore.dir/globalroute/prim.cpp.o -c /home/oguz286/Software/LunaPnR/core/globalroute/prim.cpp
Checking /home/oguz286/Software/LunaPnR/core/globalroute/prim.cpp ...
Checking /home/oguz286/Software/LunaPnR/core/globalroute/prim.cpp: COMPILERVERSIONSTRING="GNU 12.2.0"...
Checking /home/oguz286/Software/LunaPnR/core/globalroute/prim.cpp: COMPILERVERSIONSTRING="GNU 12.2.0";NO_SSIZE_T...
In file included from /home/oguz286/Software/LunaPnR/core/globalroute/prim.cpp:9:
/home/oguz286/Software/LunaPnR/core/../contrib/tinysvgpp/src/tinysvgpp.h: In constructor ‘constexpr TinySVGPP::GStroke::GStroke(const std::string&)’:
/home/oguz286/Software/LunaPnR/core/../contrib/tinysvgpp/src/tinysvgpp.h:336:34: error: call to non-‘constexpr’ function ‘std::enable_if_t<__and_v<std::__not_<std::is_same<std::optional<_Tp>, typename std::remove_cv<typename std::remove_reference<_Tuple>::type>::type> >, std::__not_<std::__and_<std::is_scalar<_Tp>, std::is_same<_Tp, typename std::decay<_Up>::type> > >, std::is_constructible<_T1, _U1>, std::is_assignable<_T1&, _U1> >, std::optional<_Tp>&> std::optional<_Tp>::operator=(_Up&&) [with _Up = TinySVGPP::Color; _Tp = TinySVGPP::Color; std::enable_if_t<__and_v<std::__not_<std::is_same<std::optional<_Tp>, typename std::remove_cv<typename std::remove_reference<_Tuple>::type>::type> >, std::__not_<std::__and_<std::is_scalar<_Tp>, std::is_same<_Tp, typename std::decay<_Up>::type> > >, std::is_constructible<_T1, _U1>, std::is_assignable<_T1&, _U1> >, std::optional<_Tp>&> = std::optional<TinySVGPP::Color>&; typename std::decay<_Up>::type = std::decay<TinySVGPP::Color>::type; typename std::remove_cv<typename std::remove_reference<_Tuple>::type>::type = TinySVGPP::Color; typename std::remove_reference<_Tuple>::type = TinySVGPP::Color]’
  336 |         m_color = Color{colorName};
      |                                  ^
In file included from /home/oguz286/Software/LunaPnR/core/../contrib/tinysvgpp/src/tinysvgpp.h:15:
/usr/include/c++/12.2.0/optional:846:9: note: ‘std::enable_if_t<__and_v<std::__not_<std::is_same<std::optional<_Tp>, typename std::remove_cv<typename std::remove_reference<_Tuple>::type>::type> >, std::__not_<std::__and_<std::is_scalar<_Tp>, std::is_same<_Tp, typename std::decay<_Up>::type> > >, std::is_constructible<_T1, _U1>, std::is_assignable<_T1&, _U1> >, std::optional<_Tp>&> std::optional<_Tp>::operator=(_Up&&) [with _Up = TinySVGPP::Color; _Tp = TinySVGPP::Color; std::enable_if_t<__and_v<std::__not_<std::is_same<std::optional<_Tp>, typename std::remove_cv<typename std::remove_reference<_Tuple>::type>::type> >, std::__not_<std::__and_<std::is_scalar<_Tp>, std::is_same<_Tp, typename std::decay<_Up>::type> > >, std::is_constructible<_T1, _U1>, std::is_assignable<_T1&, _U1> >, std::optional<_Tp>&> = std::optional<TinySVGPP::Color>&; typename std::decay<_Up>::type = std::decay<TinySVGPP::Color>::type; typename std::remove_cv<typename std::remove_reference<_Tuple>::type>::type = TinySVGPP::Color; typename std::remove_reference<_Tuple>::type = TinySVGPP::Color]’ declared here
  846 |         operator=(_Up&& __u)
      |         ^~~~~~~~
/home/oguz286/Software/LunaPnR/core/../contrib/tinysvgpp/src/tinysvgpp.h: In constructor ‘constexpr TinySVGPP::GStroke::GStroke(const std::string&, float)’:
/home/oguz286/Software/LunaPnR/core/../contrib/tinysvgpp/src/tinysvgpp.h:342:34: error: call to non-‘constexpr’ function ‘std::enable_if_t<__and_v<std::__not_<std::is_same<std::optional<_Tp>, typename std::remove_cv<typename std::remove_reference<_Tuple>::type>::type> >, std::__not_<std::__and_<std::is_scalar<_Tp>, std::is_same<_Tp, typename std::decay<_Up>::type> > >, std::is_constructible<_T1, _U1>, std::is_assignable<_T1&, _U1> >, std::optional<_Tp>&> std::optional<_Tp>::operator=(_Up&&) [with _Up = TinySVGPP::Color; _Tp = TinySVGPP::Color; std::enable_if_t<__and_v<std::__not_<std::is_same<std::optional<_Tp>, typename std::remove_cv<typename std::remove_reference<_Tuple>::type>::type> >, std::__not_<std::__and_<std::is_scalar<_Tp>, std::is_same<_Tp, typename std::decay<_Up>::type> > >, std::is_constructible<_T1, _U1>, std::is_assignable<_T1&, _U1> >, std::optional<_Tp>&> = std::optional<TinySVGPP::Color>&; typename std::decay<_Up>::type = std::decay<TinySVGPP::Color>::type; typename std::remove_cv<typename std::remove_reference<_Tuple>::type>::type = TinySVGPP::Color; typename std::remove_reference<_Tuple>::type = TinySVGPP::Color]’
  342 |         m_color = Color{colorName};
      |                                  ^
/usr/include/c++/12.2.0/optional:846:9: note: ‘std::enable_if_t<__and_v<std::__not_<std::is_same<std::optional<_Tp>, typename std::remove_cv<typename std::remove_reference<_Tuple>::type>::type> >, std::__not_<std::__and_<std::is_scalar<_Tp>, std::is_same<_Tp, typename std::decay<_Up>::type> > >, std::is_constructible<_T1, _U1>, std::is_assignable<_T1&, _U1> >, std::optional<_Tp>&> std::optional<_Tp>::operator=(_Up&&) [with _Up = TinySVGPP::Color; _Tp = TinySVGPP::Color; std::enable_if_t<__and_v<std::__not_<std::is_same<std::optional<_Tp>, typename std::remove_cv<typename std::remove_reference<_Tuple>::type>::type> >, std::__not_<std::__and_<std::is_scalar<_Tp>, std::is_same<_Tp, typename std::decay<_Up>::type> > >, std::is_constructible<_T1, _U1>, std::is_assignable<_T1&, _U1> >, std::optional<_Tp>&> = std::optional<TinySVGPP::Color>&; typename std::decay<_Up>::type = std::decay<TinySVGPP::Color>::type; typename std::remove_cv<typename std::remove_reference<_Tuple>::type>::type = TinySVGPP::Color; typename std::remove_reference<_Tuple>::type = TinySVGPP::Color]’ declared here
  846 |         operator=(_Up&& __u)
      |         ^~~~~~~~

I get this both with the current main branch (00fb01c) and tag v0.1.5 (1f450a5).

The output of bootstrap.sh is:

❯ ./bootstrap.sh&&cd build&&ninja
-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
!!!! Building debug binaries !!!!
-- LunaPnRVersion:LunaPnR version 0.1.5 DEBUG
-- Found Git: /usr/bin/git (found version "2.38.1") 
Using CPPCHECK
Using CLANG TIDY
-- Found PythonLibs: /usr/lib/libpython3.10.so (found suitable version "3.10.8", minimum required is "3.8") 
-- Configuring done
-- Generating done
-- Build files have been written to: /home/oguz286/Software/LunaPnR/build
asicsforthemasses commented 1 year ago

Thanks for the report. It took me a while to reproduce this; GCC 11 doesn't flag this problem.

asicsforthemasses commented 1 year ago

The compile error has been fixed. You will need to pull in the latest tinysvgpp submodule in the contrib dir and a pull of the main LunaPnR tree won't hurt either.

GuzTech commented 1 year ago

Thanks for looking into it :) However, when I start from a fresh git clone of the main branch, I get the exact same error:

FAILED: core/CMakeFiles/lunacore.dir/globalroute/prim.cpp.o 
/usr/bin/cmake -E __run_co_compile --tidy="/usr/bin/clang-tidy;-checks=clang-diagnostic-*,clang-analyzer-*,modernize-*,-modernize-use-trailing-return-type;--extra-arg-before=--driver-mode=g++" --cppcheck="cppcheck;--enable=warning;--inconclusive;--force;--inline-suppr;--suppressions-list=/home/oguz286/Software/LunaPnR/core/cppcheck/CppCheckSuppressions.txt" --source=/home/oguz286/Software/LunaPnR/core/globalroute/prim.cpp -- /usr/bin/c++ -DCOMPILERVERSIONSTRING="\"GNU 12.2.0\"" -I/home/oguz286/Software/LunaPnR/version -I/home/oguz286/Software/LunaPnR/core -I/usr/include/python3.10 -I/home/oguz286/Software/LunaPnR/core/../contrib -isystem /usr/include/eigen3 -g -fPIC -std=gnu++17 -MD -MT core/CMakeFiles/lunacore.dir/globalroute/prim.cpp.o -MF core/CMakeFiles/lunacore.dir/globalroute/prim.cpp.o.d -o core/CMakeFiles/lunacore.dir/globalroute/prim.cpp.o -c /home/oguz286/Software/LunaPnR/core/globalroute/prim.cpp
Checking /home/oguz286/Software/LunaPnR/core/globalroute/prim.cpp ...
Checking /home/oguz286/Software/LunaPnR/core/globalroute/prim.cpp: COMPILERVERSIONSTRING="GNU 12.2.0"...
Checking /home/oguz286/Software/LunaPnR/core/globalroute/prim.cpp: COMPILERVERSIONSTRING="GNU 12.2.0";NO_SSIZE_T...
In file included from /home/oguz286/Software/LunaPnR/core/globalroute/prim.cpp:9:
/home/oguz286/Software/LunaPnR/core/../contrib/tinysvgpp/src/tinysvgpp.h: In constructor ‘constexpr TinySVGPP::GStroke::GStroke(const std::string&)’:
/home/oguz286/Software/LunaPnR/core/../contrib/tinysvgpp/src/tinysvgpp.h:336:34: error: call to non-‘constexpr’ function ‘std::enable_if_t<__and_v<std::__not_<std::is_same<std::optional<_Tp>, typename std::remove_cv<typename std::remove_reference<_Tuple>::type>::type> >, std::__not_<std::__and_<std::is_scalar<_Tp>, std::is_same<_Tp, typename std::decay<_Up>::type> > >, std::is_constructible<_T1, _U1>, std::is_assignable<_T1&, _U1> >, std::optional<_Tp>&> std::optional<_Tp>::operator=(_Up&&) [with _Up = TinySVGPP::Color; _Tp = TinySVGPP::Color; std::enable_if_t<__and_v<std::__not_<std::is_same<std::optional<_Tp>, typename std::remove_cv<typename std::remove_reference<_Tuple>::type>::type> >, std::__not_<std::__and_<std::is_scalar<_Tp>, std::is_same<_Tp, typename std::decay<_Up>::type> > >, std::is_constructible<_T1, _U1>, std::is_assignable<_T1&, _U1> >, std::optional<_Tp>&> = std::optional<TinySVGPP::Color>&; typename std::decay<_Up>::type = std::decay<TinySVGPP::Color>::type; typename std::remove_cv<typename std::remove_reference<_Tuple>::type>::type = TinySVGPP::Color; typename std::remove_reference<_Tuple>::type = TinySVGPP::Color]’
  336 |         m_color = Color{colorName};
      |                                  ^
In file included from /home/oguz286/Software/LunaPnR/core/../contrib/tinysvgpp/src/tinysvgpp.h:15:
/usr/include/c++/12.2.0/optional:846:9: note: ‘std::enable_if_t<__and_v<std::__not_<std::is_same<std::optional<_Tp>, typename std::remove_cv<typename std::remove_reference<_Tuple>::type>::type> >, std::__not_<std::__and_<std::is_scalar<_Tp>, std::is_same<_Tp, typename std::decay<_Up>::type> > >, std::is_constructible<_T1, _U1>, std::is_assignable<_T1&, _U1> >, std::optional<_Tp>&> std::optional<_Tp>::operator=(_Up&&) [with _Up = TinySVGPP::Color; _Tp = TinySVGPP::Color; std::enable_if_t<__and_v<std::__not_<std::is_same<std::optional<_Tp>, typename std::remove_cv<typename std::remove_reference<_Tuple>::type>::type> >, std::__not_<std::__and_<std::is_scalar<_Tp>, std::is_same<_Tp, typename std::decay<_Up>::type> > >, std::is_constructible<_T1, _U1>, std::is_assignable<_T1&, _U1> >, std::optional<_Tp>&> = std::optional<TinySVGPP::Color>&; typename std::decay<_Up>::type = std::decay<TinySVGPP::Color>::type; typename std::remove_cv<typename std::remove_reference<_Tuple>::type>::type = TinySVGPP::Color; typename std::remove_reference<_Tuple>::type = TinySVGPP::Color]’ declared here
  846 |         operator=(_Up&& __u)
      |         ^~~~~~~~
/home/oguz286/Software/LunaPnR/core/../contrib/tinysvgpp/src/tinysvgpp.h: In constructor ‘constexpr TinySVGPP::GStroke::GStroke(const std::string&, float)’:
/home/oguz286/Software/LunaPnR/core/../contrib/tinysvgpp/src/tinysvgpp.h:342:34: error: call to non-‘constexpr’ function ‘std::enable_if_t<__and_v<std::__not_<std::is_same<std::optional<_Tp>, typename std::remove_cv<typename std::remove_reference<_Tuple>::type>::type> >, std::__not_<std::__and_<std::is_scalar<_Tp>, std::is_same<_Tp, typename std::decay<_Up>::type> > >, std::is_constructible<_T1, _U1>, std::is_assignable<_T1&, _U1> >, std::optional<_Tp>&> std::optional<_Tp>::operator=(_Up&&) [with _Up = TinySVGPP::Color; _Tp = TinySVGPP::Color; std::enable_if_t<__and_v<std::__not_<std::is_same<std::optional<_Tp>, typename std::remove_cv<typename std::remove_reference<_Tuple>::type>::type> >, std::__not_<std::__and_<std::is_scalar<_Tp>, std::is_same<_Tp, typename std::decay<_Up>::type> > >, std::is_constructible<_T1, _U1>, std::is_assignable<_T1&, _U1> >, std::optional<_Tp>&> = std::optional<TinySVGPP::Color>&; typename std::decay<_Up>::type = std::decay<TinySVGPP::Color>::type; typename std::remove_cv<typename std::remove_reference<_Tuple>::type>::type = TinySVGPP::Color; typename std::remove_reference<_Tuple>::type = TinySVGPP::Color]’
  342 |         m_color = Color{colorName};
      |                                  ^
/usr/include/c++/12.2.0/optional:846:9: note: ‘std::enable_if_t<__and_v<std::__not_<std::is_same<std::optional<_Tp>, typename std::remove_cv<typename std::remove_reference<_Tuple>::type>::type> >, std::__not_<std::__and_<std::is_scalar<_Tp>, std::is_same<_Tp, typename std::decay<_Up>::type> > >, std::is_constructible<_T1, _U1>, std::is_assignable<_T1&, _U1> >, std::optional<_Tp>&> std::optional<_Tp>::operator=(_Up&&) [with _Up = TinySVGPP::Color; _Tp = TinySVGPP::Color; std::enable_if_t<__and_v<std::__not_<std::is_same<std::optional<_Tp>, typename std::remove_cv<typename std::remove_reference<_Tuple>::type>::type> >, std::__not_<std::__and_<std::is_scalar<_Tp>, std::is_same<_Tp, typename std::decay<_Up>::type> > >, std::is_constructible<_T1, _U1>, std::is_assignable<_T1&, _U1> >, std::optional<_Tp>&> = std::optional<TinySVGPP::Color>&; typename std::decay<_Up>::type = std::decay<TinySVGPP::Color>::type; typename std::remove_cv<typename std::remove_reference<_Tuple>::type>::type = TinySVGPP::Color; typename std::remove_reference<_Tuple>::type = TinySVGPP::Color]’ declared here
  846 |         operator=(_Up&& __u)
      |         ^~~~~~~~

I also went into the contrib/tinysvgpp folder and did a manual git pull origin main and tried building it again, but it results in the same error.

asicsforthemasses commented 1 year ago

The Color class in /contrib/tinysvgpp/src/tinysvgpp.h (staring on line 32), should look like this;

/** 8-bit per channel color */
class Color
{
public:
    explicit Color() = default;
    explicit constexpr Color(uint8_t _r, uint8_t _g, uint8_t _b) : r(_r), g(_g), b(_b) {}
    explicit constexpr Color(int _r, int _g, int _b) : r(_r), g(_g), b(_b) {}
    explicit Color(const std::string &colorName) : m_colorName(colorName) {}

    friend std::ostream& operator<<(std::ostream &os, const TinySVGPP::Color &color);

protected:
    uint8_t r{0};
    uint8_t g{0};
    uint8_t b{0};
    std::optional<std::string> m_colorName;
};
GuzTech commented 1 year ago

Yes, that is exactly what I have as well. Is it maybe a compiler flag that is incorrect on my machine?

asicsforthemasses commented 1 year ago

And online 334:

    GStroke(const std::string &colorName)
    {
        m_color = Color{colorName};
    }

    GStroke(const std::string &colorName, float width)
    {
        m_width = width;
        m_color = Color{colorName};
    }
GuzTech commented 1 year ago

Ah, there is a difference. I have:

    constexpr GStroke(const std::string &colorName)
    {
        m_color = Color{colorName};
    }

    constexpr GStroke(const std::string &colorName, float width)
    {
        m_width = width;
        m_color = Color{colorName};
    }

Edit: my tinysvgpp branch is commit 6bdf75cd if that helps.

asicsforthemasses commented 1 year ago

Strange, because I removed those constexpr too. In the tinysvgpp repo they're gone too.

Can you try a git pull in the contrib/tinysvgpp directory?

You probably need: git pull origin main as it complains about not having a specific branch.

asicsforthemasses commented 1 year ago

I pushed a new .gitmodules file in LunaPnR that specifies the branch for TinySVGPP. That will make life easier.

GuzTech commented 1 year ago

That's weird. I did git pull origin main in the contrib/tinysvgpp directory and now the commit number matches that of the main of the repo. But when I ran bootstrap.sh it would revert back to an older commit of tinysvgpp.

After updating to the latest LunaPnR main, it builds correctly now. Thanks!

asicsforthemasses commented 1 year ago

Good to know it works now -- thanks for testing!