← Back to team overview

kicad-developers team mailing list archive

Re: kicad compile error on FreeBSD

 

Also broken on MacOS.  Hashing of enum types (and therefore using them as
unordered_map keys) doesn't work on all compilers until C++14.  Patch
attached that should fix it (tested on MacOS)



On Thu, Feb 22, 2018 at 1:05 PM, Foo Barmann <foo.barmann@xxxxxxxxx> wrote:

> Hi,
> while trying to compile the current kicad sources under FreeBSD 11-stable
> (compiler is clang 4.0) I get the attached errors:
>
> The used WxGtk Packages are:
> py27-wxPython-common-3.0.2.0_4 GUI toolkit for the Python programming
> language
> py27-wxPython30-3.0.2.0_4      GUI toolkit for the Python programming
> language
> wx30-gtk2-3.0.2_7              The wxWidgets GUI toolkit with GTK+ bindings
>
> Error:
> ...
> FAILED: common/CMakeFiles/common.dir/confirm.cpp.o
> /usr/local/libexec/ccache/c++  -DHAVE_STDINT_H -DKICAD_SCRIPTING
> -DKICAD_SCRIPTING_MODULES -DKICAD_SCRIPTING_WXPYTHON -DWXUSINGDLL
> -DWX_COMPATIBILITY -D_FILE_OFFSET_BITS=64 -D_THREAD_SAFE -D__WXGTK__
> -Iinclude -Icommon/. -isystem /usr/local/lib/wx/include/gtk2-unicode-3.0
> -isystem /usr/local/include/wx-3.0 -Icommon/./dialogs -Icommon/./widgets
> -Icommon/./dialog_about -I/usr/local/include/cairo
> -I/usr/local/include/pixman-1 -I/usr/local/include -Icommon/../3d-viewer
> -Icommon/../pcbnew -Icommon/../polygon -I. -I/usr/local/include/python2.7
> -Iscripting -Wall -O2 -pipe -fstack-protector -fno-strict-aliasing
> --std=c++11 -I/wrkdirs/usr/ports/cad/kicad-devel/work/kicad-source-mirror-
> 2e42d5c0065c2c0b4a537f48fca8746c4f61548a/include -I/usr/local/include
> -msse -Wno-unused-local-typedefs -Wno-strict-aliasing -pthread -Wshadow -O2
> -pipe -fstack-protector -fno-strict-aliasing  --std=c++11
> -I/wrkdirs/usr/ports/cad/kicad-devel/work/kicad-source-mirror-
> 2e42d5c0065c2c0b4a537f48fca8746c4f61548a/include -I/usr/local/include
> -msse -fPIC -fvisibility=hidden -fvisibility-inlines-hidden   -std=gnu++11
> -MD -MT common/CMakeFiles/common.dir/confirm.cpp.o -MF
> common/CMakeFiles/common.dir/confirm.cpp.o.d -o
> common/CMakeFiles/common.dir/confirm.cpp.o -c common/confirm.cpp
> In file included from common/confirm.cpp:30:
> In file included from /usr/local/include/wx-3.0/wx/stockitem.h:16:
> In file included from /usr/local/include/wx-3.0/wx/string.h:46:
> In file included from /usr/local/include/wx-3.0/wx/strvararg.h:22:
> In file included from /usr/local/include/wx-3.0/wx/unichar.h:15:
> In file included from /usr/local/include/wx-3.0/wx/stringimpl.h:66:
> In file included from /usr/include/c++/v1/string:470:
> In file included from /usr/include/c++/v1/string_view:171:
> In file included from /usr/include/c++/v1/__string:56:
> In file included from /usr/include/c++/v1/algorithm:637:
> /usr/include/c++/v1/type_traits:1474:38: error: implicit instantiation of
> undefined template 'std::__1::hash<KI_DIALOG::TYPE>'
>     : public integral_constant<bool, __is_empty(_Tp)> {};
>                                      ^
> /usr/include/c++/v1/unordered_map:383:18: note: in instantiation of
> template class 'std::__1::is_empty<std::__1::hash<KI_DIALOG::TYPE> >'
> requested here
>           bool = is_empty<_Hash>::value && !__libcpp_is_final<_Hash>::
> value
>                  ^
> /usr/include/c++/v1/unordered_map:765:13: note: in instantiation of
> default argument for '__unordered_map_hasher<KI_DIALOG::TYPE,
> std::__1::__hash_value_type<KI_DIALOG::TYPE, wxString>,
> std::__1::hash<KI_DIALOG::TYPE> >' required here
>     typedef __unordered_map_hasher<key_type, __value_type, hasher>
> __hasher;
>             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> common/confirm.cpp:72:46: note: in instantiation of template class
> 'std::__1::unordered_map<KI_DIALOG::TYPE, wxString,
> std::__1::hash<KI_DIALOG::TYPE>, std::__1::equal_to<KI_DIALOG::TYPE>,
> std::__1::allocator<std::__1::pair<const KI_DIALOG::TYPE, wxString> > >'
> requested here
>     const std::unordered_map<TYPE, wxString> stdTitle = {
>                                              ^
> /usr/include/c++/v1/type_traits:397:50: note: template is declared here
> template <class _Tp> struct _LIBCPP_TEMPLATE_VIS hash;
>                                                  ^
> In file included from common/confirm.cpp:35:
> In file included from include/html_messagebox.h:34:
> In file included from include/../common/dialogs/
> dialog_display_info_HTML_base.h:14:
> In file included from include/dialog_shim.h:29:
> In file included from include/hashtables.h:103:
> In file included from /usr/include/c++/v1/unordered_map:369:
> /usr/include/c++/v1/__hash_table:1952:21: error: called object type
> 'hasher' (aka 'int') is not a function or function pointer
>     size_t __hash = hash_function()(__k);
>                     ^~~~~~~~~~~~~~~
> /usr/include/c++/v1/__hash_table:1113:16: note: in instantiation of
> function template specialization 'std::__1::__hash_table<std::_
> _1::__hash_value_type<KI_DIALOG::TYPE, wxString>, int,
> std::__1::__unordered_map_equal<KI_DIALOG::TYPE,
> std::__1::__hash_value_type<KI_DIALOG::TYPE, wxString>,
> std::__1::equal_to<KI_DIALOG::TYPE>, true>, std::__1::allocator<std::__1::
> __hash_value_type<KI_DIALOG::TYPE, wxString> >
> >::__emplace_unique_key_args<KI_DIALOG::TYPE, const std::__1::pair<const
> KI_DIALOG::TYPE, wxString> &>' requested here
>         return __emplace_unique_key_args(_NodeTypes::__get_key(__x), __x);
>                ^
> /usr/include/c++/v1/unordered_map:1414:18: note: in instantiation of
> member function 'std::__1::__hash_table<std::__1::__hash_value_type<KI_DIALOG::TYPE,
> wxString>, int, std::__1::__unordered_map_equal<KI_DIALOG::TYPE,
> std::__1::__hash_value_type<KI_DIALOG::TYPE, wxString>,
> std::__1::equal_to<KI_DIALOG::TYPE>, true>, std::__1::allocator<std::__1::
> __hash_value_type<KI_DIALOG::TYPE, wxString> > >::__insert_unique'
> requested here
>         __table_.__insert_unique(*__first);
>                  ^
> /usr/include/c++/v1/unordered_map:1332:5: note: in instantiation of
> function template specialization 'std::__1::unordered_map<KI_DIALOG::TYPE,
> wxString, std::__1::hash<KI_DIALOG::TYPE>, std::__1::equal_to<KI_DIALOG::TYPE>,
> std::__1::allocator<std::__1::pair<const KI_DIALOG::TYPE, wxString> >
> >::insert<const std::__1::pair<const KI_DIALOG::TYPE, wxString> *>'
> requested here
>     insert(__il.begin(), __il.end());
>     ^
> common/confirm.cpp:77:53: note: in instantiation of member function
> 'std::__1::unordered_map<KI_DIALOG::TYPE, wxString,
> std::__1::hash<KI_DIALOG::TYPE>, std::__1::equal_to<KI_DIALOG::TYPE>,
> std::__1::allocator<std::__1::pair<const KI_DIALOG::TYPE, wxString> >
> >::unordered_map' requested here
>     const std::unordered_map<TYPE, wxArtID> icons = {
>                                                     ^
> In file included from common/confirm.cpp:35:
> In file included from include/html_messagebox.h:34:
> In file included from include/../common/dialogs/
> dialog_display_info_HTML_base.h:14:
> In file included from include/dialog_shim.h:29:
> In file included from include/hashtables.h:103:
> In file included from /usr/include/c++/v1/unordered_map:369:
> /usr/include/c++/v1/__hash_table:2203:21: error: called object type
> 'hasher' (aka 'int') is not a function or function pointer
>     size_t __hash = hash_function()(__k);
>                     ^~~~~~~~~~~~~~~
> /usr/include/c++/v1/unordered_map:1114:69: note: in instantiation of
> function template specialization 'std::__1::__hash_table<std::_
> _1::__hash_value_type<KI_DIALOG::TYPE, wxString>, int,
> std::__1::__unordered_map_equal<KI_DIALOG::TYPE,
> std::__1::__hash_value_type<KI_DIALOG::TYPE, wxString>,
> std::__1::equal_to<KI_DIALOG::TYPE>, true>, std::__1::allocator<std::__1::
> __hash_value_type<KI_DIALOG::TYPE, wxString> > >::find<KI_DIALOG::TYPE>'
> requested here
>     const_iterator find(const key_type& __k) const {return
> __table_.find(__k);}
>                                                                     ^
> /usr/include/c++/v1/unordered_map:1468:26: note: in instantiation of
> member function 'std::__1::unordered_map<KI_DIALOG::TYPE, wxString,
> std::__1::hash<KI_DIALOG::TYPE>, std::__1::equal_to<KI_DIALOG::TYPE>,
> std::__1::allocator<std::__1::pair<const KI_DIALOG::TYPE, wxString> >
> >::find' requested here
>     const_iterator __i = find(__k);
>                          ^
> common/confirm.cpp:92:49: note: in instantiation of member function
> 'std::__1::unordered_map<KI_DIALOG::TYPE, wxString,
> std::__1::hash<KI_DIALOG::TYPE>, std::__1::equal_to<KI_DIALOG::TYPE>,
> std::__1::allocator<std::__1::pair<const KI_DIALOG::TYPE, wxString> >
> >::at' requested here
>                 wxArtProvider::GetBitmap( icons.at( aType ),
> wxART_CMN_DIALOG ) );
>                                                 ^
> 3 errors generated.
> [63/1070] /usr/local/libexec/ccache/c++  -DHAVE_STDINT_H -DKICAD_SCRIPTING
> -DKICAD_SCRIPTING_MODULES -DKICAD_SCRIPTING_WXPYTHON -DWXUSINGDLL
> -DWX_COMPATIBILITY -D_FILE_OFFSET_BITS=64 -D_THREAD_SAFE -D__WXGTK__
> -DPCBNEW -Iinclude -Icommon/. -isystem /usr/local/lib/wx/include/gtk2-unicode-3.0
> -isystem /usr/local/include/wx-3.0 -Icommon/./dialogs -Icommon/./widgets
> -Icommon/./dialog_about -I/usr/local/include/cairo
> -I/usr/local/include/pixman-1 -I/usr/local/include -Icommon/../3d-viewer
> -Icommon/../pcbnew -Icommon/../polygon -I. -I/usr/local/include/python2.7
> -Iscripting -Wall -O2 -pipe -fstack-protector -fno-strict-aliasing
> --std=c++11 -I/wrkdirs/usr/ports/cad/kicad-devel/work/kicad-source-mirror-
> 2e42d5c0065c2c0b4a537f48fca8746c4f61548a/include -I/usr/local/include
> -msse -Wno-unused-local-typedefs -Wno-strict-aliasing -pthread -Wshadow -O2
> -pipe -fstack-protector -fno-strict-aliasing  --std=c++11
> -I/wrkdirs/usr/ports/cad/kicad-devel/work/kicad-source-mirror-
> 2e42d5c0065c2c0b4a537f48fca8746c4f61548a/include -I/usr/local/include
> -msse -fPIC -fvisibility=hidden -fvisibility-inlines-hidden   -std=gnu++11
> -MD -MT common/CMakeFiles/pcbcommon.dir/widgets/widget_net_selector.cpp.o
> -MF common/CMakeFiles/pcbcommon.dir/widgets/widget_net_selector.cpp.o.d
> -o common/CMakeFiles/pcbcommon.dir/widgets/widget_net_selector.cpp.o -c
> common/widgets/widget_net_selector.cpp
> [64/1070] /usr/local/libexec/ccache/c++  -DHAVE_STDINT_H -DKICAD_SCRIPTING
> -DKICAD_SCRIPTING_MODULES -DKICAD_SCRIPTING_WXPYTHON -DWXUSINGDLL
> -DWX_COMPATIBILITY -D_FILE_OFFSET_BITS=64 -D_THREAD_SAFE -D__WXGTK__
> -Iinclude -Icommon/. -isystem /usr/local/lib/wx/include/gtk2-unicode-3.0
> -isystem /usr/local/include/wx-3.0 -Icommon/./dialogs -Icommon/./widgets
> -Icommon/./dialog_about -I/usr/local/include/cairo
> -I/usr/local/include/pixman-1 -I/usr/local/include -Icommon/../3d-viewer
> -Icommon/../pcbnew -Icommon/../polygon -I. -I/usr/local/include/python2.7
> -Iscripting -Wall -O2 -pipe -fstack-protector -fno-strict-aliasing
> --std=c++11 -I/wrkdirs/usr/ports/cad/kicad-devel/work/kicad-source-mirror-
> 2e42d5c0065c2c0b4a537f48fca8746c4f61548a/include -I/usr/local/include
> -msse -Wno-unused-local-typedefs -Wno-strict-aliasing -pthread -Wshadow -O2
> -pipe -fstack-protector -fno-strict-aliasing  --std=c++11
> -I/wrkdirs/usr/ports/cad/kicad-devel/work/kicad-source-mirror-
> 2e42d5c0065c2c0b4a537f48fca8746c4f61548a/include -I/usr/local/include
> -msse -fPIC -fvisibility=hidden -fvisibility-inlines-hidden   -std=gnu++11
> -MD -MT common/CMakeFiles/common.dir/draw_frame.cpp.o -MF
> common/CMakeFiles/common.dir/draw_frame.cpp.o.d -o
> common/CMakeFiles/common.dir/draw_frame.cpp.o -c common/draw_frame.cpp
> [65/1070] /usr/local/libexec/ccache/c++  -DHAVE_STDINT_H -DKICAD_SCRIPTING
> -DKICAD_SCRIPTING_MODULES -DKICAD_SCRIPTING_WXPYTHON -DWXUSINGDLL
> -DWX_COMPATIBILITY -D_FILE_OFFSET_BITS=64 -D_THREAD_SAFE -D__WXGTK__
> -Iinclude -Icommon/. -isystem /usr/local/lib/wx/include/gtk2-unicode-3.0
> -isystem /usr/local/include/wx-3.0 -Icommon/./dialogs -Icommon/./widgets
> -Icommon/./dialog_about -I/usr/local/include/cairo
> -I/usr/local/include/pixman-1 -I/usr/local/include -Icommon/../3d-viewer
> -Icommon/../pcbnew -Icommon/../polygon -I. -I/usr/local/include/python2.7
> -Iscripting -Wall -O2 -pipe -fstack-protector -fno-strict-aliasing
> --std=c++11 -I/wrkdirs/usr/ports/cad/kicad-devel/work/kicad-source-mirror-
> 2e42d5c0065c2c0b4a537f48fca8746c4f61548a/include -I/usr/local/include
> -msse -Wno-unused-local-typedefs -Wno-strict-aliasing -pthread -Wshadow -O2
> -pipe -fstack-protector -fno-strict-aliasing  --std=c++11
> -I/wrkdirs/usr/ports/cad/kicad-devel/work/kicad-source-mirror-
> 2e42d5c0065c2c0b4a537f48fca8746c4f61548a/include -I/usr/local/include
> -msse -fPIC -fvisibility=hidden -fvisibility-inlines-hidden   -std=gnu++11
> -MD -MT common/CMakeFiles/common.dir/draw_panel.cpp.o -MF
> common/CMakeFiles/common.dir/draw_panel.cpp.o.d -o
> common/CMakeFiles/common.dir/draw_panel.cpp.o -c common/draw_panel.cpp
> ninja: build stopped: subcommand failed.
> ===> Compilation failed unexpectedly.
> Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
> the maintainer.
> *** Error code 1
>
> Stop.
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp
>
>

Attachment: 0001-Explicitly-define-a-hash-for-KI_DIALOG-TYPE.patch
Description: Binary data


Follow ups

References