Closed bluedreamer closed 5 years ago
I assume you changed the unsigned int
to size_t
to fix compiling with gperf 3.1? That just fixes compiling on Fedora but breaks compiling on any distro that hasn't updated to 3.1 yet.
No, the size_t/unsigned change was for gcc 7.1. I don't see how making the prototype match the actual function definition will break anything anywhere at all - unless it is a broken compiler
The prototype you changed was for a function generated by gperf. gperf >= 3.1 always generates a function that uses size_t
whereas before that it used unsigned int
. See: https://savannah.gnu.org/forum/forum.php?forum_id=8789.
So anyone compiling with your changes and using gperf < 3.1 will get an error because the prototype in the header won't match the function generated by gperf.
The only way to solve this is to check the version of gperf and set the length type accordingly.
Ah I get it, fixed a symptom not the problem - I just wanted it to compile. I'll look at it more and see if I can provide a better patch then
FWIW, I am experiencing the same issue on Debian.
Same problem on osx 10.13.3. size_t
solves the issue
@notalex Could you please merge that? thanks
@msk999 Would be great if you could merge that in the next release! Thanks!
@sylvestre, thanks for keeping check. We had looked at this build before and ran into trouble while compiling it on Ubuntu then. We will be adding onto this work to fix the compilation. I will update further on this soon.
Which version? I am happy to download Ubuntu and make the fix cross platform? Put the work on me! This is open source after all ;-)
Thanks @bluedreamer , that would be very helpful. We need it to be compatible with Ubuntu LTS releases. The current ones are 16.04 & 18.04. This is the error I get:
Building src/parser.c (will take a while)
src/parser.c:10:20: error: conflicting types for ‘ohcount_hash_parser_from_language’
struct ParserMap * ohcount_hash_parser_from_language (register const char *str, register size_t len);
^
In file included from src/parser.c:8:0:
parsers.gperf:170:1: note: previous definition of ‘ohcount_hash_parser_from_language’ was here
We have cherry-picked this commit for the version 4 release: https://github.com/blackducksoftware/ohcount/pull/68 We have added a few more changes to make the build pass on Fedora 29. We might not release version 4 anytime soon, but the version-4 branch will remain usable for Ubuntu 18.04 and Fedora 29. @bluedreamer, thank you for your contribution.
Fix error caused from Fedora /etc/issue file containing
\S
escape sequenceFix compile error with different function signatures
languages.gperf:66:1: error: conflicting types for ‘ohcount_hash_language_from_name’ In file included from languages.gperf:2:0: src/hash/../languages.h:122:21: note: previous declaration of ‘ohcount_hash_language_from_name’ was here struct LanguageMap ohcount_hash_language_from_name(register const char str, register unsigned int len); ^
~~~~~~