Message ID | 20240906-macos-build-support-v2-4-06beff418848@samsung.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | Enable build system on macOS hosts | expand |
On Fri, Sep 6, 2024 at 8:01 PM Daniel Gomez via B4 Relay <devnull+da.gomez.samsung.com@kernel.org> wrote: > > From: Daniel Gomez <da.gomez@samsung.com> > > endian.h header is not provided by default in macOS. Use pkg-config with > the new development package 'bee-headers' [1] to find the path where the > headers are installed. > > [1] Bee Headers Project links: > https://github.com/bee-headers/headers > https://github.com/bee-headers/homebrew-bee-headers > > It requires to install bee-headers Homebrew Tap: > > brew tap bee-headers/bee-headers > brew install bee-headers/bee-headers/bee-headers > > Signed-off-by: Daniel Gomez <da.gomez@samsung.com> > --- > arch/arm64/kernel/pi/Makefile | 1 + > arch/arm64/kernel/vdso32/Makefile | 1 + > arch/arm64/kvm/hyp/nvhe/Makefile | 3 ++- > 3 files changed, 4 insertions(+), 1 deletion(-) > > diff --git a/arch/arm64/kernel/pi/Makefile b/arch/arm64/kernel/pi/Makefile > index 4d11a8c29181..259c9a45fba0 100644 > --- a/arch/arm64/kernel/pi/Makefile > +++ b/arch/arm64/kernel/pi/Makefile > @@ -20,6 +20,7 @@ KBUILD_CFLAGS := $(filter-out $(CC_FLAGS_SCS), $(KBUILD_CFLAGS)) > KBUILD_CFLAGS := $(filter-out $(CC_FLAGS_LTO), $(KBUILD_CFLAGS)) > > hostprogs := relacheck > +HOSTCFLAGS_relacheck.o = $(shell $(HOSTPKG_CONFIG) --cflags bee-headers 2> /dev/null) > > quiet_cmd_piobjcopy = $(quiet_cmd_objcopy) > cmd_piobjcopy = $(cmd_objcopy) && $(obj)/relacheck $(@) $(<) > diff --git a/arch/arm64/kernel/vdso32/Makefile b/arch/arm64/kernel/vdso32/Makefile > index 25a2cb6317f3..6cb8a04bd829 100644 > --- a/arch/arm64/kernel/vdso32/Makefile > +++ b/arch/arm64/kernel/vdso32/Makefile > @@ -107,6 +107,7 @@ VDSO_LDFLAGS += --orphan-handling=$(CONFIG_LD_ORPHAN_WARN_LEVEL) > # $(hostprogs) with $(obj) > munge := ../../../arm/vdso/vdsomunge > hostprogs := $(munge) > +HOSTCFLAGS_$(munge).o = $(shell $(HOSTPKG_CONFIG) --cflags bee-headers 2> /dev/null) > > c-obj-vdso := note.o > c-obj-vdso-gettimeofday := vgettimeofday.o > diff --git a/arch/arm64/kvm/hyp/nvhe/Makefile b/arch/arm64/kvm/hyp/nvhe/Makefile > index b43426a493df..d20a440b6964 100644 > --- a/arch/arm64/kvm/hyp/nvhe/Makefile > +++ b/arch/arm64/kvm/hyp/nvhe/Makefile > @@ -15,7 +15,8 @@ ccflags-y += -fno-stack-protector \ > $(DISABLE_STACKLEAK_PLUGIN) > > hostprogs := gen-hyprel > -HOST_EXTRACFLAGS += -I$(objtree)/include > +HOST_EXTRACFLAGS += -I$(objtree)/include \ > + $(shell $(HOSTPKG_CONFIG) --cflags bee-headers 2> /dev/null) > > lib-objs := clear_page.o copy_page.o memcpy.o memset.o > lib-objs := $(addprefix ../../../lib/, $(lib-objs)) > > -- > 2.46.0 > > NACK. Developers working on Linux distributions have no interest in your homebrew setup. For 99% of users, pkg-config does not do anything good. It is a waste of process forks. You need to do it outside. $ HOSTCFLAGS=$(pkg-config --cflags bee-headers) make or $ export HOSTCFLAGS=$(pkg-config --cflags bee-headers) $ make
On Fri, Sep 6, 2024 at 4:03 PM Masahiro Yamada <masahiroy@kernel.org> wrote: > > On Fri, Sep 6, 2024 at 8:01 PM Daniel Gomez via B4 Relay > <devnull+da.gomez.samsung.com@kernel.org> wrote: > > > > From: Daniel Gomez <da.gomez@samsung.com> > > > > endian.h header is not provided by default in macOS. Use pkg-config with > > the new development package 'bee-headers' [1] to find the path where the > > headers are installed. > > > > [1] Bee Headers Project links: > > https://github.com/bee-headers/headers > > https://github.com/bee-headers/homebrew-bee-headers > > > > It requires to install bee-headers Homebrew Tap: > > > > brew tap bee-headers/bee-headers > > brew install bee-headers/bee-headers/bee-headers > > > > Signed-off-by: Daniel Gomez <da.gomez@samsung.com> > > --- > > arch/arm64/kernel/pi/Makefile | 1 + > > arch/arm64/kernel/vdso32/Makefile | 1 + > > arch/arm64/kvm/hyp/nvhe/Makefile | 3 ++- > > 3 files changed, 4 insertions(+), 1 deletion(-) > > > > diff --git a/arch/arm64/kernel/pi/Makefile b/arch/arm64/kernel/pi/Makefile > > index 4d11a8c29181..259c9a45fba0 100644 > > --- a/arch/arm64/kernel/pi/Makefile > > +++ b/arch/arm64/kernel/pi/Makefile > > @@ -20,6 +20,7 @@ KBUILD_CFLAGS := $(filter-out $(CC_FLAGS_SCS), $(KBUILD_CFLAGS)) > > KBUILD_CFLAGS := $(filter-out $(CC_FLAGS_LTO), $(KBUILD_CFLAGS)) > > > > hostprogs := relacheck > > +HOSTCFLAGS_relacheck.o = $(shell $(HOSTPKG_CONFIG) --cflags bee-headers 2> /dev/null) > > > > quiet_cmd_piobjcopy = $(quiet_cmd_objcopy) > > cmd_piobjcopy = $(cmd_objcopy) && $(obj)/relacheck $(@) $(<) > > diff --git a/arch/arm64/kernel/vdso32/Makefile b/arch/arm64/kernel/vdso32/Makefile > > index 25a2cb6317f3..6cb8a04bd829 100644 > > --- a/arch/arm64/kernel/vdso32/Makefile > > +++ b/arch/arm64/kernel/vdso32/Makefile > > @@ -107,6 +107,7 @@ VDSO_LDFLAGS += --orphan-handling=$(CONFIG_LD_ORPHAN_WARN_LEVEL) > > # $(hostprogs) with $(obj) > > munge := ../../../arm/vdso/vdsomunge > > hostprogs := $(munge) > > +HOSTCFLAGS_$(munge).o = $(shell $(HOSTPKG_CONFIG) --cflags bee-headers 2> /dev/null) > > > > c-obj-vdso := note.o > > c-obj-vdso-gettimeofday := vgettimeofday.o > > diff --git a/arch/arm64/kvm/hyp/nvhe/Makefile b/arch/arm64/kvm/hyp/nvhe/Makefile > > index b43426a493df..d20a440b6964 100644 > > --- a/arch/arm64/kvm/hyp/nvhe/Makefile > > +++ b/arch/arm64/kvm/hyp/nvhe/Makefile > > @@ -15,7 +15,8 @@ ccflags-y += -fno-stack-protector \ > > $(DISABLE_STACKLEAK_PLUGIN) > > > > hostprogs := gen-hyprel > > -HOST_EXTRACFLAGS += -I$(objtree)/include > > +HOST_EXTRACFLAGS += -I$(objtree)/include \ > > + $(shell $(HOSTPKG_CONFIG) --cflags bee-headers 2> /dev/null) > > > > lib-objs := clear_page.o copy_page.o memcpy.o memset.o > > lib-objs := $(addprefix ../../../lib/, $(lib-objs)) > > > > -- > > 2.46.0 > > > > > > NACK. > > Developers working on Linux distributions have no interest > in your homebrew setup. > > For 99% of users, pkg-config does not do anything good. > It is a waste of process forks. I didn't think of this, and I agree with you. > > > > You need to do it outside. > > > $ HOSTCFLAGS=$(pkg-config --cflags bee-headers) make > > or > > $ export HOSTCFLAGS=$(pkg-config --cflags bee-headers) > $ make Would a Makefile variable be suitable for this use case to make it easier in the command-line? We can detect we are in a non-linux based environment and enable a Makefile <VAR> (e.g., NOLINUX=1) and handle the NOLINUX build case (with pkg-config/bee-headers) inside the Makefiles for these non-linux cases. > > > > > > -- > Best Regards > Masahiro Yamada
On Sat, Sep 7, 2024 at 6:28 PM Daniel Gomez (Samsung) <d+samsung@kruces.com> wrote: > > On Fri, Sep 6, 2024 at 4:03 PM Masahiro Yamada <masahiroy@kernel.org> wrote: > > > > On Fri, Sep 6, 2024 at 8:01 PM Daniel Gomez via B4 Relay > > <devnull+da.gomez.samsung.com@kernel.org> wrote: > > > > > > From: Daniel Gomez <da.gomez@samsung.com> > > > > > > endian.h header is not provided by default in macOS. Use pkg-config with > > > the new development package 'bee-headers' [1] to find the path where the > > > headers are installed. > > > > > > [1] Bee Headers Project links: > > > https://github.com/bee-headers/headers > > > https://github.com/bee-headers/homebrew-bee-headers > > > > > > It requires to install bee-headers Homebrew Tap: > > > > > > brew tap bee-headers/bee-headers > > > brew install bee-headers/bee-headers/bee-headers > > > > > > Signed-off-by: Daniel Gomez <da.gomez@samsung.com> > > > --- > > > arch/arm64/kernel/pi/Makefile | 1 + > > > arch/arm64/kernel/vdso32/Makefile | 1 + > > > arch/arm64/kvm/hyp/nvhe/Makefile | 3 ++- > > > 3 files changed, 4 insertions(+), 1 deletion(-) > > > > > > diff --git a/arch/arm64/kernel/pi/Makefile b/arch/arm64/kernel/pi/Makefile > > > index 4d11a8c29181..259c9a45fba0 100644 > > > --- a/arch/arm64/kernel/pi/Makefile > > > +++ b/arch/arm64/kernel/pi/Makefile > > > @@ -20,6 +20,7 @@ KBUILD_CFLAGS := $(filter-out $(CC_FLAGS_SCS), $(KBUILD_CFLAGS)) > > > KBUILD_CFLAGS := $(filter-out $(CC_FLAGS_LTO), $(KBUILD_CFLAGS)) > > > > > > hostprogs := relacheck > > > +HOSTCFLAGS_relacheck.o = $(shell $(HOSTPKG_CONFIG) --cflags bee-headers 2> /dev/null) > > > > > > quiet_cmd_piobjcopy = $(quiet_cmd_objcopy) > > > cmd_piobjcopy = $(cmd_objcopy) && $(obj)/relacheck $(@) $(<) > > > diff --git a/arch/arm64/kernel/vdso32/Makefile b/arch/arm64/kernel/vdso32/Makefile > > > index 25a2cb6317f3..6cb8a04bd829 100644 > > > --- a/arch/arm64/kernel/vdso32/Makefile > > > +++ b/arch/arm64/kernel/vdso32/Makefile > > > @@ -107,6 +107,7 @@ VDSO_LDFLAGS += --orphan-handling=$(CONFIG_LD_ORPHAN_WARN_LEVEL) > > > # $(hostprogs) with $(obj) > > > munge := ../../../arm/vdso/vdsomunge > > > hostprogs := $(munge) > > > +HOSTCFLAGS_$(munge).o = $(shell $(HOSTPKG_CONFIG) --cflags bee-headers 2> /dev/null) > > > > > > c-obj-vdso := note.o > > > c-obj-vdso-gettimeofday := vgettimeofday.o > > > diff --git a/arch/arm64/kvm/hyp/nvhe/Makefile b/arch/arm64/kvm/hyp/nvhe/Makefile > > > index b43426a493df..d20a440b6964 100644 > > > --- a/arch/arm64/kvm/hyp/nvhe/Makefile > > > +++ b/arch/arm64/kvm/hyp/nvhe/Makefile > > > @@ -15,7 +15,8 @@ ccflags-y += -fno-stack-protector \ > > > $(DISABLE_STACKLEAK_PLUGIN) > > > > > > hostprogs := gen-hyprel > > > -HOST_EXTRACFLAGS += -I$(objtree)/include > > > +HOST_EXTRACFLAGS += -I$(objtree)/include \ > > > + $(shell $(HOSTPKG_CONFIG) --cflags bee-headers 2> /dev/null) > > > > > > lib-objs := clear_page.o copy_page.o memcpy.o memset.o > > > lib-objs := $(addprefix ../../../lib/, $(lib-objs)) > > > > > > -- > > > 2.46.0 > > > > > > > > > > NACK. > > > > Developers working on Linux distributions have no interest > > in your homebrew setup. > > > > For 99% of users, pkg-config does not do anything good. > > It is a waste of process forks. > > I didn't think of this, and I agree with you. > > > > > > > > > You need to do it outside. > > > > > > $ HOSTCFLAGS=$(pkg-config --cflags bee-headers) make > > > > or > > > > $ export HOSTCFLAGS=$(pkg-config --cflags bee-headers) > > $ make > > Would a Makefile variable be suitable for this use case to make it > easier in the command-line? HOSTCFLAGS is an environment variable. See Documentation/kbuild/kbuild.rst HOSTCFLAGS ---------- Additional flags to be passed to $(HOSTCC) when building host programs. If you do not want to type it every time, add the following to ~/.profile or ~/.bashrc, etc. export HOSTCFLAGS="$(pkg-config --cflags bee-headers) -D_UUID_T -D__GETHOSTUUID_H" Or, if you want to limit this HOSTCFLAGS definition only to a specific kernel tree, you can add GNUmakefile to wrap Makefile. This is how people often add local setups without typing a long command. GNUmakefile: export HOSTCFLAGS = $(shell pkg-config --cflags bee-headers) -D_UUID_T -D__GETHOSTUUID_H include Makefile Then, you do not need to bother the upstream kernel. > We can detect we are in a non-linux based environment and enable a > Makefile <VAR> (e.g., NOLINUX=1) and handle the NOLINUX build case > (with pkg-config/bee-headers) inside the Makefiles for these non-linux > cases. NACK. > > > > > > > > > > > > > -- > > Best Regards > > Masahiro Yamada -- Best Regards Masahiro Yamada
diff --git a/arch/arm64/kernel/pi/Makefile b/arch/arm64/kernel/pi/Makefile index 4d11a8c29181..259c9a45fba0 100644 --- a/arch/arm64/kernel/pi/Makefile +++ b/arch/arm64/kernel/pi/Makefile @@ -20,6 +20,7 @@ KBUILD_CFLAGS := $(filter-out $(CC_FLAGS_SCS), $(KBUILD_CFLAGS)) KBUILD_CFLAGS := $(filter-out $(CC_FLAGS_LTO), $(KBUILD_CFLAGS)) hostprogs := relacheck +HOSTCFLAGS_relacheck.o = $(shell $(HOSTPKG_CONFIG) --cflags bee-headers 2> /dev/null) quiet_cmd_piobjcopy = $(quiet_cmd_objcopy) cmd_piobjcopy = $(cmd_objcopy) && $(obj)/relacheck $(@) $(<) diff --git a/arch/arm64/kernel/vdso32/Makefile b/arch/arm64/kernel/vdso32/Makefile index 25a2cb6317f3..6cb8a04bd829 100644 --- a/arch/arm64/kernel/vdso32/Makefile +++ b/arch/arm64/kernel/vdso32/Makefile @@ -107,6 +107,7 @@ VDSO_LDFLAGS += --orphan-handling=$(CONFIG_LD_ORPHAN_WARN_LEVEL) # $(hostprogs) with $(obj) munge := ../../../arm/vdso/vdsomunge hostprogs := $(munge) +HOSTCFLAGS_$(munge).o = $(shell $(HOSTPKG_CONFIG) --cflags bee-headers 2> /dev/null) c-obj-vdso := note.o c-obj-vdso-gettimeofday := vgettimeofday.o diff --git a/arch/arm64/kvm/hyp/nvhe/Makefile b/arch/arm64/kvm/hyp/nvhe/Makefile index b43426a493df..d20a440b6964 100644 --- a/arch/arm64/kvm/hyp/nvhe/Makefile +++ b/arch/arm64/kvm/hyp/nvhe/Makefile @@ -15,7 +15,8 @@ ccflags-y += -fno-stack-protector \ $(DISABLE_STACKLEAK_PLUGIN) hostprogs := gen-hyprel -HOST_EXTRACFLAGS += -I$(objtree)/include +HOST_EXTRACFLAGS += -I$(objtree)/include \ + $(shell $(HOSTPKG_CONFIG) --cflags bee-headers 2> /dev/null) lib-objs := clear_page.o copy_page.o memcpy.o memset.o lib-objs := $(addprefix ../../../lib/, $(lib-objs))