Bug #39520 Workbench Linux Alpha 1 doesn't build on OpenSuSE 11
Submitted: 18 Sep 2008 15:10 Modified: 14 Feb 2009 13:13
Reporter: Andrey Hristov Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Workbench Severity:S2 (Serious)
Version: OS:Linux (OpenSuSE 11)
Assigned to: Assigned Account CPU Architecture:Any

[18 Sep 2008 15:10] Andrey Hristov
Description:
mdc_canvas_item.cpp: In member function ‘void mdc::CanvasItem::repaint_cached()’:
mdc_canvas_item.cpp:778: error: ‘memset’ was not declared in this scope

How to repeat:
Use the tarball, install and dependencies and hit make
[18 Sep 2008 15:12] Andrey Hristov
Add #include <string.h>
[18 Sep 2008 15:47] Andrey Hristov
mdc_canvas_view_image.cpp - #include <string.h>
mdc_common.cpp - #include <string.h>
mdc_text.cpp - #include <string.h>
grtpp.h - #include <string.h>

mv -f .deps/grtpp_grt.Tpo .deps/grtpp_grt.Plo
/bin/sh ../../../libtool --tag=CXX   --mode=compile ccache g++ -DHAVE_CONFIG_H -I. -I../../.. -I. -pthread -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/libxml2   -I/usr/include/sigc++-2.0 -I/usr/lib/sigc++-2.0/include -I../../../library/utilities/src -I../../../generated -I/usr/local/mysql/include/mysql -g -DDBUG_ON -Wreturn-type -Wtrigraphs -W -Wformat -Wsign-compare -Wunused-function -Wunused-value -Wunused -DDLOAD_JVM     -DENABLE_LUA_MODULES    -Wall -ggdb3 -MT grtpp_helper.lo -MD -MP -MF .deps/grtpp_helper.Tpo -c -o grtpp_helper.lo grtpp_helper.cpp
 ccache g++ -DHAVE_CONFIG_H -I. -I../../.. -I. -pthread -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/libxml2 -I/usr/include/sigc++-2.0 -I/usr/lib/sigc++-2.0/include -I../../../library/utilities/src -I../../../generated -I/usr/local/mysql/include/mysql -g -DDBUG_ON -Wreturn-type -Wtrigraphs -W -Wformat -Wsign-compare -Wunused-function -Wunused-value -Wunused -DDLOAD_JVM -DENABLE_LUA_MODULES -Wall -ggdb3 -MT grtpp_helper.lo -MD -MP -MF .deps/grtpp_helper.Tpo -c grtpp_helper.cpp  -fPIC -DPIC -o .libs/grtpp_helper.o
In file included from /usr/include/c++/4.3/bits/stl_algo.h:66,
                 from /usr/include/c++/4.3/algorithm:67,
                 from grtpp_helper.cpp:7:
/usr/include/c++/4.3/bits/algorithmfwd.h:248:41: error: macro "max" passed 3 arguments, but takes just 2
/usr/include/c++/4.3/bits/algorithmfwd.h:259:41: error: macro "min" passed 3 arguments, but takes just 2
In file included from grtpp_helper.h:4,
                 from grtpp_helper.cpp:2:

Solution: Include <algorithm> before grtpp_helper.h - probably mysql.h is included and it has own version of max and min.

-----------------------------------------
diff/grtlistdiff.cpp: In member function \u2018grt::DiffChange* grt::GrtListDiff::diff(const grt::BaseListRef&, const grt::BaseListRef&, const grt::Omf*)\u2019:
diff/grtlistdiff.cpp:80: error: \u2018auto_ptr\u2019 is not a member of \u2018std\u2019
diff/grtlistdiff.cpp:80: error: expected primary-expression before \u2018>\u2019 token
diff/grtlistdiff.cpp:80: error: \u2018actions_ptr\u2019 was not declared in this scope
d

Solution: #include <memory>

---------------------------------------------------
In file included from /usr/include/c++/4.3/bits/stl_algo.h:66,
                 from /usr/include/c++/4.3/algorithm:67,
                 from myx_sql_tree_item.cpp:9:
/usr/include/c++/4.3/bits/algorithmfwd.h:248:41: error: macro "max" passed 3 arguments, but takes just 2
/usr/include/c++/4.3/bits/algorithmfwd.h:259:41: error: macro "min" passed 3 arguments, but takes just 2
In file included from /usr/include/c++/4.3/bits/stl_algo.h:66,
                 from /usr/include/c++/4.3/algorithm:67,
                 from myx_sql_tree_item.cpp:9:

Solution: #include <algorithm> before #include "myx_sql_tree_item.h"

