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

Compile issue in Time.cc #12

Open
Sembiance opened this issue Jul 3, 2022 · 2 comments
Open

Compile issue in Time.cc #12

Sembiance opened this issue Jul 3, 2022 · 2 comments

Comments

@Sembiance
Copy link

Sembiance commented Jul 3, 2022

On linux 5.18.8 running g++ 12.1.1_p20220628 p8 with glibc 2.35-r7 I get the following compile error with latest phosg master code as of July 3, 2022:

[2/43] /usr/bin/x86_64-pc-linux-gnu-g++ -Dphosg_EXPORTS -I/usr/local/include  -DNDEBUG -O2 -march=native -pipe -fPIC -Wall -Wextra -Werror -Wno-strict-aliasing -Wno-unused-result -Wno-overflow -std=gnu++20 -MD -MT CMakeFiles/phosg.dir/src/Time.cc.o -MF CMakeFiles/phosg.dir/src/Time.cc.o.d -o CMakeFiles/phosg.dir/src/Time.cc.o -c /var/tmp/portage/dev-libs/phosg-0_p20220702/work/phosg-master/src/Time.cc
FAILED: CMakeFiles/phosg.dir/src/Time.cc.o 
/usr/bin/x86_64-pc-linux-gnu-g++ -Dphosg_EXPORTS -I/usr/local/include  -DNDEBUG -O2 -march=native -pipe -fPIC -Wall -Wextra -Werror -Wno-strict-aliasing -Wno-unused-result -Wno-overflow -std=gnu++20 -MD -MT CMakeFiles/phosg.dir/src/Time.cc.o -MF CMakeFiles/phosg.dir/src/Time.cc.o.d -o CMakeFiles/phosg.dir/src/Time.cc.o -c /var/tmp/portage/dev-libs/phosg-0_p20220702/work/phosg-master/src/Time.cc
/var/tmp/portage/dev-libs/phosg-0_p20220702/work/phosg-master/src/Time.cc: In function ‘std::string format_time(uint64_t)’:
/var/tmp/portage/dev-libs/phosg-0_p20220702/work/phosg-master/src/Time.cc:19:13: error: aggregate ‘tm t_parsed’ has incomplete type and cannot be defined
   19 |   struct tm t_parsed;
      |             ^~~~~~~~
/var/tmp/portage/dev-libs/phosg-0_p20220702/work/phosg-master/src/Time.cc:20:3: error: ‘gmtime_r’ was not declared in this scope; did you mean ‘time_t’?
   20 |   gmtime_r(&t_secs, &t_parsed);
      |   ^~~~~~~~
      |   time_t
/var/tmp/portage/dev-libs/phosg-0_p20220702/work/phosg-master/src/Time.cc:23:16: error: ‘strftime’ was not declared in this scope
   23 |   size_t len = strftime(ret.data(), ret.size(),
      |                ^~~~~~~~

Simply adding a #include <time.h> fixes the issue.

@fuzziqersoftware
Copy link
Owner

Thanks for the report; I've added the relevant include.

Curiously, this didn't fail on the default macOS or Ubuntu setups, at least in GitHub Actions. Which Linux are you using? I may look into setting up CI for more Linuxes to prevent further issues like this.

@Sembiance
Copy link
Author

I'm using Gentoo linux. I can provide any other info you'd like :)

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