1<!--$Id: solaris.so,v 11.26 2007/06/27 14:41:06 bostic Exp $--> 2<!--Copyright (c) 1997,2008 Oracle. All rights reserved.--> 3<!--See the file LICENSE for redistribution information.--> 4<html> 5<head> 6<title>Berkeley DB Reference Guide: Solaris</title> 7<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> 8<meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++"> 9</head> 10<body bgcolor=white> 11<a name="2"><!--meow--></a> 12<table width="100%"><tr valign=top> 13<td><b><dl><dt>Berkeley DB Reference Guide:<dd>Building Berkeley DB for UNIX/POSIX systems</dl></b></td> 14<td align=right><a href="/build_unix/sco.html"><img src="/images/prev.gif" alt="Prev"></a><a href="/toc.html"><img src="/images/ref.gif" alt="Ref"></a><a href="/build_unix/sunos.html"><img src="/images/next.gif" alt="Next"></a> 15</td></tr></table> 16<p align=center><b>Solaris</b></p> 17<ol> 18<p><li><b>I can't compile and run multithreaded applications.</b> 19<p>Special compile-time flags and additional libraries are required when 20compiling threaded applications on Solaris. If you are compiling a 21threaded application, you must compile with the D_REENTRANT flag and link 22with the libpthread.a or libthread.a libraries:</p> 23<blockquote><pre>cc -mt ... 24cc -D_REENTRANT ... -lthread 25cc -D_REENTRANT ... -lpthread</pre></blockquote> 26<p>The Berkeley DB library will automatically build with the correct options.</p> 27<hr size=1 noshade> 28<p><li><b>I've installed gcc on my Solaris system, but configuration 29fails because the compiler doesn't work.</b> 30<p>On some versions of Solaris, there is a cc executable in the user's path, 31but all it does is display an error message and fail:</p> 32<blockquote><pre>% which cc 33/usr/ucb/cc 34% cc 35/usr/ucb/cc: language optional software package not installed</pre></blockquote> 36<p>Because Berkeley DB always uses the native compiler in preference to gcc, this 37is a fatal error. If the error message you are seeing is the following, 38then this may be the problem:</p> 39<blockquote><pre>checking whether the C compiler (cc -O) works... no 40configure: error: installation or configuration problem: C compiler cannot create executables.</pre></blockquote> 41<p>The simplest workaround is to set your CC environment variable to the 42system compiler and reconfigure; for example:</p> 43<blockquote><pre>env CC=gcc /dist/configure</pre></blockquote> 44<p>If you are using the --configure-cxx option, you may also want to specify 45a C++ compiler, for example the following:</p> 46<blockquote><pre>env CC=gcc CCC=g++ /dist/configure</pre></blockquote> 47<hr size=1 noshade> 48<p><li><b>I see the error 49"libc internal error: _rmutex_unlock: rmutex not held", followed by a core 50dump when running threaded or JAVA programs.</b> 51<p>This is a known bug in Solaris 2.5 and it is fixed by Sun patch 103187-25.</p> 52<hr size=1 noshade> 53<p><li><b>I see error reports of nonexistent files, corrupted metadata 54pages and core dumps.</b> 55<p>Solaris 7 contains a bug in the threading libraries (-lpthread, 56-lthread), which causes the wrong version of the pwrite routine to be 57linked into the application if the thread library is linked in after 58the C library. The result will be that the pwrite function is called 59rather than the pwrite64. To work around the problem, use an explicit 60link order when creating your application.</p> 61<p>Sun Microsystems is tracking this problem with Bug Id's 4291109 and 4267207, 62and patch 106980-09 to Solaris 7 fixes the problem:</p> 63<blockquote><pre>Bug Id: 4291109 64Duplicate of: 4267207 65Category: library 66Subcategory: libthread 67State: closed 68Synopsis: pwrite64 mapped to pwrite 69Description: 70When libthread is linked after libc, there is a table of functions in 71libthread that gets "wired into" libc via _libc_threads_interface(). 72The table in libthread is wrong in both Solaris 7 and on28_35 for the 73TI_PWRITE64 row (see near the end).</pre></blockquote> 74<hr size=1 noshade> 75<p><li><b>I see corrupted databases when doing hot backups or creating 76a hot failover archive.</b> 77<p>The Solaris cp utility is implemented using the mmap system call, and 78so writes are not blocked when it reads database pages. See 79<a href="/ref/transapp/reclimit.html">Berkeley DB recoverability</a> for more 80information.</p> 81<hr size=1 noshade> 82<p><li><b>Performance is slow and the application is doing a lot of I/O 83to the disk on which the database environment's files are stored.</b> 84<p>By default, Solaris periodically flushes dirty blocks from memory-mapped 85files to the backing filesystem. This includes the Berkeley DB database 86environment's shared memory regions and can affect Berkeley DB performance. 87Workarounds include creating the shared regions in system shared memory 88(<a href="/api_c/env_open.html#DB_SYSTEM_MEM">DB_SYSTEM_MEM</a>) or application private memory 89(<a href="/api_c/env_open.html#DB_PRIVATE">DB_PRIVATE</a>), or, configuring Solaris to not flush memory-mapped 90pages. For more information, see the "Solaris Tunable Parameters 91Reference Manual: fsflush and Related Tunables".</p> 92<hr size=1 noshade> 93<p><li><b>I see errors about "open64" when building Berkeley DB applications.</b> 94<p>System include files (most commonly fcntl.h) in some releases of AIX, 95HP-UX and Solaris redefine "open" when large-file support is enabled 96for applications. This causes problems when compiling applications 97because "open" is a method in the Berkeley DB APIs. To work around this 98problem: 99<ol> 100<p><li>Avoid including the problematical system include files in source code 101files which also include Berkeley DB include files and call into the Berkeley DB 102API. 103<li>Before building Berkeley DB, modify the generated include file db.h to itself 104include the problematical system include files. 105<li>Turn off Berkeley DB large-file support by specifying the 106<a href="/ref/build_unix/conf.html#--disable-largefile">--disable-largefile</a> configuration option and rebuilding. 107</ol></p> 108</ol> 109<table width="100%"><tr><td><br></td><td align=right><a href="/build_unix/sco.html"><img src="/images/prev.gif" alt="Prev"></a><a href="/toc.html"><img src="/images/ref.gif" alt="Ref"></a><a href="/build_unix/sunos.html"><img src="/images/next.gif" alt="Next"></a> 110</td></tr></table> 111<p><font size=1>Copyright (c) 1996,2008 Oracle. All rights reserved.</font> 112</body> 113</html> 114