1*c2c66affSColin Finck Content 2*c2c66affSColin Finck 3*c2c66affSColin FinckQ1 About STLport and availability 4*c2c66affSColin Finck 5*c2c66affSColin FinckQ1.0 What is STLport? 6*c2c66affSColin FinckQ1.1 What are the benefits from using STLport? 7*c2c66affSColin FinckQ1.2 What versions of STLport are available? 8*c2c66affSColin FinckQ1.3 Where is the documentation or user guide? 9*c2c66affSColin FinckQ1.4 What is the version policy? 10*c2c66affSColin Finck 11*c2c66affSColin FinckQ2 General 12*c2c66affSColin Finck 13*c2c66affSColin FinckQ2.0 Do I need a C++ compiler? 14*c2c66affSColin FinckQ2.1 Do I need runtime libraries from C++ compiler? 15*c2c66affSColin FinckQ2.2 Can I use containers and algorithms from STLport and iostreams from 16*c2c66affSColin Fincklibrary that ship with my compiler? 17*c2c66affSColin FinckQ2.3 Can I mix STL implementations in my project? 18*c2c66affSColin FinckQ2.4 When I switch to STLport in my application, I get errors. Is STLport 19*c2c66affSColin Finckso bad? 20*c2c66affSColin Finck 21*c2c66affSColin FinckQ3 Building 22*c2c66affSColin Finck 23*c2c66affSColin FinckQ3.0 On my XXXX Linux n.n g++ headers are in /usr/include/g++, but they 24*c2c66affSColin Finckare looked for in /usr/include/3.3.1. Is it a STLport bug? 25*c2c66affSColin FinckQ3.1 Do I need to build library to use STLport? 26*c2c66affSColin FinckQ3.2 During library compilation with MS VC++ 6.0 I see following error report:... 27*c2c66affSColin FinckQ3.3 Has anybody succeeded building STLport on OS Y with compiler K n.n? 28*c2c66affSColin FinckQ3.4 Does STLport support cross-compilation? 29*c2c66affSColin Finck 30*c2c66affSColin FinckQ4 Installation 31*c2c66affSColin Finck 32*c2c66affSColin FinckQ4.1 I tried "make -f gcc.mak install", but it install nothing into 33*c2c66affSColin Finck/usr/local/. How I can install headers into /usr/local/include and 34*c2c66affSColin Fincklibs into /usr/local/lib? 35*c2c66affSColin Finck 36*c2c66affSColin FinckQ5 Bug report 37*c2c66affSColin Finck 38*c2c66affSColin FinckQ5.0 I found a bug, how can I report about it? 39*c2c66affSColin Finck 40*c2c66affSColin FinckQ6 Design 41*c2c66affSColin Finck 42*c2c66affSColin FinckQ6.0 In STLport, files like locale.h, setjmp.h, stdlib.h, etc., 43*c2c66affSColin Finckdo nothing except include native headers. Why are these files present in STLport? 44*c2c66affSColin FinckQ6.1 Is STLport a replacement for headers and libraries that shipout 45*c2c66affSColin Finckwith compiler? 46*c2c66affSColin FinckQ6.2 My tool detects memory leaks in applications with STLport. Is this leak 47*c2c66affSColin Finckfrom STLport? 48*c2c66affSColin FinckQ6.3 When running unit tests, I have errors in LocaleTest test fixture, how bad 49*c2c66affSColin Finckis it? 50*c2c66affSColin FinckQ6.4 set or multiset iterators are immutable like const_iterators, why ? 51*c2c66affSColin Finck 52*c2c66affSColin Finck Answers 53*c2c66affSColin Finck 54*c2c66affSColin Finck======================================================================== 55*c2c66affSColin Finck 56*c2c66affSColin FinckQ1.0 What is STLport? 57*c2c66affSColin FinckA1.0 STLport is an implementation of the C++ Standard Library, as described 58*c2c66affSColin Finckin the INTERNATIONAL STANDARD ISO/IEC 14882:1998(E) and latest 59*c2c66affSColin FinckISO/IEC 14882:2003(E). 60*c2c66affSColin Finck 61*c2c66affSColin Finck======================================================================== 62*c2c66affSColin Finck 63*c2c66affSColin FinckQ1.1 What are the benefits from using STLport? 64*c2c66affSColin Finck 65*c2c66affSColin FinckA1.1 66*c2c66affSColin Finck - For multiplatform/multicompilers project a coherent Standard Library 67*c2c66affSColin Finckimplementation. 68*c2c66affSColin Finck - An easy to use STL safe mode detecting bad use of containers and 69*c2c66affSColin Finckiterators. 70*c2c66affSColin Finck - Some original optimizations: template expression for string 71*c2c66affSColin Finckconcatenation, short string optimization, move semantic for STL containers 72*c2c66affSColin Finckcombination like vector of vector, an efficient std::allocator. 73*c2c66affSColin Finck 74*c2c66affSColin Finck======================================================================== 75*c2c66affSColin Finck 76*c2c66affSColin FinckQ1.2 What versions of STLport are available? 77*c2c66affSColin Finck 78*c2c66affSColin FinckA1.2 79*c2c66affSColin Finck 80*c2c66affSColin Finck======================================================================== 81*c2c66affSColin Finck 82*c2c66affSColin FinckQ1.3 Where is the user guide? 83*c2c66affSColin Finck 84*c2c66affSColin FinckA1.3 There is no real user guide for the moment. You can find some information 85*c2c66affSColin Finckin README files in doc folder. As STLport is a C++ Standard library 86*c2c66affSColin Finckimplementation you might find information you need at the following 87*c2c66affSColin Fincklocations: 88*c2c66affSColin Finck - The ISO/IEC 14882:2003 document you can buy for a very cheap price. 89*c2c66affSColin Finck - For STL containers you can use SGI documentation (http://www.sgi.com/tech/stl/). 90*c2c66affSColin Finck Beware however, STL described in this document is not identical to the 91*c2c66affSColin Finck Standardized version described in ISO/IEC. This documentation can be very 92*c2c66affSColin Finck useful for STLport extensions like hash containers (hash_map, hash_set...) 93*c2c66affSColin Finck - You can also use the documentation coming with your compiler as most 94*c2c66affSColin Finck of the information will also apply to STLport. Take care to description 95*c2c66affSColin Finck reported as 'implementation specific'. 96*c2c66affSColin Finck 97*c2c66affSColin Finck======================================================================== 98*c2c66affSColin Finck 99*c2c66affSColin FinckQ1.4 What is the version policy? 100*c2c66affSColin Finck 101*c2c66affSColin FinckA1.4 STLport version information contains three numbers like '5.1.0'. '5' 102*c2c66affSColin Finckis the major version number, '1' is the minor and '0' is the patch level. 103*c2c66affSColin FinckPolicy for this numbers are: 104*c2c66affSColin Finck - changes in major version number: radical modification, new era. 105*c2c66affSColin Finck - changes in minor version number: significant changes, new features, 106*c2c66affSColin Finck changes in interface part; switching to an STLport library with a different 107*c2c66affSColin Finck minor version require recompilation of all modules depending on it. 108*c2c66affSColin Finck - changes in patch level: bugfixes; we keep in mind binary compatibility, 109*c2c66affSColin Finck but really can't strongly guarantee it; switching to an STLport library 110*c2c66affSColin Finck with different patch level do not require rebuild of modules---rebuilding and 111*c2c66affSColin Finck installing the STLport libraries should work; however, as STLport contains 112*c2c66affSColin Finck a lot of template code, you should pay attention to fact that all you modules 113*c2c66affSColin Finck was build with SAME STLport headers---otherwise problems possible; 114*c2c66affSColin Finck recompilation of one part with only rebuilding STLport might not be enough 115*c2c66affSColin Finck to get all the fixes in your application so even in this case rebuilding 116*c2c66affSColin Finck your modules is advised. 117*c2c66affSColin Finck 118*c2c66affSColin Finck======================================================================== 119*c2c66affSColin Finck 120*c2c66affSColin Finck 121*c2c66affSColin FinckQ2.0 Do I need a C++ compiler? 122*c2c66affSColin Finck 123*c2c66affSColin FinckA2.0 STLport is a C++ library. So the answer is 'yes, you do'. 124*c2c66affSColin Finck 125*c2c66affSColin Finck======================================================================== 126*c2c66affSColin Finck 127*c2c66affSColin FinckQ2.1 Do I need runtime libraries from C++ compiler? 128*c2c66affSColin Finck 129*c2c66affSColin FinckA2.1 In any case, the C++ language support from compiler is required 130*c2c66affSColin Finckfor STLport (operators new, delete, RTTI, exceptions support). That's why 131*c2c66affSColin Finckin most cases you need some runtime libraries from the C++ compiler. 132*c2c66affSColin Finck 133*c2c66affSColin Finck======================================================================== 134*c2c66affSColin Finck 135*c2c66affSColin FinckQ2.2 Can I use containers and algorithms from STLport and iostreams from 136*c2c66affSColin Finckthe library that ships with my compiler? 137*c2c66affSColin Finck 138*c2c66affSColin FinckA2.2 The short answer is 'No'. 139*c2c66affSColin Finck 140*c2c66affSColin FinckIndeed co-existence of two implementations possible, but this required 141*c2c66affSColin Fincka lot of knowledge as about both implementations, as about compiler and 142*c2c66affSColin Fincklinkage. This issues should be taken into account both within STL library and 143*c2c66affSColin Finckduring library usage. In common you can't use both implementation 144*c2c66affSColin Finckin the same namespace. So you should separate STL implementations into 145*c2c66affSColin Finckdifferent namespaces. But due to absent of compilers that has full-featured 146*c2c66affSColin Fincksupport of Argument Dependent Lookup (ADL) (aka Koenig Lookup), you have no 147*c2c66affSColin Finckpossibilty to select one or another implementation. 148*c2c66affSColin Finck 149*c2c66affSColin FinckADL problem. 150*c2c66affSColin Finck 151*c2c66affSColin FinckIn wrapper mode, all std references are replaced, thanks a simple macro, 152*c2c66affSColin Finckby the stlp_std namespace. Everything from the native compiler std namespace 153*c2c66affSColin Finckis injected to the stlp_std namespace with many using std::* directives. 154*c2c66affSColin Finck 155*c2c66affSColin FinckThe problem arise when you specialized a standard class for one of your 156*c2c66affSColin Finckuser types. You do it within the std namespace that, in wrapper mode 157*c2c66affSColin Finckbecomes the stlp_std namespace. Then this specialization is just invisible 158*c2c66affSColin Finckfrom the native std namespace and won't be used. 159*c2c66affSColin Finck 160*c2c66affSColin FinckThings are somewhat worse: the problem arises even without any explicit 161*c2c66affSColin Finckspecializations. It is not a bug, but the fact that old compilers just 162*c2c66affSColin Finckdid not tried to find functions in the namespaces where arguments' classes 163*c2c66affSColin Finckare defined (indeed no compilers with full-featured support of ADL yet). 164*c2c66affSColin Finck 165*c2c66affSColin FinckMix implementation via library. 166*c2c66affSColin Finck 167*c2c66affSColin FinckLet's reduce all the complexity of STLport to some very simple example: 168*c2c66affSColin Finck 169*c2c66affSColin Fincknamespace std { 170*c2c66affSColin Finck 171*c2c66affSColin Finckclass string 172*c2c66affSColin Finck{ 173*c2c66affSColin Finck public: 174*c2c66affSColin Finck class iterator { }; 175*c2c66affSColin Finck 176*c2c66affSColin Finck iterator begin(); 177*c2c66affSColin Finck iterator end(); 178*c2c66affSColin Finck}; 179*c2c66affSColin Finck 180*c2c66affSColin Fincktemplate<class I, class T> 181*c2c66affSColin Finckvoid find(I begin, I end, T value); 182*c2c66affSColin Finck 183*c2c66affSColin Finck} // namespace std 184*c2c66affSColin Finck 185*c2c66affSColin Finck 186*c2c66affSColin Fincknamespace stlport { 187*c2c66affSColin Finck 188*c2c66affSColin Finckusing std::string; 189*c2c66affSColin Finck 190*c2c66affSColin Fincktemplate<class I, class T> 191*c2c66affSColin Finckvoid find(I begin, I end, T value); 192*c2c66affSColin Finck 193*c2c66affSColin Finckvoid gee() 194*c2c66affSColin Finck{ 195*c2c66affSColin Finck string s; 196*c2c66affSColin Finck find(s.begin(), s.end(), 10); 197*c2c66affSColin Finck} 198*c2c66affSColin Finck 199*c2c66affSColin Finck} // namespace stlport 200*c2c66affSColin Finck 201*c2c66affSColin Finck 202*c2c66affSColin FinckWhen a compiler supporting ADL finds the call to `find' within gee() function 203*c2c66affSColin Finckit should examine both namespace `stlport' and namespace `std' for 204*c2c66affSColin Finckthe presence of `find'. It is caused by the fact that s.begin() returns 205*c2c66affSColin Finckobject of type `std::string::iterator' which obviously defined in namespace 206*c2c66affSColin Finck`std' and the heart of ADL is finding functions not only within namespaces 207*c2c66affSColin Finckwhere the call is being made but also in the namespaces where the classes 208*c2c66affSColin Finckof arguments are defined... 209*c2c66affSColin Finck 210*c2c66affSColin FinckSo, in our example compiler ends with two templates satisfying the call 211*c2c66affSColin Finck`find(s.begin(), s.end(), 10)': `std::find' and `stlport::find'. 212*c2c66affSColin FinckSince compiler can not choose any one of them it reports ambiguity. 213*c2c66affSColin Finck 214*c2c66affSColin FinckThere is another aspect of mix implementations. 215*c2c66affSColin FinckLet's consider following code: 216*c2c66affSColin Finck 217*c2c66affSColin Fincka.h: 218*c2c66affSColin Finck 219*c2c66affSColin Finck#include <string> 220*c2c66affSColin Finck 221*c2c66affSColin Finckclass A { 222*c2c66affSColin Finck public: 223*c2c66affSColin Finck A() {} 224*c2c66affSColin Finck 225*c2c66affSColin Finck void push( const string s ); 226*c2c66affSColin Finck 227*c2c66affSColin Finck string _str; 228*c2c66affSColin Finck}; 229*c2c66affSColin Finck 230*c2c66affSColin Fincka.cpp: 231*c2c66affSColin Finck 232*c2c66affSColin Finck#include "a.h" 233*c2c66affSColin Finck 234*c2c66affSColin Finckvoid A::push( const string s ) 235*c2c66affSColin Finck{ 236*c2c66affSColin Finck _str = s; 237*c2c66affSColin Finck} 238*c2c66affSColin Finck 239*c2c66affSColin Finck 240*c2c66affSColin Finckb.cpp: 241*c2c66affSColin Finck 242*c2c66affSColin Finck#include "a.h" 243*c2c66affSColin Finck 244*c2c66affSColin Finckstring s; 245*c2c66affSColin FinckA a; 246*c2c66affSColin Finck 247*c2c66affSColin Finckvoid gee() 248*c2c66affSColin Finck{ 249*c2c66affSColin Finck a.push( s ); 250*c2c66affSColin Finck} 251*c2c66affSColin Finck 252*c2c66affSColin FinckNow build library from a.cpp with string implementation Impl1; 253*c2c66affSColin Finckthen build application with b.cpp that use string implementation Impl2, 254*c2c66affSColin Finckand link with mentioned above library. Compiler will pass. Linker may 255*c2c66affSColin Finckpass too. But your application will crash (or randomly crash) either on 256*c2c66affSColin Finckcall a.push, or on assignment _str = s. This is evident here, but not 257*c2c66affSColin Finckevident in real applications. 258*c2c66affSColin Finck 259*c2c66affSColin FinckThe conclusion is: "Using Wrapper mode is very hard and we removed support 260*c2c66affSColin Finckfor it". 261*c2c66affSColin Finck 262*c2c66affSColin Finck======================================================================== 263*c2c66affSColin Finck 264*c2c66affSColin FinckQ2.3 Can I mix STL implementations in my project? 265*c2c66affSColin Finck 266*c2c66affSColin FinckA2.3 Yes you can but each implementations will rely in its own namespace 267*c2c66affSColin Finckwith no direct interaction between them. You will first need to correctly 268*c2c66affSColin Finckconfigure STLport thanks to 2 macros in user_config.h file. 269*c2c66affSColin Finck- _STLP_DONT_REDEFINE_STD tells STLport not to define the std macro that is 270*c2c66affSColin Finckused to replace std reference in your code with STLport namespace. 271*c2c66affSColin Finck- _STLP_WHOLE_NATIVE_STD tells STLport to always include native header each 272*c2c66affSColin Fincktime a Standard header is included in your code. 273*c2c66affSColin Finck 274*c2c66affSColin FinckHere is a small code sample that do not require any modification in STLport 275*c2c66affSColin Finckinstall: 276*c2c66affSColin Finck 277*c2c66affSColin Finck#define _STLP_DONT_REDEFINE_STD 278*c2c66affSColin Finck#define _STLP_WHOLE_NATIVE_STD 279*c2c66affSColin Finck 280*c2c66affSColin Finck#include <string> 281*c2c66affSColin Finck 282*c2c66affSColin Finckvoid foo() 283*c2c66affSColin Finck{ 284*c2c66affSColin Finck std::string std_str("std"); 285*c2c66affSColin Finck stlport::string stlport_str("stlport"); 286*c2c66affSColin Finck stlport_str.append(std_str.begin(), std_str.end()); 287*c2c66affSColin Finck // Following is wrong because there is no assignment 288*c2c66affSColin Finck // operator for stlport::string on std::string. 289*c2c66affSColin Finck //std_str = stlport_str; 290*c2c66affSColin Finck} 291*c2c66affSColin Finck 292*c2c66affSColin FinckNote: You can use 'std' iterators from native implementation in STLport 293*c2c66affSColin Fincktemplate methods like in the 'stlport_str.append' method call above because 294*c2c66affSColin FinckSTLport is adding the necessary code to interpret native iterators like 295*c2c66affSColin FinckSTLport iterators. You won't be able however to do the opposite as native 296*c2c66affSColin Finckimplementation do not know anything about STLport iterators. 297*c2c66affSColin Finck 298*c2c66affSColin Finck 299*c2c66affSColin Finck======================================================================== 300*c2c66affSColin Finck 301*c2c66affSColin FinckQ2.4 When I switch to STLport in my application, I get errors. Is STLport 302*c2c66affSColin Finckso bad? 303*c2c66affSColin Finck 304*c2c66affSColin FinckA2.4 Before you post such message, please, check STLport WHITHOUT YOUR code: 305*c2c66affSColin Finck - build STLport library 306*c2c66affSColin Finck - build STLport unit tests 307*c2c66affSColin Finck - run STLport unit tests 308*c2c66affSColin FinckIf any of above steps fail, please, make sure that you carefully followed 309*c2c66affSColin Finckbuild instructions (in most cases you definitely should reread 310*c2c66affSColin Finckinstructions and check that you correctly unpack archive in case you see 311*c2c66affSColin Finck'file not found' message). Build instructions you can found in files 312*c2c66affSColin FinckINSTALL, doc/README.*, build/README*, build/test/unit/README*. 313*c2c66affSColin FinckIf you are sure, submit bug report here: 314*c2c66affSColin Finckhttps://sourceforge.net/projects/stlport 315*c2c66affSColin FinckDon't forget to describe your operational environment, compiler version and 316*c2c66affSColin FinckSTLport version. 317*c2c66affSColin Finck 318*c2c66affSColin Finck======================================================================== 319*c2c66affSColin Finck 320*c2c66affSColin FinckQ3.0 On my XXXX Linux n.n g++ headers are in /usr/include/g++, but they 321*c2c66affSColin Finckare looked for in /usr/include/3.3.1. Is it a STLport bug? 322*c2c66affSColin Finck 323*c2c66affSColin FinckA3.0 Path to native compiler headers for GCC correspond to default path 324*c2c66affSColin Finckafter build/install compiler (i.e. paths from compiler origo). 325*c2c66affSColin FinckPackage maintainers can use any path by own taste---we can't satisfy 326*c2c66affSColin Finckvariety of distributions/packages. 327*c2c66affSColin Finck 328*c2c66affSColin FinckSo you can: 329*c2c66affSColin Finck - fix path in stlport administration config file stlport/stl/config/host.h, 330*c2c66affSColin Finck see _STLP_NATIVE_INCLUDE_PATH macro and related. 331*c2c66affSColin Finck - create a link to the native compiler headers like expected by STLport 332*c2c66affSColin Finck - make request to package maintainer 333*c2c66affSColin Finck - build and install compiler 334*c2c66affSColin Finck 335*c2c66affSColin FinckNote: Starting with version 5.2, STLport uses the include_next preprocessing 336*c2c66affSColin Finckcommand to access native headers so you shouldn't experiment this problem 337*c2c66affSColin Finckanymore when this feature is supported by your compiler preprocessor. 338*c2c66affSColin Finck 339*c2c66affSColin Finck======================================================================== 340*c2c66affSColin Finck 341*c2c66affSColin FinckQ3.1 Do I need to build a library to use STLport? 342*c2c66affSColin Finck 343*c2c66affSColin FinckA3.1 You may omit usage (and, thus building) STLport library, but in this 344*c2c66affSColin Finckcase you can't use iostreams, locale, complex. 345*c2c66affSColin Finck 346*c2c66affSColin Finck======================================================================== 347*c2c66affSColin Finck 348*c2c66affSColin FinckQ3.2 During library compilation with MS VC++ 6.0 I see following error report: 349*c2c66affSColin Finck 350*c2c66affSColin FinckC:\Program Files\Microsoft SDK\Include\.\winbase.h(1123) : error C2733: second C linkage of overloaded function 'InterlockedIncrement' not allowed 351*c2c66affSColin Finck C:\Program Files\Microsoft SDK\Include\.\winbase.h(1121) : see declaration of 'InterlockedIncrement' 352*c2c66affSColin FinckC:\Program Files\Microsoft SDK\Include\.\winbase.h(1130) : error C2733: second C linkage of overloaded function 'InterlockedDecrement' not allowed 353*c2c66affSColin Finck C:\Program Files\Microsoft SDK\Include\.\winbase.h(1128) : see declaration of 'InterlockedDecrement' 354*c2c66affSColin FinckC:\Program Files\Microsoft SDK\Include\.\winbase.h(1138) : error C2733: second C linkage of overloaded function 'InterlockedExchange' not allowed 355*c2c66affSColin Finck C:\Program Files\Microsoft SDK\Include\.\winbase.h(1135) : see declaration of 'InterlockedExchange' 356*c2c66affSColin Finck 357*c2c66affSColin FinckA3.2 You have a Platform SDK installed. Uncomment line 358*c2c66affSColin Finck#define _STLP_NEW_PLATFORM_SDK 1 359*c2c66affSColin Finckin the file stlport/stl/config/user_config.h. There is no way to detect SDK 360*c2c66affSColin Finckpresence during preprocessor stage, which is why you have to make this 361*c2c66affSColin Finckchange manually. 362*c2c66affSColin Finck 363*c2c66affSColin Finck======================================================================== 364*c2c66affSColin Finck 365*c2c66affSColin FinckQ3.3 Has anybody succeeded building STLport on OS S with compiler K n.n? 366*c2c66affSColin Finck 367*c2c66affSColin FinckA3.3 See report about results of regression tests here: build/test/unit/STATUS. 368*c2c66affSColin Finck 369*c2c66affSColin Finck======================================================================== 370*c2c66affSColin Finck 371*c2c66affSColin FinckQ3.4 Does STLport support cross-compilation? 372*c2c66affSColin Finck 373*c2c66affSColin FinckA3.4 In case of GCC, use something like following sequence: 374*c2c66affSColin Finck 375*c2c66affSColin Finck (./configure --target=${CROSSTARGET}; cd build/lib; \ 376*c2c66affSColin Finck export PATH=${BASECROSS}/bin:${PATH}; make -f gcc.mak install-release-shared) 377*c2c66affSColin Finck 378*c2c66affSColin Finckwhere CROSSTARGET is GCC's cross prefix (something like 'i586-pc-linux-gnu', 379*c2c66affSColin Finckif C++ cross compiler named as 'i586-pc-linux-gnu-c++'), BASECROSS is base of 380*c2c66affSColin Finckcross-compiler's location (i.e. ${BASECROSS}/bin in case above is a location 381*c2c66affSColin Finckof 'i586-pc-linux-gnu-c++'). 382*c2c66affSColin Finck 383*c2c66affSColin FinckIn case of non-GCC crossecompilers, we need hands-made target system identification. 384*c2c66affSColin FinckThe sample of such compiler (supported by STLport) is MetroWerks Codewarrior 385*c2c66affSColin Finckfor Novell Netware (mwccnlm). 386*c2c66affSColin Finck 387*c2c66affSColin Finck======================================================================== 388*c2c66affSColin Finck 389*c2c66affSColin FinckQ4.1 I tried "make -f gcc.mak install", but it installs nothing into 390*c2c66affSColin Finck/usr/local/. How I can install headers into /usr/local/include and 391*c2c66affSColin Fincklibs into /usr/local/lib? 392*c2c66affSColin Finck 393*c2c66affSColin FinckA4.1 Installation in any system-wide place is issue of either 'package builder' 394*c2c66affSColin Finckor system administrator. He/she should be familiar with building package 395*c2c66affSColin Finckprocedure and/or understand where headers and libraries should be situated. 396*c2c66affSColin FinckThe place choice not issue of STLport. 397*c2c66affSColin Finck 398*c2c66affSColin FinckYou can just use 399*c2c66affSColin Finck 400*c2c66affSColin Finck(cd ${STLPORT_SRC}/lib; tar cf - . ) | (cd ${TARGET_LIB_DIR}; tar xf - ); \ 401*c2c66affSColin Finck (cd ${STLPORT_SRC}; tar cf - stlport) | (cd ${TARGET_INCLUDE_DIR}; tar xf - ) 402*c2c66affSColin Finck 403*c2c66affSColin FinckSometimes we will think about 'make install', but not now. 404*c2c66affSColin Finck 405*c2c66affSColin Finck 406*c2c66affSColin Finck======================================================================== 407*c2c66affSColin Finck 408*c2c66affSColin FinckQ5.0 I found a bug, how I can report about it? 409*c2c66affSColin Finck 410*c2c66affSColin FinckA5.0 411*c2c66affSColin Finck 0. Ensure that this is really a bug (standard violation, incorrect 412*c2c66affSColin Finck behaviour with correct usage). 413*c2c66affSColin Finck 1. Ensure that bug is in STLport, not in your code (you can use _STLP_DEBUG 414*c2c66affSColin Finck for that, see stlport/stl/config/user_config.h). 415*c2c66affSColin Finck 2. Ensure that you correctly built STLport---build and run unit tests 416*c2c66affSColin Finck (build/test/unit) first with default settings, then with your settings 417*c2c66affSColin Finck (if you changed any). 418*c2c66affSColin Finck 3. Write a short test that demonstrates the bug. 419*c2c66affSColin Finck 4. Make sure that this test case is really new, i.e. not covered by unit 420*c2c66affSColin Finck tests (test/unit/*). 421*c2c66affSColin Finck 5. Compare your results with reported runs of unit tests (build/test/unit/STATUS). 422*c2c66affSColin Finck 6. Write bug description and test here 423*c2c66affSColin Finck 424*c2c66affSColin Finck https://sourceforge.net/projects/stlport 425*c2c66affSColin Finck 426*c2c66affSColin Finck DON'T FORGET TO DESCRIBE: 427*c2c66affSColin Finck 428*c2c66affSColin Finck - OPERATIONAL ENVIRONMENT 429*c2c66affSColin Finck - COMPILER VERSION 430*c2c66affSColin Finck - STLPORT VERSION 431*c2c66affSColin Finck - RESULT OF UNIT TESTS 432*c2c66affSColin Finck 433*c2c66affSColin Finck Keep in mind, that your bug MUST be reproduced by other people, so give 434*c2c66affSColin Finck enough information (but compactly, give only essential information). 435*c2c66affSColin Finck 436*c2c66affSColin Finck======================================================================== 437*c2c66affSColin Finck 438*c2c66affSColin FinckQ6.0 In STLport files like locale.h, setjmp.h, stdlib.h, etc., do 439*c2c66affSColin Fincknothing except include native headers. Why are these files present in STLport? 440*c2c66affSColin Finck 441*c2c66affSColin FinckA6.0 Sometimes native C headers are using C++ ones or are refering 442*c2c66affSColin Finckto the std namespace. That's why, if stddef was absent in STLport, then 443*c2c66affSColin Finck 444*c2c66affSColin Finck#include <string> 445*c2c66affSColin Finck#include <stddef.h> 446*c2c66affSColin Finck 447*c2c66affSColin Finckmay cause problem in following code, because std redefined in the end of 448*c2c66affSColin Finck<string> header, and std may be used in stddef.h: 449*c2c66affSColin Finck 450*c2c66affSColin Finck__BEGIN_NAMESPACE_STD 451*c2c66affSColin Finck.... 452*c2c66affSColin Finck__END_NAMESPACE_STD 453*c2c66affSColin Finck 454*c2c66affSColin Finckwhere __BEGIN_NAMESPACE_STD is defined as 'namespace std {'. 455*c2c66affSColin FinckTo avoid this, STLport has stddef.h header and provide correct masquerade 456*c2c66affSColin Finckfor std. 457*c2c66affSColin Finck 458*c2c66affSColin Finck======================================================================== 459*c2c66affSColin Finck 460*c2c66affSColin FinckQ6.1 Is STLport a replacement for headers and libraries that shipout 461*c2c66affSColin Finckwith compiler? 462*c2c66affSColin Finck 463*c2c66affSColin FinckA6.1 In general no. In any case C++ language support from compiler is required 464*c2c66affSColin Finckfor STLport (operators new, delete, RTTI, exceptions support). STLport also 465*c2c66affSColin Finckuses 'native' headers and libraries to take interface to system functions and 466*c2c66affSColin Finckvariables. 467*c2c66affSColin Finck 468*c2c66affSColin Finck======================================================================== 469*c2c66affSColin Finck 470*c2c66affSColin FinckQ6.2 My tool detects memory leaks in application with STLport. Is this leak 471*c2c66affSColin Finckfrom STLport? 472*c2c66affSColin Finck 473*c2c66affSColin FinckA6.2 In most cases these are 'pseudo memory leaks' that some tools 474*c2c66affSColin Finckwrongly detect. 475*c2c66affSColin Finck 476*c2c66affSColin FinckIn the default compile of STLport, the node allocator is used to allocate 477*c2c66affSColin Finckinternal memory. The node allocator works by pre-allocating a large chunk of 478*c2c66affSColin Finckmemory and handing out small memory blocks. The memory chunk is not freed 479*c2c66affSColin Finckduring running an application that uses STLport (i.e. it is not returned to 480*c2c66affSColin Finckthe system, but reused inside application). 481*c2c66affSColin FinckSee also http://www.sgi.com/tech/stl/alloc.html 482*c2c66affSColin Finck 483*c2c66affSColin FinckThere are tools like BoundsChecker, Purify or Valgrind that check for memory 484*c2c66affSColin Finckleaks, for memory that isn't freed when no longer used. These tools may report 485*c2c66affSColin Finckfalse memory leaks when one uses STLport's node allocator. The memory chunk is 486*c2c66affSColin Fincknormally freed at application end, but the memory checkers usually report memory 487*c2c66affSColin Finckleaks before that point. Another memory problem might be reported when you use 488*c2c66affSColin Finckshared libraries (e.g. DLL, this problem specific for Windows DLL model) that 489*c2c66affSColin Finckuses STLport internally and are statically link to it. If memory is allocated in 490*c2c66affSColin Fincka dll and released in an other then the STLport node allocator will keep the 491*c2c66affSColin Finckreleased memory for a future use. If you do not use this memory then your 492*c2c66affSColin Finckapplication global memory consumption will grow until the app crash even if there 493*c2c66affSColin Finckis no real memory leak. This is why you should always use a coherent configuration 494*c2c66affSColin Finckeverything in dll or everything in static lib. 495*c2c66affSColin Finck 496*c2c66affSColin FinckThere are ways to remove the pseudo memory leaks (since the memory is properly 497*c2c66affSColin Finckfreed at the end of the program, the leaks are just pseudo-ones). You could use 498*c2c66affSColin Finckanother allocator that is used in STLport. Open the file 499*c2c66affSColin Finck"./stlport/stl/config/host.h" and uncomment either one of the following: 500*c2c66affSColin Finck 501*c2c66affSColin Finck 502*c2c66affSColin Finck _STLP_USE_NEWALLOC enables a simple allocator that uses "new/delete" 503*c2c66affSColin Finck _STLP_USE_MALLOC enables a simple allocator that uses "malloc/free" 504*c2c66affSColin Finck 505*c2c66affSColin FinckThe new/delete allocator has the advantage of giving an entry point to track 506*c2c66affSColin Finckmemory starvation, see set_new_handler in your compiler doc or the C++ Standard 507*c2c66affSColin Finckfor more information. 508*c2c66affSColin Finck 509*c2c66affSColin FinckAlternatively you can define the following symbol, just uncomment it in 510*c2c66affSColin Finck"./stlport/stl/config/host.h". 511*c2c66affSColin Finck 512*c2c66affSColin Finck _STLP_LEAKS_PEDANTIC 513*c2c66affSColin Finck 514*c2c66affSColin FinckThe symbol forces freeing all memory chunks. Also see the comments around the 515*c2c66affSColin Fincksymbol in the config file. 516*c2c66affSColin Finck 517*c2c66affSColin FinckNote that you have to recompile STLport AND your application and all of your 518*c2c66affSColin Finckdependent libraries if you make any change to the file! 519*c2c66affSColin Finck 520*c2c66affSColin FinckThere are also some defines that help in debugging memory problems in STLport. 521*c2c66affSColin FinckIn _STLP_DEBUG mode, just also define the following symbols, either in 522*c2c66affSColin Finck"./stlport/stl/config/user_config.h" or in your project settings: 523*c2c66affSColin Finck 524*c2c66affSColin Finck _STLP_DEBUG_ALLOC 525*c2c66affSColin Finck _STLP_DEBUG_UNINITIALIZED 526*c2c66affSColin Finck 527*c2c66affSColin FinckYou don't need to rebuild STLport for these options, but you have to rebuild 528*c2c66affSColin Finckyour application and all of your dependent libraries if you make any change to 529*c2c66affSColin Finckthe file. 530*c2c66affSColin Finck 531*c2c66affSColin Finck======================================================================== 532*c2c66affSColin Finck 533*c2c66affSColin FinckQ6.3 When running unit tests, I have errors in LocaleTest test fixture, how bad 534*c2c66affSColin Finckis it? 535*c2c66affSColin Finck 536*c2c66affSColin FinckA6.3 Failures in LocaleTest tests do not mean that your platform/compiler is not 537*c2c66affSColin Finckfully supported by STLport. Platform independant localization tests are very hard 538*c2c66affSColin Finckto write as Standard localization API has not been design to make unit test easy. 539*c2c66affSColin FinckIn STLport unit tests suite we have hard coded some expected values. Those values 540*c2c66affSColin Finckdepends on your OS configuration explaining why sometimes the tests are failing. 541*c2c66affSColin Finck 542*c2c66affSColin Finck======================================================================== 543*c2c66affSColin Finck 544*c2c66affSColin FinckQ6.4 set or multiset iterators are immutable like const_iterators, why ? 545*c2c66affSColin Finck 546*c2c66affSColin FinckA6.4 With set or multiset associative containers or even newly introduced 547*c2c66affSColin Fincktr1::unordered_set and tr1::unordered_multiset key is confuse with data. It 548*c2c66affSColin Finckmeans that modifying the data is also modifying the key. Modifying the key 549*c2c66affSColin Finckmight corrupt the container internal data structure so STLport prefer to 550*c2c66affSColin Finckmake this problem obvious and only return a const access to the key with 551*c2c66affSColin Finckimmutable iterators. Your solutions are: 552*c2c66affSColin Finck- prefer map/multimap and split the key and the data 553*c2c66affSColin Finck- use const_cast when you want to change a set/multiset element. 554*c2c66affSColin Finck 555