On 15/1/10 22:53, Krzysztof Kosiński wrote:
W dniu 15 stycznia 2010 22:19 użytkownik ~suv <suv-sf@...58...> napisał:
- patching the system gcc/libstdc++-v3 TR1 header file 'hashtable'
I renamed the installed version and copied the one from the gcc 4.0.4 tarball into '/usr/include/c++/4.0.0/tr1/'
- building Inkscape r8979
to rebuild Inkscape I did:
- bzr revert -r 8979
- re-apply local patches
- touch configure.ac (to re-run configure)
- make
The build went through without fatal errors, see attached build log file.
This looks good. I think that if the instructions on how to fix the broken hashtable header are included in the Mac compilation instructions, and a check is put in configure, we can use the non-deprecated tr1::unordered_set. What others think?
Proposal: "instructions on how to fix the hashtable header"
------------------------------------------------------------------------
Q: Inkscape 0.47+devel fails to build on Mac OS X 10.5.8 Leopard (Xcode 3.1.4) with an error in '/usr/include/c++/4.0.0/tr1/hashtable' [3].
A: Apple's default compiler (GNU Compiler Collection 4.0.1) [1] and libstdc++ library (GNU Standard C++ Library v3) have never been fully updated to the last released version of the GCC 4_0 [1] release series. To build Inkscape 0.47+devel on OS X 10.5.8. it is necessary to either patch the installed 'tr1/hashtable' header file of libstdc++-v3 or install a newer version of GCC via MacPorts.
Steps to replace the header file:
1) Download SVN revision 104939 of 'tr1/hashtable' from http://gcc.gnu.org/viewcvs/branches/gcc-4_0-branch/libstdc++-v3/include/tr1/hashtable?view=log
2) Overwrite Apple's version with the downloaded file from SVN revision 104939 and restore file permissions and ownership:
Replace file (assuming the new file is located in ~/Downloads): $ sudo mv /usr/include/c++/4.0.0/tr1/hashtable /usr/include/c++/4.0.0/tr1/hashtable-orig $ sudo cp ~/Downloads/hashtable /usr/include/c++/4.0.0/tr1
Check permissions/ownership: $ ls -l /usr/include/c++/4.0.0/tr1/hashtable Change if needed: $ sudo chmod 644 /usr/include/c++/4.0.0/tr1/hashtable $ sudo chown root:wheel /usr/include/c++/4.0.0/tr1/hashtable
Footnotes:
[1] GCC Links GCC 4.0 Release Series - GNU Project - Free Software Foundation (FSF): http://gcc.gnu.org/gcc-4.0/ Standard C++ Library v3 - GNU Project - Free Software Foundation (FSF): http://gcc.gnu.org/libstdc++/
[2] Apple's gcc/g++ versions known to have this issue: i686-apple-darwin9-g++-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5493) i686-apple-darwin9-g++-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5577)
[3] Full error message:
CXX ui/tool/multi-path-manipulator.o ./ui/tool/control-point.h:118: warning: unused parameter ‘state’ ./ui/tool/control-point.h:119: warning: unused parameter ‘event’ /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 = Inkscape::UI::NodeIteratorInkscape::UI::Node, Value = Inkscape::UI::NodeIteratorInkscape::UI::Node, Allocator = std::allocator<Inkscape::UI::NodeIteratorInkscape::UI::Node >, ExtractKey = Internal::identity<Inkscape::UI::NodeIteratorInkscape::UI::Node >, Equal = std::equal_to<Inkscape::UI::NodeIteratorInkscape::UI::Node >, H1 = std::tr1::hash<Inkscape::UI::NodeIteratorInkscape::UI::Node >, H2 = Internal::mod_range_hashing, H = Internal::default_ranged_hash, RehashPolicy = Internal::prime_rehash_policy, bool cache_hash_code = false, bool mutable_iterators = false, bool unique_keys = true
]’:
ui/tool/multi-path-manipulator.cpp:72: 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 CXX ui/tool/node.o ./ui/tool/control-point.h:118: warning: unused parameter ‘state’ ./ui/tool/control-point.h:119: warning: unused parameter ‘event’ ui/tool/node.cpp:306: warning: unused parameter ‘event’ ui/tool/node.cpp:970: warning: unused parameter ‘event’ /usr/include/c++/4.0.0/tr1/hashtable: In copy constructor ‘std::tr1::hashtable<Key, Value, Allocator, ExtractKey, Equal, H1, H2, H, RehashPolicy, cache_hash_code, mutable_iterators, unique_keys>::hashtable(const std::tr1::hashtable<Key, Value, Allocator, ExtractKey, Equal, H1, H2, H, RehashPolicy, cache_hash_code, mutable_iterators, unique_keys>&) [with Key = Inkscape::UI::SelectableControlPoint*, Value = Inkscape::UI::SelectableControlPoint*, Allocator = std::allocatorInkscape::UI::SelectableControlPoint*, ExtractKey = Internal::identityInkscape::UI::SelectableControlPoint*, Equal = std::equal_toInkscape::UI::SelectableControlPoint*, H1 = std::tr1::hashInkscape::UI::SelectableControlPoint*, H2 = Internal::mod_range_hashing, H = Internal::default_ranged_hash, RehashPolicy = Internal::prime_rehash_policy, bool cache_hash_code = false, bool mutable_iterators = false, bool unique_keys = true]’: /usr/include/c++/4.0.0/tr1/unordered_set:56: instantiated from here /usr/include/c++/4.0.0/tr1/hashtable:1045: error: no matching function for call to ‘std::tr1::hashtable<Inkscape::UI::SelectableControlPoint*, Inkscape::UI::SelectableControlPoint*, std::allocatorInkscape::UI::SelectableControlPoint*, Internal::identityInkscape::UI::SelectableControlPoint*, std::equal_toInkscape::UI::SelectableControlPoint*, std::tr1::hashInkscape::UI::SelectableControlPoint*, Internal::mod_range_hashing, Internal::default_ranged_hash, Internal::prime_rehash_policy, false, false, true>::m_allocate_node(Internal::hash_node<Inkscape::UI::SelectableControlPoint*, false>*&)’ /usr/include/c++/4.0.0/tr1/hashtable:898: note: candidates are: 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>::m_allocate_node(const Value&) [with Key = Inkscape::UI::SelectableControlPoint*, Value = Inkscape::UI::SelectableControlPoint*, Allocator = std::allocatorInkscape::UI::SelectableControlPoint*, ExtractKey = Internal::identityInkscape::UI::SelectableControlPoint*, Equal = std::equal_toInkscape::UI::SelectableControlPoint*, H1 = std::tr1::hashInkscape::UI::SelectableControlPoint*, H2 = Internal::mod_range_hashing, H = Internal::default_ranged_hash, RehashPolicy = Internal::prime_rehash_policy, bool cache_hash_code = false, bool mutable_iterators = false, bool unique_keys = true] /usr/include/c++/4.0.0/tr1/hashtable:1046: error: request for member ‘copy_code_from’ in ‘* tail’, which is of non-class type ‘Internal::hash_node<Inkscape::UI::SelectableControlPoint*, false>*’ make[2]: *** [ui/tool/node.o] Error 1 make[1]: *** [all-recursive] Error 1 make: *** [all] Error 2
------------------------------------------------------------------------
Any comments and proposals to improve the instructions would be very appreciated! Do you think an alternative way to get an updated version of the header file - download the gcc-4.0.4 source tar-ball and extract the newer version 'gcc-4.0.4/libstdc++-v3/include/tr1/hashtable' - should be mentioned as well?
~suv