CppCMS and STLPort
I was interest to take a look in STLPort for a long time ago and recently I finally did it.
STLPort is a cross platform and "cross compiler" implementation of the standard C++ library. It has more permissive license then libstdc++ and frequently used when C++ developers want to use same code across different platforms and compiler vendors.
It is quite simple to use it instead of libstdc++
with gcc:
g++ -I /usr/include/stlport file.cpp -lstlport
So I tried CppCMS with it and was stuck with two STLPort library bugs:
- The operator
|
forstd::ctype_base::mask
enumerator was not defined as required by the standard. For example if I want to define a mask likealpha|digit
the compiler rejected the code. I had only one such place in the code so I did a small workaround for the problem. The other problem was that some advanced localization code could not link. After searching the problem for some time I had found that some symbols that should be public where hidden.
GCC allows to hide all-but marked linker symbols using
-fvisibility=hidden
parameter. This gives a developer an ability to mark library's public API with a special attribute and let the linker know which symbols should be kept public in the shared object and which shouldn't.The problem was that some essential but rarely used symbols had remained hidden.
So in order to fix the issue I downloaded the source package of the library:
apt-get source stlport5.2
Removed the
-fvisibility=hidden
flag from gcc.mak file that was optional in any case and rebuild it with simplefakeroot dpkg-buildpackage
It solved the problem for me. The bug was reported upstream and fixed in the 5.x branch.
So how do you build CppCMS with STLPort? Simple:
- Fix the
-fvisibility=hidden
problem as shown above. - Configure CppCMS with an option
-DUSE_STLPORT=ON -DDISABLE_STD_LOCALE=ON
, thats it.
Note, the STLPort support is still experimental and due to some issues with STLPort library
it is recommended to remove std
localization backend from the library.
Add Comment:
You must enable JavaScript in order to post comments.