This is the mail archive of the crossgcc@sourceware.org mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Crosstool-NG: WCHAR-support in uClibc-toolchain


2009/10/28 Yann E. MORIN <yann.morin.1998@anciens.enib.fr>:

> Yes, this is a known 'issue'. There is a kind of plan to have buildroot
> rely on crosstool-NG to build its toolchain, so we'd end up with the
> same issue, and the idea was to make crosstol-NG expose its configuration
> so buildroot can act accordingly (enable/disable things).

Ah, okay...I saw Thomas Petazzoni's patches to better support external
toolchains. Buildroot currently only checks, if some values of the
uclibc-configuration from the crosstool-ng toolchain differs from the
values in buildroot-configuration.
( http://git.buildroot.net/buildroot/commit/?id=9456b58a8b3b4efdd8038a68370acf618aa9465b
)

So, in a next step buildroot would have to not only check those
values, but read them into its own configuration...but this is
buildroot-related stuff.


> As far as I remember, the g++ would not build if wchar was missing in the
> C library. But things may have changed, and this may work now. YMMV.

I'm fairly inexperienced in toolchain-creation, but I successfully
build several uclibc-toolchains with g++ (i386, powerpc) without wchar
(and locales-support). So it seems to be unneeded nowadays ;)

although, wchar is required for locales support:
http://git.buildroot.net/buildroot/commit/?id=27ce942e6536174a9fa6f5dd13f87d52bca0950c


> The uClibc config file is there for a purpose: so the user can set options.
> I would rather not duplicate the config menu from uClibc, and leave up to
> the user to give an appropriate config file.

Something like "ct-ng uclibc-menuconfig" would be very useful in that case...


> But OTOH, there's already an option to enable/disable locales in uClibc.

With the attached patch I added a "enable/disable wchar" entry in
ct-ng. That solves my problem for now...

...as I'm using buildroot, I've done it the buildroot-way (take a
uclibc-configuration and override some values important for other
packages)

I think this would be a good solution for ct-ng too. Take a
uclibc-configuration and override values, important for other parts of
the toolchain-creation via kconfig-select. In this scenario it's
transparent for the user, what settings are used in the resulting
toolchain, as it is all defined via menuconfig.

So, if wchar would be needed by c++ the following patch would be
sufficient, to select wchar.

diff -Naur plain/crosstool-ng-1.5.1/config/cc.in crosstool-ng-1.5.1/config/cc.in
--- plain/crosstool-ng-1.5.1/config/cc.in	2009-10-28 19:43:37.000000000 +0100
+++ crosstool-ng-1.5.1/config/cc.in	2009-11-06 15:15:23.000000000 +0100
@@ -35,6 +35,7 @@
     prompt "C++"
     default n
     depends on CC_SUPPORT_CXX
+    select LIBC_UCLIBC_WCHAR if (LIBC_uClibc)
     help
       Enable building a C++ compiler.


What do you think about making those hardcoded defines in
scripts/build/libc/uClibc.sh visible in menuconfig in the next step?

regards

Simon Pasch
diff -Naur plain/crosstool-ng-1.5.1/config/libc/uClibc.in crosstool-ng-1.5.1/config/libc/uClibc.in
--- plain/crosstool-ng-1.5.1/config/libc/uClibc.in	2009-10-28 19:43:37.000000000 +0100
+++ crosstool-ng-1.5.1/config/libc/uClibc.in	2009-11-06 10:57:17.000000000 +0100
@@ -152,9 +152,19 @@
 
 config LIBC_UCLIBC_LOCALES
     bool
+    select LIBC_UCLIBC_WCHAR
     prompt "Add support for locales"
     default n
     help
       Say y if you want uClibc to support localisation.
 
       Note that seems to be broken on recent uClibc releases.
+
+config LIBC_UCLIBC_WCHAR
+    bool
+    prompt "Add support for WCHAR"
+    default n
+    help
+      Say y if you want uClibc to support WCHAR.
+
+      Maybe this is needed, if you're building a C++-Compiler
diff -Naur plain/crosstool-ng-1.5.1/scripts/build/libc/uClibc.sh crosstool-ng-1.5.1/scripts/build/libc/uClibc.sh
--- plain/crosstool-ng-1.5.1/scripts/build/libc/uClibc.sh	2009-10-28 19:43:37.000000000 +0100
+++ crosstool-ng-1.5.1/scripts/build/libc/uClibc.sh	2009-11-06 11:47:24.000000000 +0100
@@ -292,14 +292,23 @@
 ENDSED
     fi
 
+    # WCHAR support
+    if [ "${CT_LIBC_UCLIBC_WCHAR}" = "y" ] ; then
+       cat >>"${munge_file}" <<-ENDSED
+s/^.*UCLIBC_HAS_WCHAR.*/UCLIBC_HAS_WCHAR=y/
+ENDSED
+    else
+       cat >>"${munge_file}" <<-ENDSED
+s/^.*UCLIBC_HAS_WCHAR.*/UCLIBC_HAS_WCHAR=n/
+ENDSED
+    fi
+
     # Force on options needed for C++ if we'll be making a C++ compiler.
     # I'm not sure locales are a requirement for doing C++... Are they?
     if [ "${CT_CC_LANG_CXX}" = "y" ]; then
         cat >>"${munge_file}" <<-ENDSED
 s/^# DO_C99_MATH is not set/DO_C99_MATH=y/
 s/^# UCLIBC_CTOR_DTOR is not set/UCLIBC_CTOR_DTOR=y/
-# Add these three lines when doing C++?
-s/^# UCLIBC_HAS_WCHAR is not set/UCLIBC_HAS_WCHAR=y/
 #s/^# UCLIBC_HAS_LOCALE is not set/UCLIBC_HAS_LOCALE=y\\nUCLIBC_PREGENERATED_LOCALE_DATA=y\\n\\# UCLIBC_DOWNLOAD_PREGENERATED_LOCALE_DATA is not set\\n\\# UCLIBC_HAS_XLOCALE is not set/
 s/^# UCLIBC_HAS_GNU_GETOPT is not set/UCLIBC_HAS_GNU_GETOPT=y/
 ENDSED
--
For unsubscribe information see http://sourceware.org/lists.html#faq

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]