------------------------------------------
In file included from myx_statement_parser.cpp:10:
my_sys.h:21: warning: unused parameter \u2018unused\u2019
my_sys.h:22: warning: unused parameter \u2018unused\u2019
my_sys.h:23: warning: unused parameter \u2018unused\u2019
my_sys.h: In function \u2018char* my_once_strdup(const char*, int)\u2019:
my_sys.h:24: error: \u2018strdup\u2019 was not declared in this scope
my_sys.h: At global scope:
my_sys.h:24: warning: unused parameter \u2018unused\u2019
my_sys.h: In function \u2018char* my_once_memdup(const char*, unsigned int, int)\u2019:
my_sys.h:25: error: \u2018memcpy\u2019 was not declared in this scope
my_sys.h: At global scope:
my_sys.h:25: warning: unused parameter \u2018unused\u2019
my_sys.h:26: warning: unused parameter \u2018unused\u2019
my_sys.h:28: warning: unused parameter \u2018unused\u2019
my_sys.h: In function \u2018char* get_charsets_dir(char*)\u2019:
my_sys.h:29: error: \u2018strcpy\u2019 was not declared in this scope

Solution: #include <string.h> in myx_statement_parser.cpp
[18 Sep 2008 15:48] Andrey Hristov
simpleform.cpp: In function 'std::string parse_newlines(const std::string&)':
simpleform.cpp:54: error: 'strstr' was not declared in this scope
simpleform.cpp: In member function 'void mforms::SimpleForm::parse_definition(const std::string&)':
simpleform.cpp:90: error: 'strcmp' was not declared in this scope
simpleform.cpp:134: error: 'atoi' was not declared in this scope
simpleform.cpp:159: error: 'atoi' was not declared in this scope

Solution: #include <string.h> and <stdlib.h> in simpleform.cpp
-------------------------------

In file included from src/statement.cpp:3:
src/statement.h:24: error: expected unqualified-id before '&' token
src/statement.h:24: error: expected ',' or '...' before '&' token

Solution: #include <string>
--------------------------------
src/mysql_metadata.h: In member function 'virtual sql::ResultSet* sql::MySQLMetadata::getSchemata(const std::string&)':
src/mysql_metadata.h:80: error: 'auto_ptr' is not a member of 'std'
src/mysql_metadata.h:80: error: expected primary-expression before '>' token

Solution: #include <memory>
-------------------
In file included from src/mysql_resultset.h:4,
                 from src/mysql_prepared_statement.cpp:4:
../../../library/dbc/common/src/resultset.h:96: warning: unused parameter 'row'
../../../library/dbc/common/src/resultset.h: In member function 'virtual int sql::ConstructedResultSet::getInt(int)':
../../../library/dbc/common/src/resultset.h:142: error: 'atoi' was not declared in this scope
../../../library/dbc/common/src/resultset.h: In member function 'virtual double sql::ConstructedResultSet::getDouble(int)':
../../../library/dbc/common/src/resultset.h:161: error: 'atof' was not declared in this scope
.

Solution: #include <stdlib.h> and <string.h> in mysql_resultset.h before <resultset.h>
---------------------------------
src/mysql_statement.cpp: In member function 'virtual int sql::MySQLStatement::executeBatch()':
src/mysql_statement.cpp:38: error: 'for_each' is not a member of 'std'

Solution: #include <algorithm> in mysql_statement.cpp before #include "mysql_statement.h"
---------------------------------
../../backend/grt/tree_model.h: In destructor 'bec::Pool<T>::~Pool()':
../../backend/grt/tree_model.h:66: error: 'for_each' is not a member of 'std'

Solution: #include <algorithm> in tree_model.h
---------------------------------
In file included from common.cpp:2:
common.h: In function 'bool bec::has_prefix(const std::string&, const std::string&)':
common.h:34: error: 'strncmp' was not declared in this scope
common.h: In function 'bool bec::has_suffix(const std::string&, const std::string&)':
common.h:42: error: 'strncmp' was not declared in this scope

Solution: #include <string.h> in common.h
------------------------
../../library/grt/src/grtpp.h: In member function 'bool grt::Ref<grt::internal::Double>::operator==(const grt::DoubleRef&) const':
../../library/grt/src/grtpp.h:533: warning: suggest parentheses around && within ||
../../library/grt/src/grtpp.h: In member function 'bool grt::Ref<grt::internal::String>::operator==(const grt::StringRef&) const':
../../library/grt/src/grtpp.h:640: warning: suggest parentheses around && within ||

Solution: add parentheses, the warning message plagues the compile output
-----------------------
charset_utils.cpp: In function 'std::string toupper(std::string)':
charset_utils.cpp:10: error: 'transform' is not a member of 'std'
charset_utils.cpp: In function 'std::string tolower(std::string)':
charset_utils.cpp:16: error: 'transform' is not a member of 'std'

