riscv-openocd icon indicating copy to clipboard operation
riscv-openocd copied to clipboard

compilation error on macOS

Open filamoon opened this issue 5 years ago • 5 comments

I got the same error as #182, but the comments in it did not help.

discovery_tcp.c:305:9: error: implicit declaration of function 'select' is invalid in C99 [-Werror,-Wimplicit-function-declaration] ret = select(sock + 1, &rfds, NULL, NULL, &timeout);

Fresh checkout, branch riscv. Please help, thanks.

filamoon avatar May 22 '19 09:05 filamoon

Ok, I solved it by adding one line to src/jtag/drivers/libjaylink/libjaylink/discovery_tcp.c

#include <sys/select.h>

filamoon avatar May 23 '19 01:05 filamoon

Might be useful here too?

https://github.com/riscv/riscv-openocd/issues/423#issuecomment-575409664

TommyMurphyTM1234 avatar Jan 17 '20 00:01 TommyMurphyTM1234

got the same problem today. Solved this with the same include independently before seeing this ticket. @timsifive , could you, please, just add this include in the file? Not sure why it compiles on other platforms - the file uses external function without its prototype defined.

Mac uses apple version of clang instead if GCC, which is more stringent than GCC, I guess. My peer installed GCC on his Mac, and could compile the tool without this problem ..

agrobman avatar May 01 '20 02:05 agrobman

@agrobman Can you submit a PR for this?

timsifive avatar May 01 '20 17:05 timsifive

I can’t , I have other changes in my files

Alex

agrobman avatar May 01 '20 17:05 agrobman

@filamoon, @agrobman, I would like to close this one. The fix is present in currently used version of libjaylink.

en-sc avatar Jan 22 '24 16:01 en-sc