-
Notifications
You must be signed in to change notification settings - Fork 388
backend:bug: Fixes the bug that caused breaking of app-linux build #3553
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
base: main
Are you sure you want to change the base?
backend:bug: Fixes the bug that caused breaking of app-linux build #3553
Conversation
Fixed a bug where app-linux target did not automatically build the backend for the current HOST OS which causes binary exec error. Now the makefile ensures that backend is build before running the backend server
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: BABAR-TAHSEEN55 The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Welcome @BABAR-TAHSEEN55! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is a bug, it's intended so we don't have to compile the backend every time, even if subsequent attempts are faster. The problem with this fix is that it will compile the backend every time.
An improvement would be to add the headlamp-server binary as a dependency of that target, and then a new target to compile the backend if the headlamp-server doesn't exist.
Running I'm wondering if it's worth it? pros
Cons:
|
Aah! I think creating a new target might be a good fix |
I have i7 13th gen and the building process is Pretty quick |
The problem with having the binary file at backend/headlamp-server target as a dependency is that if it exists, then the bug is not fixed. It will not build, and try to run the arm binary on x86 machines.
I understand @joaquimrocha not wanting run-backend to take extra time compiling. It is a significant extra time, and personally I'd be happy with that extra 0.5 seconds on run-backend... because it solves these issues:
However, it takes 12 seconds when I'm on my slow windows work laptop to compile when nothing has changed and 68 seconds running make backend from scratch. So definitely that's really bad for windows. Another potential way to fix it that won't add much extra time to run-backend: To detect if the binary matches the host, it's probably a dozen lines of shell scripting using @BABAR-TAHSEEN55 what do you think? |
I think the initial solution is better. If that significant extra time won't be a problem in the future & if its not a problem with compiling backend everytime , |
Hi. I don't think we need to check for the arch directly after all. We already have the file extension pre-checked. So we can do something like: .PHONY: backend-check-build
backend-check-build:
@if [ ! -f backend/headlamp-server${SERVER_EXE_EXT} ] || ! git diff --quiet HEAD -- backend/; then \
echo "Backend changes detected, rebuilding..."; \
make backend; \
else \
echo "Backend is up to date"; \
fi And then we add this target as the dependency to the run-backend: run-backend: backend-check-build Should give us the best of both worlds 😉 |
Ahhh!!!! |
Just go for it. No worries. |
|
I added a check in your previous code and did something like this :
Should I push it ? |
Note, it has to work on windows. |
@vyncent-t Can you please test on windows? |
sure I will take a look |
This does not seem to run on windows On main I can run
|
Summary
This PR fixes a bug in which app-linux target did not automatically build the backend for the current (Host) OS which caused binary exec error due to an architecture mismatch. Now the makefile ensures that backend is built for the appropriate architecture before running the backend server
Related Issue
Fixes #3162
Changes
Steps to Test
Screenshots (if applicable)
Screencast.from.2025-07-02.19-38-57.webm
Notes for the Reviewer