Skip to contentSkip to conversation

locale supports in buildroot (segment fault)

Buildroot New Woody Wu 3 participants 4 messages Aug 22, 2013 – Aug 23, 2013 Kbuild

lore
Share & tools
lore

Woody Wu

author
#0 lore raw

Hi,

I want to build locale support for my local langauge. Then I enabled BR2_GENERATE_LOCALE="en_US zh_CN zh_CN.gbk". In the progress of building (after post-build script), it begins to report errors:

Generating locale en_US.en_US
character map file `en_US' not found: No such file or directory
/bin/sh: line 1: 7006 Segmentation fault I18NPATH=/home/woody/src/buildroot-2013.05/output/host/usr/arm-buildroot-linux-gnueabi/sysroot/usr/share/i18n:/usr/share/i18n /home/woody/src/buildroot-2013.05/output/host/usr/bin/localedef --prefix=/home/woody/src/buildroot-2013.05/output/target --`echo
"LITTLE" | tr [A-Z] [a-z]`-endian -i ${inputfile} -f ${charmap}
${locale}
Generating locale zh_CN.zh_CN
character map file `zh_CN' not found: No such file or directory
/bin/sh: line 1: 7041 Segmentation fault I18NPATH=/home/woody/src/buildroot-2013.05/output/host/usr/arm-buildroot-linux-gnueabi/sysroot/usr/share/i18n:/usr/share/i18n /home/woody/src/buildroot-2013.05/output/host/usr/bin/localedef --prefix=/home/woody/src/buildroot-2013.05/output/target --`echo
"LITTLE" | tr [A-Z] [a-z]`-endian -i ${inputfile} -f ${charmap}
${locale}
Generating locale zh_CN.gbk
character map file `gbk' not found: No such file or directory
/bin/sh: line 1: 7074 Segmentation fault I18NPATH=/home/woody/src/buildroot-2013.05/output/host/usr/arm-buildroot-linux-gnueabi/sysroot/usr/share/i18n:/usr/share/i18n /home/woody/src/buildroot-2013.05/output/host/usr/bin/localedef --prefix=/home/woody/src/buildroot-2013.05/output/target --`echo
"LITTLE" | tr [A-Z] [a-z]`-endian -i ${inputfile} -f ${charmap}
${locale}

How should I dod it correct? Thanks.

Signature · 1 line
I can't go back to yesterday - because I was a different person then
#1 lore raw

PATCH 1/1 generatelocales: fix 'cut' invocation

'cut' needs to be invoked with the -s option to make sure it doesn't print anything when the delimiter isn't found. This is particularly important for the charmap detection, because UTF-8 is appended if the charmap is empty. But without -s, it will never be empty.

---
 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Makefile +2 -2
index 794d217..6018d63 100644
@@ -543,8 +543,8 @@ ifneq ($(GENERATE_LOCALE),)
 target-generatelocales: host-localedef
 	$(Q)mkdir -p $(TARGET_DIR)/usr/lib/locale/
 	$(Q)for locale in $(GENERATE_LOCALE) ; do \
-		inputfile=`echo $${locale} | cut -f1 -d'.'` ; \
-		charmap=`echo $${locale} | cut -f2 -d'.'` ; \
+		inputfile=`echo $${locale} | cut -f1 -d'.' -s` ; \
+		charmap=`echo $${locale} | cut -f2 -d'.' -s` ; \
 		if test -z "$${charmap}" ; then \
 			charmap="UTF-8" ; \
 		fi ; \
Signature · 1 line
1.8.4.rc3
#2 lore raw

PATCH 1/1 generatelocales: fix 'cut' invocation

Dear Arnout Vandecappelle (Essensium/Mind),

Quoted 6 lines · Arnout Vandecappelle (Essensium/Mind)

'cut' needs to be invoked with the -s option to make sure it doesn't print anything when the delimiter isn't found. This is particularly important for the charmap detection, because UTF-8 is appended if the charmap is empty. But without -s, it will never be empty.

Applied, thanks.

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#3 lore raw
In reply to Woody Wu
Quoted 7 lines · Woody Wu

Hi,

I want to build locale support for my local langauge. Then I enabled BR2_GENERATE_LOCALE="en_US zh_CN zh_CN.gbk". In the progress of building (after post-build script), it begins to report errors:

Generating locale en_US.en_US

This is strange. It should generate locale for en_US.UTF-8 - the en_US
charmap obviously doesn't exist.

I see now - the cut command is missing a '-s' option. Patch follows.

Quoted 9 lines

character map file `en_US' not found: No such file or directory
/bin/sh: line 1: 7006 Segmentation fault I18NPATH=/home/woody/src/buildroot-2013.05/output/host/usr/arm-buildroot-linux-gnueabi/sysroot/usr/share/i18n:/usr/share/i18n /home/woody/src/buildroot-2013.05/output/host/usr/bin/localedef --prefix=/home/woody/src/buildroot-2013.05/output/target --`echo
"LITTLE" | tr [A-Z] [a-z]`-endian -i ${inputfile} -f ${charmap}
${locale}
Generating locale zh_CN.zh_CN
character map file `zh_CN' not found: No such file or directory

Quoted 8 lines

/bin/sh: line 1: 7041 Segmentation fault I18NPATH=/home/woody/src/buildroot-2013.05/output/host/usr/arm-buildroot-linux-gnueabi/sysroot/usr/share/i18n:/usr/share/i18n /home/woody/src/buildroot-2013.05/output/host/usr/bin/localedef --prefix=/home/woody/src/buildroot-2013.05/output/target --`echo
"LITTLE" | tr [A-Z] [a-z]`-endian -i ${inputfile} -f ${charmap}
${locale}
Generating locale zh_CN.gbk
character map file `gbk' not found: No such file or directory

Charmaps are always in capitals, so this should be GBK instead. Look in
/usr/share/i18n/charmaps.

Regards,
Arnout

Quoted 11 lines

/bin/sh: line 1: 7074 Segmentation fault I18NPATH=/home/woody/src/buildroot-2013.05/output/host/usr/arm-buildroot-linux-gnueabi/sysroot/usr/share/i18n:/usr/share/i18n /home/woody/src/buildroot-2013.05/output/host/usr/bin/localedef --prefix=/home/woody/src/buildroot-2013.05/output/target --`echo
"LITTLE" | tr [A-Z] [a-z]`-endian -i ${inputfile} -f ${charmap}
${locale}

How should I dod it correct? Thanks.

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F