Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Time comparison errors in DestAdvert.cpp #13

Open
rmccourt opened this issue Dec 8, 2019 · 1 comment
Open

Time comparison errors in DestAdvert.cpp #13

rmccourt opened this issue Dec 8, 2019 · 1 comment

Comments

@rmccourt
Copy link

rmccourt commented Dec 8, 2019

I got a pair of related errors while trying to compile onto the Raspberry Pi:

/home/rmccourt/LL-DLEP/DestAdvert.cpp:378:27: error: comparison of integer expressions of different signedness: ‘time_t’ {aka ‘long int’} and ‘unsigned int’ [-Werror=sign-compare]
             if (entry_age >= hold_interval)
                 ~~~~~~~~~~^~~~~~~~~~~~~~~~
/home/rmccourt/LL-DLEP/DestAdvert.cpp:390:27: error: comparison of integer expressions of different signedness: ‘time_t’ {aka ‘long int’} and ‘unsigned int’ [-Werror=sign-compare]
             if (entry_age >= expire_count * entry.info.reportInterval)
                 ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I got it to compile by casting the results to time_t:

if (entry_age >= (time_t) hold_interval)
and
if (entry_age >= (time_t) (expire_count * entry.info.reportInterval))

Not positive that it's the perfect fix, but figured I'd flag it for someone who's more familiar with the code to look at. Not really sure if/how to submit this as a change for review.

@b00ga
Copy link
Contributor

b00ga commented Jan 2, 2020

The default DLEP compiler flags enable all warnings (-Wall) and treat all warnings as compiler errors (-Werror). For the tested platforms in the README, DLEP will compile cleanly with these settings. I've tested on some other platforms and found that we will get some warnings, which will cause the compile to fail with these flags. Due to this, we added cmake flags that let you disable these features.

Last week, I finally got some time to fire up one of my RPis on the bench. I reproduced the failures. When we have time, we'll see if we can find the correct fix, but in the meantime, you can just compile without -Werror set. I verified a successful compile (passing the test suite) on Raspbian via this route.

There's info on this in the BUILD section of the README, but here's the option for quick reference:
cmake -DWARNINGS_AS_ERRORS=OFF ..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants