ml_socket: include sys/select.h for fd_set - #289
Open
coon42 wants to merge 1 commit into
Open
Conversation
socket_select_caller() is declared with fd_set and struct timeval parameters, but ml_socket.h includes nothing. It worked only because whatever included it had already pulled those in. newlib 4.5 provided them transitively; newlib 4.6 and picolibc do not, so the only user of this header fails to build: ../../src/ml_socket.h:33:48: error: unknown type name 'fd_set' Include <sys/select.h>, which is where both libcs define fd_set, and which also brings in struct timeval. Same class of problem as the lua setjmp.h breakage, but a separate cause: that one is a header shadowed by our bundled dietlibc, this one is a missing include on our side. Only modules/yolo includes ml_socket.h. Built for 200D.101: all 23 default modules and magiclantern.zip. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Owner
|
This doesn't repro here. The LLM analysis of the problem seems odd. It claims it's down to newlib version, but we include our own newlib, linked statically. If we're depending on system headers (entirely possible, that problem has been seen before in #286), then we want to stop doing so, not include more headers from system. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I am playing around with AI agents (specifically claude code) to automate away annoying and boring side tasks and to pay off some technical debt so this PR is AI assisted. Please let me know what you think about this kind of PRs and if this could be useful for ML. I've tried to keep change sets small and reviewable.
Motivation is to fix the build issue of #286. While trying to build ML on my Arch machine, I did run into some other issues which were fixed by the AI as well. Even though everything is part of the build fix, I have split them up into seperate PRs in case the AI made wrong assumptions.
Here is the AIs report:
ml_socket: include sys/select.h for fd_set
What
Add
#include <sys/select.h>tosrc/ml_socket.h.Why
socket_select_caller()is declared withfd_setandstruct timevalparameters, but
ml_socket.hincludes nothing at all. It worked only becausewhatever included it had already pulled those in. newlib 4.5 provided them
transitively; newlib 4.6 and picolibc do not, so the only user of this header
fails to build:
../../src/ml_socket.h:33:48: error: unknown type name 'fd_set'
Both libcs define
fd_setin<sys/select.h>(viasys/_select.h), which alsobrings in
struct timeval.Relationship to #286
Same era, opposite direction. The lua breakage is one of our bundled headers
shadowing the toolchain's; this is one of our headers failing to include what
it uses. They need separate fixes and this one is not sufficient for that issue.
Risk
modules/yolois the only file that includesml_socket.h, so the blast radiusis one module.
Testing
Built
platform/200D.101witharm-none-eabi-gcc 15.2.1from a clean tree: all23 default modules and
magiclantern.zip. Not tested on a physical camera.Worth knowing: this failure hides behind stale objects. A
yolo.obuilt before atoolchain change will be reused and the build appears to pass — it only shows up
after
make clean.🤖 Generated with Claude Code