Sans Pareil Technologies, Inc.

Key To Your Business

Building Poco



Building Poco on Solaris using GCC requires a few changes. These instructions apply for building 64 bit libraries from 1.4.2 or greater releases using GCC 4.6.2 (from opencsw or OpenIndiana sfe packages). Note that none of these changes are required if building with the Sun Studio compiler suite.

Edit the following files from the source distribution:

  • Foundation/include/Poco/NamedEvent_UNIX.h Foundation/src/NamedEvent_UNIX.cpp - replace #if defined(sun) with #if defined(sun) || defined(__sun) throughout file.
  • Foundation/include/Poco/NamedMutex_UNIX.h Foundation/src/NamedMutex_UNIX.cpp - replace #if defined(sun) with #if defined(sun) || defined(__sun) throughout file.
  • Net/src/SocketImpl.cpp
    • Error related to undefined FIONREAD
    • Add #include <sys/filio.h>
  • Net/src/NetworkInterface.cpp
    • Errors related to undefined SIOCGIFNETMASK, SIOCGIFBRDADDR, SIOCGIFCONF
    • Add #include <sys/sockio.h>
  • Errors related to use of I64_FMT macro - the line numbers are based on sources for version 1.4.5
    • Edit Foundation/src/NumberParser.cpp.
      • Replace line 127 with following:127 //return std::sscanf(s.c_str(), "%"I64_FMT"d%c", &value, &temp) == 1;
      128 std::string fmt;129 fmt.append( "%" ).append( I64_FMT ).append( "d%c" );130 return std::sscanf(s.c_str(), fmt.c_str(), &value, &temp) == 1;
    • Replace line 147 with the following:147 //return std::sscanf(s.c_str(), "%"I64_FMT"u%c", &value, &temp) == 1;148 std::string fmt;149 fmt.append( "%" ).append( I64_FMT ).append( "u%c" );150 return std::sscanf(s.c_str(), fmt.c_str(), &value, &temp) == 1;
    • Replace line 167 with the following:167 //return std::sscanf(s.c_str(), "%"I64_FMT"x%c", &value, &temp) == 1;168 std::string fmt;169 fmt.append( "%" ).append( I64_FMT ).append( "x%c" );170 return std::sscanf(s.c_str(), fmt.c_str(), &value, &temp) == 1;
  • Edit Foundation/src/NumberFormatter.cpp.
    • Replace lines 247-249 with:247 //char buffer[64];248 //std::sprintf(buffer, "%"I64_FMT"d", value);249 //str.append(buffer);250 std::string fmt;251 fmt.append( "%" ).append( I64_FMT ).append( "d" );252 str.append(fmt);
    • Replace line 261 with:261 //std::sprintf(buffer, "%*"I64_FMT"d", width, value);262 std::string fmt;263 fmt.append( "%*" ).append( I64_FMT ).append( "d" );264 std::sprintf(buffer, fmt.c_str(), width, value);
    • Replace line 274 with:274 //std::sprintf(buffer, "%0*"I64_FMT"d", width, value);275 std::string fmt;276 fmt.append( "%0*" ).append( I64_FMT ).append( "d" );277 std::sprintf(buffer, fmt.c_str(), width, value);
    • Replace lines 284-286 with:284 //char buffer[64];285 //std::sprintf(buffer, "%"I64_FMT"X", value);286 //str.append(buffer);287 std::string fmt;288 fmt.append( "%" ).append( I64_FMT ).append( "X" );289 str.append(fmt);
    • Replace line 298 with:298 //std::sprintf(buffer, "%0*"I64_FMT"X", width, value);299 std::string fmt;300 fmt.append( "%0*" ).append( I64_FMT ).append( "X" );301 std::sprintf(buffer, fmt.c_str(), width, value);
    • Replace lines 308-310 with:308 //char buffer[64];309 //std::sprintf(buffer, "%"I64_FMT"u", value);310 //str.append(buffer);311 std::string fmt;312 fmt.append( "%" ).append( I64_FMT ).append( "u" );313 str.append(fmt);
    • Replace line 322 with:322 //std::sprintf(buffer, "%*"I64_FMT"u", width, value);323 std::string fmt;324 fmt.append( "%*" ).append( I64_FMT ).append( "u" );325 std::sprintf(buffer, fmt.c_str(), width, value);
    • Replace line 335 with:335 //std::sprintf(buffer, "%0*"I64_FMT"u", width, value);336 std::string fmt;337 fmt.append( "%0*" ).append( I64_FMT ).append( "u" );338 std::sprintf(buffer, fmt.c_str(), width, value);
    • Replace lines 345-347 with:345 //char buffer[64];346 //std::sprintf(buffer, "%"I64_FMT"X", value);347 //str.append(buffer);348 std::string fmt;349 fmt.append( "%" ).append( I64_FMT ).append( "X" );350 str.append(fmt);
    • Replace line 359 with:359 //std::sprintf(buffer, "%0*"I64_FMT"X", width, value);360 std::string fmt;361 fmt.append( "%0*" ).append( I64_FMT ).append( "X" );362 std::sprintf(buffer, fmt.c_str(), width, value);

  • build/config/SunOS-GCC
    • Remove -D_X_OPEN_SOURCE=500 from SYSFLAGS
    • Add -D_XPG6 to SYSFLAGS
    • Add -lsocket to SYSLIBS
    • Add -std=c99 to C compiler flag variable
    • Add -m64 and -std=c++11 to C++ compiler and linker flag variables
    • Download the modified SunOS-GCC file with all modifications.

