[SERVER-731] try Sun Studio for compiling on solaris Created: 10/Mar/10  Updated: 06/Dec/22  Resolved: 08/Aug/17

Status: Closed
Project: Core Server
Component/s: Build
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Eliot Horowitz (Inactive) Assignee: Backlog - Build Team (Inactive)
Resolution: Won't Fix Votes: 1
Labels: build-later, build-needs-definition
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

solaris


Issue Links:
Duplicate
Related
is related to CDRIVER-818 Add support for Solaris Studio Compiler Closed
Assigned Teams:
Build
Participants:

 Description   

Also:
in third_party/pcre-7.4/config.h look for TODO for sunos



 Comments   
Comment by Ramon Fernandez Marina [ 08/Aug/17 ]

Currently there are no further plans to explore other toolchains on Solaris.

Comment by Tomas Carnecky [ 12/Apr/10 ]

Additional information to the #pragma pack behavior of sunstudio: http://forums.sun.com/thread.jspa?threadID=5433609 and http://bugs.sun.com/view_bug.do?bug_id=4494035

Comment by Tomas Carnecky [ 29/Mar/10 ]

I added _attribute_((packed)) to all structures and classes which are inside #pragma pack(1) (because Sun Studio ignores #pragma pack on non-POD types), the resulting code compiles fine with Sun Studio but fails to compile with g++. There is one error:
db/diskloc.h: In member function 'int& mongo::DiskLoc::GETOFS()':
db/diskloc.h:93: error: cannot bind packed field '((mongo::DiskLoc*)this)->mongo::DiskLoc::ofs' to 'int&'

and many warnings (such as):
db/btree.h:374: warning: ignoring packed attribute because of unpacked non-POD field 'mongo::BSONObj mongo::BtreeCursor::startKey'
db/btree.h:375: warning: ignoring packed attribute because of unpacked non-POD field 'mongo::BSONObj mongo::BtreeCursor::endKey'

I don't know which types need to be packed and which do not, and I don't want to add _attribute((packed)) when not absolutely necessary, so the last commit (Create a define for __attribute_((packed)) and use when appropriate) in my new patchset (available in the 'solaris-fixes-clean' branch) needs to be reviewed and updated appropriately.

Comment by Tomas Carnecky [ 28/Mar/10 ]

So, all but dbtests/threadedtests.cpp compiles without errors or warnings, 'make test_all' in node-mongodb-native runs without errors, but I see a lot assertions failed in the output of 'scons smokeAll'. Anyway, the code is in my github repo, but the commits aren't cleaned up yet, the whole series could be squashed down to maybe eight commits.

The error in threadedtests.cpp is actually an error in either boost or the Sun Studio C++ compiler (my guess is the later):
"/usr/include/boost/thread/future.hpp", line 414: Error: Formal argument other of type boost::unique_lock<boost::mutex> in call to boost::unique_lock<boost::mutex>::operator=(boost::unique_lock<boost::mutex>) has an inaccessible copy constructor.
The same error can be observed with a empty source file which only includes the <boost/thread.hpp> include file.

In data structures which need a particular layout, I'd suggest you to use stdint types, that would make the size of the fields much clearer. I didn't address this in any of my commits since it's not necessarily needed to make mongo compile with Sun Studio. But it's something that would improve portability.

Comment by Tomas Carnecky [ 26/Mar/10 ]

See work in progress here: http://github.com/wereHamster/mongo/compare/solaris-fixes

Generated at Thu Feb 08 02:54:59 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.