Closed GuzTech closed 1 year ago
Thanks for the report. It took me a while to reproduce this; GCC 11 doesn't flag this problem.
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.
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.
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;
};
Yes, that is exactly what I have as well. Is it maybe a compiler flag that is incorrect on my machine?
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};
}
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.
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.
I pushed a new .gitmodules file in LunaPnR that specifies the branch for TinySVGPP. That will make life easier.
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!
Good to know it works now -- thanks for testing!
I am trying to build LunaPnR on Arch Linux and when building it, I get the following error:
I get this both with the current main branch (00fb01c) and tag v0.1.5 (1f450a5).
The output of bootstrap.sh is: