-
Notifications
You must be signed in to change notification settings - Fork 691
makefile:use local gcc when native compiling #3774
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: master
Are you sure you want to change the base?
Conversation
d25f2e7
to
c9e4d80
Compare
The idea is OK, but it should not need an extra variable to be set... Maybe check |
can you describe clearly ? thanks @afbjorklund |
We should be able to detect when doing a cross-compile, without requiring that information from the user? The main issue is that the format of Most Linux distributions feature both, so it has not been a problem. i.e. both |
Ah, we already have some handy variables to use: # returns difference between GOOS GOARCH and GOHOSTOS GOHOSTARCH.
cross_compiling = $(call diff,$(GOOS) $(GOARCH),$(GOHOSTOS) $(GOHOSTARCH))
# returns true if cross_compiling is empty.
native_compiling = $(if $(cross_compiling),,true) We don't need to set anything, for a native build. i.e. there is no need to hardcode |
how about
my host doesn't have x86_64-linux-gnu-gcc |
If your host needs something special, you can override
But you can simplify it to: ifeq ($(cross_compiling),true)
# CC is required for cross-compiling on Linux.
CC = $(call to_uname_m,$(GOARCH))-linux-gnu-gcc
endif Might need to move the declarations in the file, though. EDIT: typo |
Signed-off-by: ningmingxiao <ning.mingxiao@zte.com.cn>
c9e4d80
to
f93ccdd
Compare
done, thank you. |
Tests are failing, so the new test is not working properly. |
The cross_compiling variable is empty when false (and the diff, when true), unlike native_compiling <sigh> +ifneq ($(cross_compiling),)
# CC is required for cross-compiling on Linux.
CC = $(call to_uname_m,$(GOARCH))-linux-gnu-gcc
+endif |
fix