-
Notifications
You must be signed in to change notification settings - Fork 58
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
Build fail on GNU/Linux distros (Fedora) due to missing strnstr() function #77
Comments
(OpenRTX#77) Provides BSD strnstr() function if not defined by build environment's C library.
I had this same issue and replaced |
On Linux, strnstr would come from libbsd, not libc. Using strlen() defeated the purpose and made it slower anyway.
The strnstr is a function the BSD library. I made small changes to the makefile. Just install libbsd and add -lbsd in the list of libs at link time. |
I like the proposed change to the makefile in @olewsaa reply better than my original proposal of adding new code to the project! I don't like removing the length check parameter as suggested by @nathanielc since that seems to weaken the existing code. |
cc -g -O -Wall -Werror -DVERSION='"1.1.255"' -I/usr/include/libusb-1.0 -c -o radio.o radio.c
radio.c: In function ‘radio_validate_config’:
radio.c:322:9: error: implicit declaration of function ‘strnstr’; did you mean ‘strstr’? [-Werror=implicit-function-declaration]
322 | if (strnstr(line, "Radio:", strlen(line))) {
| ^~~~~~~
| strstr
cc1: all warnings being treated as errors
make: *** [: radio.o] Error 1
The text was updated successfully, but these errors were encountered: