Ticket #548 (closed defect: fixed)

Opened 10 years ago

Last modified 7 years ago

daf_base trunk rev 6829 will not build on MacOS X

Reported by: rowen Owned by: ktl
Priority: critical Milestone:
Component: daf_base Keywords:
Cc: smm, rhl Blocked By:
Blocking: Project: LSST
Version Number: 6829
How to repeat:

On MacOS X 10.5.6 with g++ version 4.0.1 from a current XCode check out and build trunk rev 6866 of base, utils, pex_exceptions and daf_base. The last one will fail as above.

Description

I can't seem to get daf_base trunk rev 6829 to build on MacOS X. The error is:

g++ -o src/PropertySet.os -c -g -Wall -O3 -DLSST_HAVE_TR1=1 -DLSST_LITTLE_ENDIAN=1 -fPIC -I/Users/rowen/lsst_home/DarwinX86/external/boost/1.36.0/include -I/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5 -I/Library/include -I/Users/rowen/LSST/code/utils-trunk/include -I/Users/rowen/LSST/code/pex_exceptions-trunk/include -Iinclude src/PropertySet.cc
/usr/include/c++/4.0.0/tr1/hashtable: In member function 'typename std::tr1::hashtable<Key, Value, Allocator, ExtractKey, Equal, H1, H2, H, RehashPolicy, cache_hash_code, mutable_iterators, unique_keys>::const_iterator std::tr1::hashtable<Key, Value, Allocator, ExtractKey, Equal, H1, H2, H, RehashPolicy, cache_hash_code, mutable_iterators, unique_keys>::find(const Key&) const [with Key = std::string, Value = std::pair<const std::string, boost::shared_ptr<std::vector<boost::any, std::allocator<boost::any> > > >, Allocator = std::allocator<std::pair<const std::string, boost::shared_ptr<std::vector<boost::any, std::allocator<boost::any> > > > >, ExtractKey = Internal::extract1st<std::pair<const std::string, boost::shared_ptr<std::vector<boost::any, std::allocator<boost::any> > > > >, Equal = std::equal_to<std::string>, H1 = std::tr1::hash<std::string>, H2 = Internal::mod_range_hashing, H = Internal::default_ranged_hash, RehashPolicy = Internal::prime_rehash_policy, bool cache_hash_code = false, bool mutable_iterators = true, bool unique_keys = true]':
src/PropertySet.cc:417:   instantiated from here
/usr/include/c++/4.0.0/tr1/hashtable:1135: error: passing 'const std::tr1::hashtable<std::string, std::pair<const std::string, boost::shared_ptr<std::vector<boost::any, std::allocator<boost::any> > > >, std::allocator<std::pair<const std::string, boost::shared_ptr<std::vector<boost::any, std::allocator<boost::any> > > > >, Internal::extract1st<std::pair<const std::string, boost::shared_ptr<std::vector<boost::any, std::allocator<boost::any> > > > >, std::equal_to<std::string>, std::tr1::hash<std::string>, Internal::mod_range_hashing, Internal::default_ranged_hash, Internal::prime_rehash_policy, false, true, true>' as 'this' argument of 'typename std::tr1::hashtable<Key, Value, Allocator, ExtractKey, Equal, H1, H2, H, RehashPolicy, cache_hash_code, mutable_iterators, unique_keys>::node* std::tr1::hashtable<Key, Value, Allocator, ExtractKey, Equal, H1, H2, H, RehashPolicy, cache_hash_code, mutable_iterators, unique_keys>::find_node(Internal::hash_node<Value, cache_hash_code>*, const Key&, typename std::tr1::hashtable<Key, Value, Allocator, ExtractKey, Equal, H1, H2, H, RehashPolicy, cache_hash_code, mutable_iterators, unique_keys>::hash_code_t) [with Key = std::string, Value = std::pair<const std::string, boost::shared_ptr<std::vector<boost::any, std::allocator<boost::any> > > >, Allocator = std::allocator<std::pair<const std::string, boost::shared_ptr<std::vector<boost::any, std::allocator<boost::any> > > > >, ExtractKey = Internal::extract1st<std::pair<const std::string, boost::shared_ptr<std::vector<boost::any, std::allocator<boost::any> > > > >, Equal = std::equal_to<std::string>, H1 = std::tr1::hash<std::string>, H2 = Internal::mod_range_hashing, H = Internal::default_ranged_hash, RehashPolicy = Internal::prime_rehash_policy, bool cache_hash_code = false, bool mutable_iterators = true, bool unique_keys = true]' discards qualifiers
/usr/include/c++/4.0.0/tr1/hashtable: In member function 'typename std::tr1::hashtable<Key, Value, Allocator, ExtractKey, Equal, H1, H2, H, RehashPolicy, cache_hash_code, mutable_iterators, unique_keys>::size_type std::tr1::hashtable<Key, Value, Allocator, ExtractKey, Equal, H1, H2, H, RehashPolicy, cache_hash_code, mutable_iterators, unique_keys>::erase(const Key&) [with Key = std::string, Value = std::pair<const std::string, boost::shared_ptr<std::vector<boost::any, std::allocator<boost::any> > > >, Allocator = std::allocator<std::pair<const std::string, boost::shared_ptr<std::vector<boost::any, std::allocator<boost::any> > > > >, ExtractKey = Internal::extract1st<std::pair<const std::string, boost::shared_ptr<std::vector<boost::any, std::allocator<boost::any> > > > >, Equal = std::equal_to<std::string>, H1 = std::tr1::hash<std::string>, H2 = Internal::mod_range_hashing, H = Internal::default_ranged_hash, RehashPolicy = Internal::prime_rehash_policy, bool cache_hash_code = false, bool mutable_iterators = true, bool unique_keys = true]':
src/PropertySet.cc:603:   instantiated from here
/usr/include/c++/4.0.0/tr1/hashtable:1363: warning: no return statement in function returning non-void
/usr/include/c++/4.0.0/tr1/hashtable:1363: warning: control reaches end of non-void function
scons: *** [src/PropertySet.os] Error 1
scons: building terminated because of errors.

