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

Make fails #88

Closed
usuallycwdillon opened this issue Jul 4, 2018 · 3 comments
Closed

Make fails #88

usuallycwdillon opened this issue Jul 4, 2018 · 3 comments

Comments

@usuallycwdillon
Copy link

I'm trying to install the core libraries but make fails with the following:

Scanning dependencies of target h3ToGeoHier
[ 30%] Building C object CMakeFiles/h3ToGeoHier.dir/src/apps/miscapps/h3ToGeoHier.c.o
/home/cw/Code/h3/h3-master/src/apps/miscapps/h3ToGeoHier.c: In function ‘main’:
/home/cw/Code/h3/h3-master/src/apps/miscapps/h3ToGeoHier.c:133:37: error: ‘%s’ directive writing up to 255 bytes into a region of size 251 [-Werror=format-overflow=]
                 sprintf(name, "Cell %s Res %d", index,
                                     ^~          ~~~~~
/home/cw/Code/h3/h3-master/src/apps/miscapps/h3ToGeoHier.c:133:17: note: ‘sprintf’ output between 12 and 277 bytes into a destination of size 256
                 sprintf(name, "Cell %s Res %d", index,
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                         ((res <= rootRes) ? rootRes : res));
                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[2]: *** [CMakeFiles/h3ToGeoHier.dir/build.make:63: CMakeFiles/h3ToGeoHier.dir/src/apps/miscapps/h3ToGeoHier.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:1512: CMakeFiles/h3ToGeoHier.dir/all] Error 2
make: *** [Makefile:141: all] Error 2
@isaacbrodsky
Copy link
Collaborator

What C compiler and version are you using?

Could you try running CMake with -DWARNINGS_AS_ERRORS=OFF and then compiling again?

@usuallycwdillon
Copy link
Author

Interesting. It finishes compiling with the flag turned off. (so, yeah!) There are a few other complaints with that same sprintf() function in other files, but those were the only warnings.

gcc --version returns gcc (SUSE Linux) 8.1.1 20180614 [gcc-8-branch revision 261584]
make --version returns GNU Make 4.2.1 Built for x86_64-suse-linux-gnu
cmake -version returns cmake version 3.11.4
libtool --version returns libtool (GNU libtool) 2.4.6

I'm on SuSE Tumbleweed, which (I think) just recently moved from gcc7 to gcc8. ...I rarely compile things from source.

Ideas? I'm happy to keep digging if it might be helpful.

@isaacbrodsky
Copy link
Collaborator

Thanks for confirming it works and posting the version we need to test. Our CI tests and development systems aren't updated to GCC 8 yet.

H3 treats compiler warnings as errors by default, in an effort to catch code issues quickly. An unfortunate effect of this is that new compiler versions or different compilers can cause failures to compile the library.

In addition to testing on GCC 8 and resolving its warnings about sprintf, a good approach might be to set -DWARNINGS_AS_ERRORS=ON in our CI tests, but default it to OFF when being compiled by a user.

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