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

Build fail on GNU/Linux distros (Fedora) due to missing strnstr() function #77

Open
n7ekb opened this issue Apr 20, 2024 · 1 comment
Open

Comments

@n7ekb
Copy link

n7ekb commented Apr 20, 2024

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

n7ekb added a commit to n7ekb/dmrconfig that referenced this issue Apr 20, 2024
(OpenRTX#77)

Provides BSD strnstr() function if not defined by build
environment's C library.
@nathanielc
Copy link

I had this same issue and replaced strnstr with strstr removing the length parameter. The strnstr function is FreeUSB specific so this change made sense to me.

ec1oud added a commit to ec1oud/dmrconfig that referenced this issue Sep 6, 2024
On Linux, strnstr would come from libbsd, not libc.
Using strlen() defeated the purpose and made it slower anyway.
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