v0l / radio_tool

Radio firmware tool
https://discord.gg/V596cyatmv
GNU General Public License v3.0
82 stars 16 forks source link

Changes to build on Debian 10 (buster) #2

Closed ajorg closed 3 years ago

ajorg commented 3 years ago

I'm not confident of the C++ changes especially, but this is what I had to change to get radio_tool to build on Debian 10 (buster). The error I had was:

In file included from /home/andrew/radio_tool/src/tyt_radio.cpp:20:
/home/andrew/radio_tool/include/radio_tool/util/flash.hpp: In static member function ‘static constexpr void radio_tool::flash::FlashUtil::AlignedContiguousMemoryOp(const FlashMap&, const uint32_t&, const uint32_t&, const std::function<void(const unsigned int&, const unsigned int&, const radio_tool::flash::FlashSector&)>&)’:
/home/andrew/radio_tool/include/radio_tool/util/flash.hpp:124:80: error: call to non-‘constexpr’ function ‘static std::optional<const radio_tool::flash::FlashSector> radio_tool::flash::FlashUtil::GetSector(const FlashMap&, const uint32_t&)’
                 if(const auto& sec_info = flash::FlashUtil::GetSector(map, addr))
                                                                                ^
v0l commented 3 years ago

What version of GCC are you using?

ajorg commented 3 years ago

Looks like it's 8.3.0

On Wed, Mar 24, 2021, 2:51 AM Kieran @.***> wrote:

What version of GCC are you using?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/v0l/radio_tool/pull/2#issuecomment-805658112, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAB7TWO2X6KMTKL33EUCZBTTFGY3RANCNFSM4ZWKNUMQ .

v0l commented 3 years ago

Try to build with gcc-9 thats what i use in the GitHub actions build

ajorg commented 3 years ago

Confirmed, using gcc-9 instead does work, but to get gcc-9 onto Debian buster, you have to enable Debian testing (bullseye) which effectively upgrades most of your system so that it's not Debian stable anymore. I also had to run CC=gcc-9 CXX=g++-9 cmake .. instead of just cmake ...

If the change I suggested is safe (or reasonably so) then I think it's cheaper to have the minor change in the code that makes it also compatible with gcc-8. That said, I really wanted to post this so that anyone else running into the same issue can find the solution I worked out, so if it doesn't get merged I won't be sad.

In any case the changes to what to apt install are needed.

I imagine the cmake errors I was seeing are probably something that's fixed in a later version of cmake too.

ajorg commented 3 years ago

Neat. Thank you!