The following script may be used to compile and install poco.

#!/bin/ksh./configure --prefix=/usr/local/poco \ --config=SunOS-GCC \ --no-tests --no-samples \ --omit=Data/ODBC,Data/MySQLpfexec gmake -j8 install

This will install poco into /usr/local/poco. If you use poco heavily, it may be worthwhile adding /usr/local/poco/lib to crle.

Solaris Studio Compiler Suite



No source code changes are necessary when compiling using the Solaris Studio compiler suite (we use the latest available version 12.3). The only changes required are if you are building in 64 bit mode. The configuration to use in that case is SunOS-stdcxx-x86_64

Edit build/config/SunOS-stdcxx-x86_64

  • Modify the CXX configuration
  • #CXX = CC -xtarget=opteron -m64 -library=no%Cstd
  • CXX = CC -xtarget=native -m64 -library=stlport4

  • Modify release options configuration as follows
  • #RELEASEOPT_CC = -xO3 -g0 -xregs=no%frameptr -xdebugformat=stabs -xs -DNDEBUG -library=no%Cstd -I$(STDCXX_BASE)/include
  • RELEASEOPT_CC = -xO3 -g0 -xregs=no%frameptr -xdebugformat=stabs -xs -DNDEBUG -library=stlport4 -I$(STDCXX_BASE)/include
#RELEASEOPT_CXX = -xO3 -g0 -xregs=no%frameptr -xdebugformat=stabs -xs -DNDEBUG -library=no%Cstd -I$(STDCXX_BASE)/includeRELEASEOPT_CXX = -xO3 -g0 -xregs=no%frameptr -xdebugformat=stabs -xs -DNDEBUG -library=stlport4 -I$(STDCXX_BASE)/include
  • Remove -lstd15D from SYSLIBS
  • #SYSLIBS = -lstd15D -lpthread -lrt -lxnet -lsocket -lnsl -lresolv -ldl
  • #SYSLIBS = -lpthread -lrt -lxnet -lsocket -lnsl -lresolv -ldl
The following script may be used to compile and install poco
#!/bin/ksh./configure --prefix=/opt/poco \ --config=SunOS-stdcxx-x86_64 \ --no-tests --no-samples \ --omit=Data/MySQL,Data/ODBCgmake -j8if [ $? -eq 0 ]then pfexec gmake installfi