An eups list shows nothing obviously amiss:

activemqcpp           2.1-RC1   	Current
afw                   3.2       
afw                   532       
afw                   999       	Current Setup
afwdata               999       	Current Setup
base                  3.1       
base                  999       	Current Setup
boost                 1.36.0    	Current Setup
cfitsio               3006.2    	Current Setup
coadd_kaiser          999       	Current
ctrl_events           999       	Current
daf_base              3.1       
daf_base              999       	Current Setup
daf_data              3.1       	Current Setup
daf_persistence       3.2       	Setup
daf_persistence       999       	Current
doxygen               1.5.4     	Current Setup
eups                  LOCAL:/Users/rowen/lsst_home/eups/1.1.0	Setup
lsst                  1.0       	Current Setup
lssteups              1.0       	Current Setup
minuit                1.7.9     	Current Setup
mysqlclient           5.0.45+1  	Current Setup
numpy                 1.0.1     	Current Setup
pex_exceptions        3.1       
pex_exceptions        999       	Current Setup
pex_logging           3.1       
pex_logging           999       	Current Setup
pex_policy            3.1       	Current Setup
python                2.5.2     	Current Setup
scons                 3.2       	Current Setup
sconsDistrib          0.98.5    	Current Setup
sconsUtils            3.2       	Current Setup
security              3.1       	Current Setup
swig                  1.3.36+2  	Current Setup
tcltk                 8.5a4     	Current Setup
utils                 3.1       
utils                 999       	Current Setup
wcslib                4.2+3     	Current Setup
xpa                   2.1.7b2   	Current Setup

Change History

comment:1 Changed 10 years ago by ktl

  • Status changed from new to closed
  • Resolution set to wontfix

