From e46758e2d36e4856cb620687f3c713aafd05ec3c Mon Sep 17 00:00:00 2001 From: patacongo Date: Thu, 1 Nov 2012 13:45:30 +0000 Subject: Fix uClibc++ wstrlen bug git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5289 42af7a65-404d-4744-a932-0658087f49c3 --- misc/uClibc++/README.txt | 224 ++++++++++++++++------------- misc/uClibc++/include/uClibc++/char_traits | 2 +- misc/uClibc++/libxx/uClibc++/Make.defs | 4 +- 3 files changed, 127 insertions(+), 103 deletions(-) (limited to 'misc/uClibc++') diff --git a/misc/uClibc++/README.txt b/misc/uClibc++/README.txt index 83b4c13f9..6fedcb67f 100755 --- a/misc/uClibc++/README.txt +++ b/misc/uClibc++/README.txt @@ -1,100 +1,124 @@ -misc/uClib++ README -^^^^^^^^^^^^^^^^^^^ - -This directory contains a version of the uClibc++ C++ library. This code -originates from http://cxx.uclibc.org/ and has been adapted for NuttX by the -RGMP team (http://rgmp.sourceforge.net/wiki/index.php/Main_Page). - -uClibc++ resides in the misc/ directory rather than in the main NuttX source -tree due to licensing issues: NuttX is licensed under the permissiv - modified BSD License; uClibc, on the other hand, islicensed under the - stricter GNU LGPL Version 3 license. - -Installation of uClibc++ -^^^^^^^^^^^^^^^^^^^^^^^^ - -If you wish to use uClibc++ with NuttX, you will be required to comply with -the licensing requires of the GNU LGPL Version 3 license. A simple -installation script is provided at misc/uClibc++/install.sh that can be used -to install the uClibc++ components into the NuttX source tree. - -The install script takes only a single arguement: The path to the nuttx -directory. If your directory structure is the same as the SVN structure -(with misc/ and nuttx/ at the same level), then uClibc++ can be installed -using this command executed from the misc/uClibc++ directory: - - ./install.sh ../../nuttx - -If you run the install.sh like this, then it will (1) make sure you -understand that you have tainted the NuttX BSD license with LGPLv3, and (2) -copy the uClibc++ sources files into nuttx/libxx/uClibc++, include/, and -include/uClibc++. - -Make.defs File Changes -^^^^^^^^^^^^^^^^^^^^^^ - -The new files that appear in nuttx/include/uClibc++ must be include-able -as system header files. So you will need to add 'isystem $(TOPDIR)/include/uClibc++' -to the ARCHINCLUDESXX definition in the NuttX Make.defs file, perhap like: - - -ARCHINCLUDESXX = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx - +ARCHINCLUDESXX = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx -isystem $(TOPDIR)/include/uClibc++ - -And, of course, you no long need to suppress exceptions or run-time typing: - - -ARCHCPUFLAGSXX = -fno-builtin -fno-exceptions -fno-rtti - +ARCHCPUFLAGSXX = -fno-builtin - -Building NuttX with uClibc++ -^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -After installing uClibc++ in this way, no additional steps should be -required to build NuttX with the uClibc++ library incorporated: - - $ cd ../../nuttx - $ . ./setenv.sh - $ make - -Here is how it works: - -There is a new file called Make.defs in misc/uClibc/libxx/uClibc++. After -installation, it will reside at nuttx/libxx/uClibc++. The -nuttx/libxx/Makefile will (conditionally) include this Make.defs file: - --include uClibc++/Make.defs - -This Make.defs file, if present, will add the uClibc++ source files to the -build, add the uClibc++ subdirectory to the dependency list, and add the -uClibc++ subdirectory to the VPATH. That should, in principle, be all it -takes. - -Dependencies -^^^^^^^^^^^^ - -In order to build libxx (and hence libxx/uClibc++), CONFIG_HAVE_CXX must be -defined in your NuttX configuration file. - -The C++ runtime support is provided by GCC libgcc_eh.a and libsupc++.a -libraries. - -RGMP -^^^^ - -The target platform is RGMP X86, it is also updated for TLS support which is -needed by these two libraries. So application can also use TLS on RGMP NuttX -port. - -Command to compile and install RGMP: - - $ make - $ make install - $ /usr/rgmp/setup - $ exit - -Command to compile and run NUTTX: - - $ cd nuttx/tools - $ ./configure rgmp/x86/cxxtest - $ cd .. - $ make - $ rgmp_run +misc/uClib++ README +^^^^^^^^^^^^^^^^^^^ + +This directory contains a version of the uClibc++ C++ library. This code +originates from http://cxx.uclibc.org/ and has been adapted for NuttX by the +RGMP team (http://rgmp.sourceforge.net/wiki/index.php/Main_Page). + +uClibc++ resides in the misc/ directory rather than in the main NuttX source +tree due to licensing issues: NuttX is licensed under the permissiv + modified BSD License; uClibc, on the other hand, islicensed under the + stricter GNU LGPL Version 3 license. + +Installation of uClibc++ +^^^^^^^^^^^^^^^^^^^^^^^^ + +If you wish to use uClibc++ with NuttX, you will be required to comply with +the licensing requires of the GNU LGPL Version 3 license. A simple +installation script is provided at misc/uClibc++/install.sh that can be used +to install the uClibc++ components into the NuttX source tree. + +The install script takes only a single arguement: The path to the nuttx +directory. If your directory structure is the same as the SVN structure +(with misc/ and nuttx/ at the same level), then uClibc++ can be installed +using this command executed from the misc/uClibc++ directory: + + ./install.sh ../../nuttx + +If you run the install.sh like this, then it will (1) make sure you +understand that you have tainted the NuttX BSD license with LGPLv3, and (2) +copy the uClibc++ sources files into nuttx/libxx/uClibc++, include/, and +include/uClibc++. + +Dependencies +^^^^^^^^^^^^ + +1. The C++ runtime support is provided by GCC libgcc_eh.a and libsupc++.a + libraries. +2. NuttX C++ support +3. Math library +4. TLS support is currenly provided only under RGMP + +NuttX Configuration File Changes +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +In order to build libxx (and hence libxx/uClibc++), C++ support must be +enabled. The following must be defined in your NuttX configuration file. + + CONFIG_HAVE_CXX=y + +There are many ways to provide math library support (see nuttx/README.txt). +If you choose to use the NuttX math library, that is enabled as follows: + + + CONFIG_LIBM=y + +The math libraries depend on the float.h header file that is normally +provided by your tooltchain. A dummy (and probably wrong) fload.h file +can be installed by setting: + + CONFIG_ARCH_FLOAT_H=y + +Make.defs File Changes +^^^^^^^^^^^^^^^^^^^^^^ + +The new files that appear in nuttx/include/uClibc++ must be include-able +as system header files. So you will need to add 'isystem $(TOPDIR)/include/uClibc++' +to the ARCHINCLUDESXX definition in the NuttX Make.defs file, perhap like: + + -ARCHINCLUDESXX = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx + +ARCHINCLUDESXX = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx -isystem $(TOPDIR)/include/uClibc++ + +And, of course, you no long need to suppress exceptions or run-time typing: + + -ARCHCPUFLAGSXX = -fno-builtin -fno-exceptions -fno-rtti + +ARCHCPUFLAGSXX = -fno-builtin + + +I create the nuttx/configs/rgmp/x86/cxxtest/Make.def, add the two libs to EXTRA_LIBS to be linked +to NUTTX. The code. + +Building NuttX with uClibc++ +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +After installing uClibc++ in this way, no additional steps should be +required to build NuttX with the uClibc++ library incorporated: + + $ cd ../../nuttx + $ . ./setenv.sh + $ make + +Here is how it works: + +There is a new file called Make.defs in misc/uClibc/libxx/uClibc++. After +installation, it will reside at nuttx/libxx/uClibc++. The +nuttx/libxx/Makefile will (conditionally) include this Make.defs file: + +-include uClibc++/Make.defs + +This Make.defs file, if present, will add the uClibc++ source files to the +build, add the uClibc++ subdirectory to the dependency list, and add the +uClibc++ subdirectory to the VPATH. That should, in principle, be all it +takes. + +RGMP +^^^^ + +The target platform is RGMP X86, it is also updated for TLS support which is +needed by these two libraries. So application can also use TLS on RGMP NuttX +port. + +Command to compile and install RGMP: + + $ make + $ make install + $ /usr/rgmp/setup + $ exit + +Command to compile and run NUTTX: + + $ cd nuttx/tools + $ ./configure rgmp/x86/cxxtest + $ cd .. + $ make + $ rgmp_run diff --git a/misc/uClibc++/include/uClibc++/char_traits b/misc/uClibc++/include/uClibc++/char_traits index 0f01d2e5d..d09de41b6 100644 --- a/misc/uClibc++/include/uClibc++/char_traits +++ b/misc/uClibc++/include/uClibc++/char_traits @@ -108,7 +108,7 @@ namespace std{ } inline static size_t length(const char_type* s){ - return wstrlen(s); + return strlen(s); } static const char_type* find(const char_type* s, int n, const char_type& a); diff --git a/misc/uClibc++/libxx/uClibc++/Make.defs b/misc/uClibc++/libxx/uClibc++/Make.defs index 38ae24a93..9f1b2f51f 100644 --- a/misc/uClibc++/libxx/uClibc++/Make.defs +++ b/misc/uClibc++/libxx/uClibc++/Make.defs @@ -38,7 +38,7 @@ CXXSRCS += algorithm.cxx associative_base.cxx bitset.cxx char_traits.cxx CXXSRCS += complex.cxx del_op.cxx del_opnt.cxx del_opv.cxx del_opvnt.cxx CXXSRCS += deque.cxx eh_alloc.cxx eh_globals.cxx exception.cxx -CXXSRCS += stream.cxx func_exception.cxx iomanip.cxx ios.cxx +CXXSRCS += fstream.cxx func_exception.cxx iomanip.cxx ios.cxx CXXSRCS += iostream.cxx istream.cxx iterator.cxx limits.cxx list.cxx CXXSRCS += locale.cxx map.cxx new_handler.cxx new_op.cxx new_opnt.cxx CXXSRCS += new_opv.cxx new_opvnt.cxx numeric.cxx ostream.cxx queue.cxx @@ -48,5 +48,5 @@ CXXSRCS += vector.cxx # Add the path to the uClibc++ subdirectory -DEPPATH += --dep-path . +DEPPATH += --dep-path uClibc++ VPATH += uClibc++ -- cgit v1.2.3