Skip to content

saltyJeff/uClibcpp

Repository files navigation

A few notes:

-	Most of the uClibc++ development is done against relatively recent versions of
	GCC.  Currently that means something in the 4.2 series.  The 3 series was great,
	but has a large number of known issues.

-	If you are looking to statically compile an application, you must compile it
	without the use of either rtti or exceptions.  The library should be compiled
	likewise.  Since the application will be statically compiled, you may run a 
	dynamic library with exception support.

-	As of version 0.1.11 uClibc+ throws LOTS of warnings when compiling about inline
	functions used but never defined.  There warnings are known errors in GCC
	versions 3.3.3 3.4.0 4.0.0 4.1.0 [Bug #21627].  Either ignore these warnings or
	upgrade your compiler.  Note that these warnings will exist when compiling software
	as well as the library itself.

-	uClibc++ is not capable of bootstrapping itself.  The library depends upon some
	of the gcc support files and libstdc++ for exception support.  Linking in libsupc++
	moves all of the required code into the library so that the GNU library is no
	longer required AFTER COMPILATION.  Thus you can build uClibc++ on a development
	system against libstdc++, but when deployed you will not need any of the GNU library
	files.

-	The debugging option now has an impact on produced code.  For now it simply zeros out
	pointers used internally which should never be used, or which are considered to be
	invalidated anyways.  This will help track down bugs easier (this change was in result
	of a memory-related error).

-	The files in the tests/testoutput directory ending in good are used as reference for
	the test suite - this allows a byte-for-byte comparison of the output of the streams
	library, and so on.

Edits for Azure Sphere

I have matched cstdlib and cstdio to what is provided by the header (there is no write ability on Azure Sphere).
To install, first figure out where your SYSROOT is (mine's at 'C:\Program Files (x86)\Microsoft Azure Sphere SDK\Sysroots\2'

1. Copy all contents of the include/ folder to SYSROOT/usr/include
2. Copy al the contents of the src/ folder to your Visual Studio solution. Make sure you use Add Existing Item so VS knows
   you have the CPP files.
3. Right click your project (the purple box with the 2 + signs). In the Configuration Properties/"C/C++"/Command Line in the Additional options
box put -fno-rtti to disable RTTI support
4. Build

NOTES:

The library is not automatically included into your files (if you want to use "new" and "delete", you need to
#include <new> )

If you're not using visual studio, you can run "make menuconfig" then "make" from within WSL to build an archive. Then 
tell CMake to link against that archive file.

I couldn't find a dynamic library version of the C++ std lib mentioned anywhere so I'm betting on just linking it all statically together.
This does raise some interesting issues with licensing that I'm not qualified to address, but look up LGPL law/consult a lawyer

Example blink project that includes a lot of C++ only features can be found here:
https://github.com/saltyJeff/AzureSphereCpp