I believe you need to use g++ 4.2.1 (or at least TR1 headers from there), which I think is included but optional with XCode 3.0. g++ 4.0.0/4.0.1 seems to be buggy (missing the const variant of std::tr1::hashtable::find_node()).

comment:2 Changed 10 years ago by rowen

This appears to be a known bug in g++ http://gcc.gnu.org/ml/gcc-bugs/2005-07/msg03143.html. Note that I originally saw it using XCode 3.1.1 but it is still present using 3.1.2, the current version of XCode (default installation). Choosing the option to install g++ 4.2 may will avoid the problem; I've not tried it since I worry about breaking other things by using a nonstandard configuration.

One question is whether to patch the compiler or if there's some easy way to avoid the bug, e.g. by using boost instead of tr1 for hashtable.

comment:3 Changed 10 years ago by rowen

  • Status changed from closed to new
  • Resolution wontfix deleted

I'm afraid it's not as simple as using the g++ installed by XCode. The problem is that the TR1 headers for 4.2 are not included. I changed symlinks in /usr/bin/g++ and gcc to use 4.2 instead of 4.0 but got the same error as before. I then found this discussion: http://discussions.apple.com/thread.jspa?messageID=8477672

For Mac compatibility we need to stop using tr1 hashtable. Isn't there a way to force using the boost library instead of the built-in tr1 library? Or just use the boost library explicitly for now (is it unordered_map? boost hashtable is intrusive, which I assume tr1 hashtable is not).

comment:4 Changed 10 years ago by ktl

  • Status changed from new to assigned

comment:5 Changed 10 years ago by ktl

  • Cc smm, rhl added
  • Owner changed from ktl to rowen
  • Status changed from assigned to needinfo

The best way around this would seem to be to detect GCC < 4.1 in utils/include/lsst/tr1/unordered_map.h and not try to use the official TR1 header in that case. Does this seem acceptable?

comment:6 Changed 10 years ago by ktl

On second thought, the problem as described above seems to be the lack of proper headers, not the compiler version. Is there some other way to detect which version of the headers are installed?

comment:7 Changed 10 years ago by smm

I think you can check the libstdc++ version with __GLIBCXX__. However, libstdc++ is packaged along with GCC - I'm not sure if it's even possible to use it with other compilers. So distinguishing between the standard library and compiler versions may not buy us much.

Also - should we consider using unordered_map from boost? Falling back to GCC specific extensions in the absence of TR1 is likely to cause problems if we want to support other compilers.

comment:8 Changed 10 years ago by rhl

We should revisit our tr1 hash tables; when we first did this, the boost tr1 implementation was incomplete, but that's not true as of 1.36

As to os/x, I simply installed g++ 4.3 using darwinports.

comment:9 Changed 10 years ago by ktl

  • Owner changed from rowen to ktl
  • Status changed from needinfo to assigned

comment:10 Changed 10 years ago by ktl

  • Status changed from assigned to inTicketWork

I think the simplest fix is to use boost::unordered_map (and import it into the std::tr1 namespace).

comment:11 Changed 10 years ago by ktl

  • Owner changed from ktl to rowen
  • Status changed from inTicketWork to needinfo

Please try utils/tickets/548 r6954 with daf_base trunk r6956 using some consistent g++ on Mac OS X.

comment:12 Changed 10 years ago by rowen

Thanks! utils ticket 548 built just fine for me on MacOS X 10.5.6 using the default compiler (XCode 3.1.2, g++ 4.0.1). (I have not yet tried to build and test anything that uses utils.)

comment:13 Changed 10 years ago by ktl

  • Owner changed from rowen to ktl
  • Status changed from needinfo to assigned

comment:14 Changed 10 years ago by ktl

  • Status changed from assigned to closed
  • Resolution set to fixed

Improved import of boost::unordered_map into std::tr1 namespace and merged to trunk in [6985].

comment:15 Changed 7 years ago by robyn

  • Milestone DC3a Apps Framework deleted

Milestone DC3a Apps Framework deleted

Note: See TracTickets for help on using tickets.