Solution: Add #include <algorithm> to charset_utils.cpp
----------------------
charset_utils.cpp: In function 'std::string toupper(std::string)':
charset_utils.cpp:11: error: no matching function for call to 'transform(__gnu_cxx::__normal_iterator<char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, __gnu_cxx::__normal_iterator<char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, __gnu_cxx::__normal_iterator<char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, <unresolved overloaded function type>)'
charset_utils.cpp: In function 'std::string tolower(std::string)':
charset_utils.cpp:17: error: no matching function for call to 'transform(__gnu_cxx::__normal_iterator<char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, __gnu_cxx::__normal_iterator<char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, __gnu_cxx::__normal_iterator<char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, <unresolved overloaded function type>)'

Solution: Can't resolve this one, that's why I stop here.
[19 Sep 2008 3:39] Gleidson Echeli
According to [0] and [1], I have added (int(*)(int)) in the std::toupper and std::tolower.

std::string toupper(std::string text)
{
  std::transform(text.begin(), text.end(), text.begin(), (int(*)int))std::toupper);
  return text;
}

std::string tolower(std::string text)
{
  std::transform(text.begin(), text.end(), text.begin(), (int(*)int))std::tolower);
  return text;
}

[0]http://lists.debian.org/debian-gcc/2002/04/msg00092.html
[1]http://www.devx.com/getHelpOn/Article/9702/1954
[19 Sep 2008 7:26] Andrey Hristov
../../library/grt/src/grtpp.h: In member function ‘bool grt::Ref<grt::internal::Double>::operator==(const grt::DoubleRef&) const’:
../../library/grt/src/grtpp.h:533: warning: suggest parentheses around && within ||
../../library/grt/src/grtpp.h: In member function ‘bool grt::Ref<grt::internal::String>::operator==(const grt::StringRef&) const’:
../../library/grt/src/grtpp.h:640: warning: suggest parentheses around && within ||

Solution: #include <algorithm> in the begining before including any mysql headers.
-------------------------------
In file included from /usr/include/c++/4.3/bits/locale_facets_nonio.h:1916,
                 from /usr/include/c++/4.3/locale:48,
                 from mysql_sql_parser_utils.cpp:13:
/usr/include/c++/4.3/bits/locale_facets_nonio.tcc: In member function ‘_InIter std::time_get<_CharT, _InIter>::_M_extract_name(_InIter, _InIter, int&, const _CharT**, size_t, std::ios_base&, std::_Ios_Iostate&) const’:
/usr/include/c++/4.3/bits/locale_facets_nonio.tcc:898: error: expected unqualified-id before ‘(’ token

Solution: Move #include <locale> before including any mysql headers, as they add min/max.
-------------------------------
src/graph_renderer.cpp: In member function ‘void GraphRenderer::recalc_outer_rect()’:
src/graph_renderer.cpp:441: error: ‘INT_MAX’ was not declared in this scope
src/graph_renderer.cpp:443: error: ‘INT_MIN’ was not declared in this scope

Solution: #include <limits.h>
[21 Sep 2008 2:17] Gleidson Echeli
../../db.mysql/backend/db_mysql_sql_export.cpp: At global scope:
../../db.mysql/backend/db_mysql_sql_export.cpp:194: error: explicit template specialization cannot have a storage class
../../db.mysql/backend/db_mysql_sql_export.cpp:213: error: explicit template specialization cannot have a storage class
../../../modules/db.mysql/src/module_db_mysql_shared_code.h:4: warning: ‘std::string get_qualified_schema_object_name(GrtNamedObjectRef)’ defined but not used
make[3]: *** [db_mysql_sql_export.lo] Error 1

Soluction: remove the static keyword in the functions below

template<>
static void name_conversion_hack<ct::Triggers>(
            db_mysql_CatalogRef cat,
            const std::vector<std::string>& filter_item_list,
            std::vector<std::string>& output_list)

template<>
void name_conversion_hack<ct::Triggers>(
            db_mysql_CatalogRef cat,
            const std::vector<std::string>& filter_item_list,
            std::vector<std::string>& output_list)

----------------------
template<>
static void name_conversion_hack<ct::Users>(
            db_mysql_CatalogRef cat,
            const std::vector<std::string>& filter_item_list,
            std::vector<std::string>& output_list)

template<>
void name_conversion_hack<ct::Users>(
            db_mysql_CatalogRef cat,
            const std::vector<std::string>& filter_item_list,
            std::vector<std::string>& output_list)
[15 Feb 2009 0:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".