Skip to contentSkip to conversation

libselinux: use correct definition of ARCH

PATCH New Vicente Olivert Riera 2 participants 6 messages Sep 16, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libselinux: use correct definition of ARCH

The Makefile of libselinux performs the following check:

ARCH := $(patsubst i%86,i386,$(shell uname -m))
ifneq (,$(filter i386,$(ARCH)))
TLSFLAGS += -mno-tls-direct-seg-refs
endif

Which means that if the host machine is an x86, then TLSFLAGS will contain -mno-tls-direct-seg-refs. That command line option causes libselinux to fail when building it for target architectures where the compiler doesn't support that option, i.e. MIPS:

mips-img-linux-gnu-gcc: error: unrecognized command line option ?-mno-tls-direct-seg-refs?

So to fix that problem we can set the ARCH variable to $(KERNEL_ARCH), and then append it to the LIBSELINUX_MAKE_OPTS.

---
 package/libselinux/libselinux.mk |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
package/libselinux/libselinux.mk +2 -1
index e6a7c6b..d4b96c4 100644
@@ -15,7 +15,8 @@ LIBSELINUX_INSTALL_STAGING = YES
 
 LIBSELINUX_MAKE_OPTS = \
 	$(TARGET_CONFIGURE_OPTS) \
-	LDFLAGS="$(TARGET_LDFLAGS) -lpcre -lpthread"
+	LDFLAGS="$(TARGET_LDFLAGS) -lpcre -lpthread" \
+	ARCH=$(KERNEL_ARCH)
 
 define LIBSELINUX_BUILD_CMDS
 	# DESTDIR is needed during the compile to compute library and
Signature · 1 line
1.7.1
#1 lore raw

PATCH 1/1 libselinux: use correct definition of ARCH

Dear Vicente Olivert Riera,

Quoted 12 lines · Vicente Olivert Riera

The Makefile of libselinux performs the following check:

ARCH := $(patsubst i%86,i386,$(shell uname -m))
ifneq (,$(filter i386,$(ARCH)))
TLSFLAGS += -mno-tls-direct-seg-refs
endif

Which means that if the host machine is an x86, then TLSFLAGS will contain -mno-tls-direct-seg-refs. That command line option causes libselinux to fail when building it for target architectures where the compiler doesn't support that option, i.e. MIPS:

Quoted 7 lines

mips-img-linux-gnu-gcc: error: unrecognized command line option ?-mno-tls-direct-seg-refs?

So to fix that problem we can set the ARCH variable to $(KERNEL_ARCH), and then append it to the LIBSELINUX_MAKE_OPTS.

Looks good to me:

I'm surprised we never caught this through the autobuilder testing, but I guess all autobuilder machines are x86_64 based, which will not exhibit the problem.

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#2 lore raw

PATCH 1/1 libselinux: use correct definition of ARCH

Dear Thomas Petazzoni,

Quoted 23 lines · Thomas Petazzoni

Dear Vicente Olivert Riera,

Quoted 12 lines · Vicente Olivert Riera

The Makefile of libselinux performs the following check:

ARCH := $(patsubst i%86,i386,$(shell uname -m))
ifneq (,$(filter i386,$(ARCH)))
TLSFLAGS += -mno-tls-direct-seg-refs
endif

Which means that if the host machine is an x86, then TLSFLAGS will contain -mno-tls-direct-seg-refs. That command line option causes libselinux to fail when building it for target architectures where the compiler doesn't support that option, i.e. MIPS:

Quoted 7 lines

mips-img-linux-gnu-gcc: error: unrecognized command line option ?-mno-tls-direct-seg-refs?

So to fix that problem we can set the ARCH variable to $(KERNEL_ARCH), and then append it to the LIBSELINUX_MAKE_OPTS.

Quoted 7 lines

Looks good to me:

I'm surprised we never caught this through the autobuilder testing, but I guess all autobuilder machines are x86_64 based, which will not exhibit the problem.

Yeah, I set a new autobuilder to run only MIPS builds since currently there aren't many autobuild failures to look at (I needed more!), and I put it on a x86 virtual machine just to also catch possible issues due to building on a 32-bit host machine, and because I already had another autobuilder running on a x86_64 host. And look, I have already catch one! :D

Thanks for the review.

Regards,

Vincent.

Quoted 4 lines

Thanks!

Thomas

#3 lore raw

PATCH 1/1 libselinux: use correct definition of ARCH

Hello,

Quoted 9 lines · Vicente Olivert Riera
Quoted 3 lines

I'm surprised we never caught this through the autobuilder testing, but I guess all autobuilder machines are x86_64 based, which will not exhibit the problem.

Yeah, I set a new autobuilder to run only MIPS builds since currently there aren't many autobuild failures to look at (I needed more!), and I put it on a x86 virtual machine just to also catch possible issues due to building on a 32-bit host machine, and because I already had another autobuilder running on a x86_64 host. And look, I have already catch one! :D

Great! Do you want an account to submit your build results automatically to autobuild.buildroot.org?

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#4 lore raw

PATCH 1/1 libselinux: use correct definition of ARCH

Hi Thomas,

Quoted 8 lines · Thomas Petazzoni

Hello,

Quoted 4 lines · Vicente Olivert Riera
Quoted 3 lines

I'm surprised we never caught this through the autobuilder testing, but I guess all autobuilder machines are x86_64 based, which will not exhibit the problem.

Quoted 8 lines
Quoted 5 lines

Yeah, I set a new autobuilder to run only MIPS builds since currently there aren't many autobuild failures to look at (I needed more!), and I put it on a x86 virtual machine just to also catch possible issues due to building on a 32-bit host machine, and because I already had another autobuilder running on a x86_64 host. And look, I have already catch one! :D

Great! Do you want an account to submit your build results automatically to autobuild.buildroot.org?

yes, please.

Thanks,

Vincent.

Quoted 4 lines

Best regards,

Thomas

#5 lore raw

PATCH 1/1 libselinux: use correct definition of ARCH

In reply to Vicente Olivert Riera

Dear Vicente Olivert Riera,

Quoted 15 lines · Vicente Olivert Riera

The Makefile of libselinux performs the following check:

ARCH := $(patsubst i%86,i386,$(shell uname -m))
ifneq (,$(filter i386,$(ARCH)))
TLSFLAGS += -mno-tls-direct-seg-refs
endif

Which means that if the host machine is an x86, then TLSFLAGS will contain -mno-tls-direct-seg-refs. That command line option causes libselinux to fail when building it for target architectures where the compiler doesn't support that option, i.e. MIPS:

mips-img-linux-gnu-gcc: error: unrecognized command line option ?-mno-tls-direct-seg-refs?

Quoted 7 lines

So to fix that problem we can set the ARCH variable to $(KERNEL_ARCH), and then append it to the LIBSELINUX_MAKE_OPTS.

---
 package/libselinux/libselinux.mk |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

Applied, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com