Hi Christophe,
Thanks for the report and the patch.
I have recently built all of MongoDB (scons all) on Solaris 11.1 and on OpenIndiana, and it did take a little futzing.
I only tried to build a 64-bit version, and I specified --64 on the scons command line to force this. I have (so far) unresolved problems building a debug version, so I have only built a release version.
a) Can you elaborate on the problems caused by scons not recognizing i86pc? For me, scons determined the platform to be "sunos5". I used scons 2.1.0 and 2.3.0.
b) Definitely a bug that pid_t is not used consistently as the type for a pid. The line "int portForPid( int port ) const;" is clearly wrong, and refers to the pid as a port.
If pid_t is a typedef for long, shouldn't that make it 32-bits in 32-bit builds? Agreed that it will be 64-bits in 64-bit builds.
c) I didn't hit this issue with PF_LOCAL, but I don't have Solaris 10 to test against.
d) I haven't tried gcc 4.7.3 but we'd like to be upwardly compatible with newer gcc versions if we can be.
For OpenIndiana, I had to use the OpenCSW build of gcc to get MongoDB to compile. I didn't try very hard to find out why the older gcc from the OpenIndiana repo didn't work; the OpenCSW one did work for me.
I'll look at your patch and look into the libstc++ issues. If you'd like us to incorporate your patch, could you file a Jira ticket describing what you've found, sign the contributor agreement at http://www.10gen.com/legal/contributor-agreement and issue a pull request against the Jira ticket you create?
Thanks!
Tad Marshall
From:
mongo...@googlegroups.com [mailto:mongo...@googlegroups.com] On Behalf Of chlu...@googlemail.com
Sent: Tuesday, May 21, 2013 2:45
PM
To: mongo...@googlegroups.com
Subject: [mongodb-dev] MongoDB 2.4.3
32 Bit on Solaris 10 i386
Hi,
I recently had to build MongoDB 2.4.3 on a Solaris 10 machine.Due to problems
with unresolved symbols, we could not get the binaries available at [1]
working.
More precisely, the machine description is:
$ uname -i -p -r -s
SunOS 5.10 i386 i86pc
I did not succeed in building MongoDB with the GCC 3.4.3 already available in
the system, whence I locally built and installed GCC 4.7.3:
$
gcc-4.7.3/bin/gcc-4.7.3 -v
Using built-in specs.
COLLECT_GCC=gcc-4.7.3/bin/gcc-4.7.3
COLLECT_LTO_WRAPPER=/export/home/heliosdb/gcc-4.7.3/bin/../libexec/gcc/i386-pc-solaris2.10/4.7.3/lto-wrapper
Target: i386-pc-solaris2.10
Configured with: ../gcc-4.7.3_src/configure --prefix=/home/heliosdb/gcc-4.7.3
--program-suffix=-4.7.3 --enable-threads --enable-languages=c,c++ --with-as=/usr/ccs/bin/as
--with-ld=/usr/ccs/bin/ld CONFIG_SHELL=/bin/ksh
Thread model: posix
gcc version 4.7.3 (GCC)
This is probably not an optimal GCC configuration for Solaris 10, but I only
cared about getting it working at all. In particular, this GCC seems to default
to 32 Bit builds - which was part of the reason why I had to patch the MongoDB
sources before they would build. The attached patch file has all the details,
but in summary:
a) The SConstruct file does not know the processor identifier "i86pc"
returned by uname.
b) pid_t is a typedef for long (in 32 Bit builds, at least), and sizeof(long)
> sizeof(int). Therefore the declaration
int ProgramRegistry::portForPid(int port) const;
(sic!) in shell_utils_launcher.h disagrees with the definition
int ProgramRegistry::portForPid(pid_t pid) const
{ ... }
in shell_utils_launcher.cpp. In addition, the call
BSONObjBuilder toLog;
// ...
toLog.append( "pid", getpid() );
in db.cpp becomes ambiguous. I solved the latter with a template specialization
that chooses between int and long long depending on the size of the template
argument type.
c) Solaris 10 has no definition PF_LOCAL, it seems. I mapped it to PF_UNIX
instead.
d) g++ 4.7.3 balks on the calls to sqrt(x) in s2.cc where x is an integer
literal.I therefore had to turn them into double literals.
With these changes, I could finally build and install a MongoDB executable that
seems to work fine so far:
$~/scons-2.3.0/bin/scons --prefix=/home/heliosdb/mongodb-2.4.3
--cxx=/home/heliosdb/gcc-4.7.3/bin/g++-4.7.3 --static-libstdc++ all
$~/scons-2.3.0/bin/scons
--prefix=/home/heliosdb/mongodb-2.4.3
--cxx=/home/heliosdb/gcc-4.7.3/bin/g++-4.7.3 --static-libstdc++ install
(Even though I gave the option --static-libstdc++, the binary
still dynamically links to libstdc++.so. I did not try to figure out the reason
for this, though.) We use this build in a development environment only; it
therefore does not bother us if it has a suboptimal performance or has any
restrictions on the maximum collection size.
It's been about 8 years since I did any serious C++ programming and it is even
longer since I had to mess with the build tool chain under Solaris. So someone
more familiar with the code and / or with Solaris will likely come up with
better fixes. Nevertheless, I'd like to share the patch so you see where I ran
into portability issues.
Cheers,
Christoph
[1]
http://www.mongodb.org/dr/fastdl.mongodb.org/sunos5/mongodb-sunos5-x86_64-2.4.3.tgz/download
--
You received this message because you are subscribed to the Google Groups
"mongodb-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to mongodb-dev...@googlegroups.com.
To post to this group, send email to mongo...@googlegroups.com.
Visit this group at http://groups.google.com/group/mongodb-dev?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.