diff mbox

glibc and locale

Message ID 54D7F4F8.3040005@ou.edu
State Not Applicable
Headers show

Commit Message

Kenton, Stephen M. Feb. 8, 2015, 11:44 p.m. UTC
I have a script that wants the locale program. I notice that is is already built
as part of the glibc build process, but it is not installed. Would there be
any objections to something along these lines to go ahead and install locale?
I'm not sure if this is the best way since glibc build uses autotools.

Steve

Comments

Thomas Petazzoni Feb. 9, 2015, 7:09 a.m. UTC | #1
Dear Steve Kenton,

On Sun, 08 Feb 2015 17:44:56 -0600, Steve Kenton wrote:
> I have a script that wants the locale program. I notice that is is already built
> as part of the glibc build process, but it is not installed. Would there be
> any objections to something along these lines to go ahead and install locale?
> I'm not sure if this is the best way since glibc build uses autotools.

This looks ok, but I am wondering how that would be done with the
uClibc and musl C libraries. Remember that we support three different C
libraries, so when we're doing a change to one of them, we always need
to check what needs to be done for the two other ones.

Best regards,

Thomas Petazzoni
Kenton, Stephen M. Feb. 9, 2015, 2:37 p.m. UTC | #2
On 02/09/2015 01:09 AM, Thomas Petazzoni wrote:
> Dear Steve Kenton,
> 
> On Sun, 08 Feb 2015 17:44:56 -0600, Steve Kenton wrote:
>> I have a script that wants the locale program. I notice that is is already built
>> as part of the glibc build process, but it is not installed. Would there be
>> any objections to something along these lines to go ahead and install locale?
>> I'm not sure if this is the best way since glibc build uses autotools.
> 
> This looks ok, but I am wondering how that would be done with the
> uClibc and musl C libraries. Remember that we support three different C
> libraries, so when we're doing a change to one of them, we always need
> to check what needs to be done for the two other ones.
OK, I'll take a look at the other two.

Steve Kenton

> 
> Best regards,
> 
> Thomas Petazzoni
>
Kenton, Stephen M. Feb. 9, 2015, 5:50 p.m. UTC | #3
On 02/09/2015 08:37 AM, Steve Kenton wrote:
>> This looks ok, but I am wondering how that would be done with the
>> uClibc and musl C libraries. Remember that we support three different C
>> libraries, so when we're doing a change to one of them, we always need
>> to check what needs to be done for the two other ones.
> OK, I'll take a look at the other two.

The locale program source for uClibc is in extra/local/programs/locale.c

However, attempting to build it the obvious way adding another line to the build
commands in the .mk file does not work

define UCLIBC_BUILD_CMDS
	$(UCLIBC_MAKE) -C $(@D) $(UCLIBC_MAKE_FLAGS) headers
	$(UCLIBC_MAKE) -C $(@D) $(UCLIBC_MAKE_FLAGS)
+	$(UCLIBC_MAKE) -C $(@D) $(UCLIBC_MAKE_FLAGS) extra/locale/programs/locale
	$(MAKE) -C $(@D)/utils \
		PREFIX=$(HOST_DIR) \
		HOSTCC="$(HOSTCC)" hostutils
endef

It gets a build error because of the TARGET_ABI (i386 in this example) inserted by the UCLIBC_MAKE_FLAGS
immediately before i386 extra/locale/programs/locale.c on the gcc command.

Could someone familiar with the uClibc build process give me a pointer how to proceed?

Thanks,

Steve Kenton


UCLIBC_MAKE_FLAGS = \
	ARCH="$(UCLIBC_TARGET_ARCH)" \
	CROSS_COMPILE="$(TARGET_CROSS)" \
	UCLIBC_EXTRA_CFLAGS="$(UCLIBC_EXTRA_CFLAGS) $(TARGET_ABI)" \
	HOSTCC="$(HOSTCC)"

steve@Cube:/data/bcdist/test/buildroot-2015.02-rc1/output/build/uclibc-0.9.33.2$ make -n extra/locale/programs/locale
/data/bcdist/test/buildroot-2015.02-rc1/output/host/usr/bin/i586-buildroot-linux-uclibc-gcc -include ./include/libc-symbols.h -Wall -Wstrict-prototypes -Wstrict-aliasing -funsigned-char -fno-builtin -fno-asm -std=gnu99 -m32 -march=i586
-fno-stack-protector -nostdinc -I./include -I./include -I. -I./libc/sysdeps/linux -I./libc/sysdeps/linux/i386  -Os -funit-at-a-time -fmerge-all-constants -fstrict-aliasing -fno-tree-loop-optimize -fno-tree-dominator-opts -fno-strength-reduce
-fomit-frame-pointer -m32 -mpreferred-stack-boundary=2 -falign-functions=1 -falign-jumps=1 -falign-labels=1 -falign-loops=1 -DHAVE_FORCED_UNWIND -I./libpthread/nptl -I./libpthread/nptl -I./libpthread/nptl/sysdeps/unix/sysv/linux/i386/i586
-I./libpthread/nptl/sysdeps/unix/sysv/linux/i386 -I./libpthread/nptl/sysdeps/i386 -I./libpthread/nptl/sysdeps/i386 -I./libpthread/nptl/sysdeps/unix/sysv/linux -I./libpthread/nptl/sysdeps/unix/sysv/linux -I./libpthread/nptl/sysdeps/pthread
-I./libpthread/nptl/sysdeps/pthread/bits -I./libpthread/nptl/sysdeps/generic -I./ldso/ldso/i386 -I./ldso/include -I./libc/sysdeps/linux/common -I/data/bcdist/test/buildroot-2015.02-rc1/output/build/linux-headers-3.18.6/usr/include/ -isystem
/data/bcdist/test/buildroot-2015.02-rc1/output/host/usr/lib/gcc/i586-buildroot-linux-uclibc/4.8.4/include-fixed -isystem /data/bcdist/test/buildroot-2015.02-rc1/output/host/usr/lib/gcc/i586-buildroot-linux-uclibc/4.8.4/include -DNDEBUG
-D__USE_STDIO_FUTEXES__  -Wl,-EL -Wl,--sort-common -Wl,--sort-section=alignment -m32 -shared -Wl,--warn-common -Wl,--warn-once -Wl,-z,combreloc -Wl,-z,relro -Wl,-z,now -Wl,-z,defs  i386 extra/locale/programs/locale.c   -o extra/locale/programs/locale
steve@Cube:/data/bcdist/test/buildroot-2015.02-rc1/output/build/uclibc-0.9.33.2$
diff mbox

Patch

--- glibc.mk.ori	2015-02-08 17:38:16.824281939 -0600
+++ glibc.mk	2015-02-08 17:40:27.932284454 -0600
@@ -115,6 +115,7 @@  GLIBC_LIBS_LIB += libthread_db.so.*
 endif

 define GLIBC_INSTALL_TARGET_CMDS
+	$(INSTALL) -m 0755 -D $(@D)/build/locale/locale $(TARGET_DIR)/usr/bin/locale
 	for libs in $(GLIBC_LIBS_LIB); do \
 		$(call copy_toolchain_lib_root,$(STAGING_DIR)/,,lib,$$libs,/lib) ; \
 	done