LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Trying to compile mysqlcc-0.9.8 - please help - FC10 with g++ 4.3.2 (https://www.linuxquestions.org/questions/programming-9/trying-to-compile-mysqlcc-0-9-8-please-help-fc10-with-g-4-3-2-a-703406/)

rylan76 02-09-2009 01:42 PM

Trying to compile mysqlcc-0.9.8 - please help - FC10 with g++ 4.3.2
 
Hi guys

I'm trying to compile mysqlcc-0.9.8 from source but compilation breaks in main.cpp:

Code:

src/main.cpp:93: error: ‘gptr’ was not declared in this scope
src/main.cpp:93: error: expected primary-expression before ‘)’ token
src/main.cpp:94: error: ‘gptr’ was not declared in this scope
src/main.cpp:94: error: expected primary-expression before ‘)’ token
src/main.cpp:97: error: ‘gptr’ was not declared in this scope
src/main.cpp:97: error: expected primary-expression before ‘)’ token
src/main.cpp:98: error: ‘gptr’ was not declared in this scope
src/main.cpp:98: error: expected primary-expression before ‘)’ token
src/main.cpp:101: error: ‘gptr’ was not declared in this scope
src/main.cpp:101: error: expected primary-expression before ‘)’ token
src/main.cpp:101: error: ‘gptr’ was not declared in this scope
src/main.cpp:101: error: expected primary-expression before ‘)’ token
src/main.cpp:105: error: ‘gptr’ was not declared in this scope
src/main.cpp:105: error: expected primary-expression before ‘)’ token
src/main.cpp:105: error: ‘gptr’ was not declared in this scope
src/main.cpp:105: error: expected primary-expression before ‘)’ token
src/main.cpp:110: error: ‘gptr’ was not declared in this scope
src/main.cpp:110: error: expected primary-expression before ‘)’ token
src/main.cpp:111: error: ‘gptr’ was not declared in this scope
src/main.cpp:111: error: expected primary-expression before ‘)’ token
src/main.cpp:113: error: ‘gptr’ was not declared in this scope
src/main.cpp:113: error: expected primary-expression before ‘)’ token
src/main.cpp:114: error: ‘gptr’ was not declared in this scope
src/main.cpp:114: error: expected primary-expression before ‘)’ token
src/main.cpp:118: error: invalid conversion from ‘int’ to ‘void*’
src/main.cpp: In function ‘my_bool get_one_option(int, const my_option*, char*)’:
src/main.cpp:158: warning: deprecated conversion from string constant to ‘char*’
make: *** [tmp/main.o] Error 1
[rylan@StefanLinux mysqlcc-0.9.8]$

The offending lines look like this:

Code:

static struct my_option my_long_options[] =
{
.
.
93: {"connect_timeout", OPT_CONNECT_TIMEOUT, "", (gptr*) &opt_connect_timeout,
  (gptr*) &opt_connect_timeout, 0, GET_ULONG, REQUIRED_ARG, 0, 0, 3600*12, 0,
  0, 1},

  {"select_limit", OPT_SELECT_LIMIT, "", (gptr*) &select_limit,
  (gptr*) &select_limit, 0, GET_ULONG, REQUIRED_ARG, 1000L, 1, ~0L, 0, 1, 0},
 
  {"net_buffer_length", OPT_NET_BUFFER_LENGTH, "",
  (gptr*) &my_net_buffer_length, (gptr*) &my_net_buffer_length, 0, GET_ULONG,
  REQUIRED_ARG, 16384, 1024, 512*1024*1024L, 0, 1024, 0},

  {"max_allowed_packet", OPT_MAX_ALLOWED_PACKET, "",
  (gptr*) &my_max_allowed_packet, (gptr*) &my_max_allowed_packet, 0, GET_ULONG,
  REQUIRED_ARG, 16 *1024L*1024L, 4096, 512*1024L*1024L, 0,
  1024, 0},

  {"local-infile", OPT_LOCAL_INFILE, "Enable/disable LOAD DATA LOCAL INFILE.",
  (gptr*) &opt_local_infile,
  (gptr*) &opt_local_infile, 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},

  {"max_join_size", OPT_MAX_JOIN_SIZE, "", (gptr*) &max_join_size,
  (gptr*) &max_join_size, 0, GET_ULONG, REQUIRED_ARG, 1000000L, 1, ~0L, 0, 1,
  0},

  { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
.
.
.
.
}

I'm in Fedore Core 10, trying to compile with g++ 4.3.2 that came with the distro.

I've looked around and this seems to be a simple semantic issue with g++ 4.3.2. I remember compiling this same program fine with the g++ that came with Fedora Core 6.

Two questions then:

1. What type of pointer must qptr be?

I guess

Code:

static ulong qptr*;
??

2. What are the semantics that are wrong?

How can I specify structure members correctly so g++ 4.3.2 will accept the definition?

This

Code:

93: {"connect_timeout", OPT_CONNECT_TIMEOUT, "", (gptr*) &opt_connect_timeout,
  (gptr*) &opt_connect_timeout, 0, GET_ULONG, REQUIRED_ARG, 0, 0, 3600*12, 0,
  0, 1},

is considered -wrong- by g++ 4.3.2, rejected with

Code:

src/main.cpp:93: error: ‘gptr’ was not declared in this scope
src/main.cpp:93: error: expected primary-expression before ‘)’ token

So how can I fix the
Code:

src/main.cpp:93: error: expected primary-expression before ‘)’ token
error? What must the definition statement look like to have a "primary-expression" beforre "')'" token?

ANY help or ideas appreciated!

Thanks,

rylan76 02-09-2009 02:27 PM

Well I've discovered that this

Code:

static ulong gptr*;

static struct my_option my_long_options[] =
{
.
.
93: {"connect_timeout", OPT_CONNECT_TIMEOUT, "", (gptr*) &opt_connect_timeout,
  (gptr*) &opt_connect_timeout, 0, GET_ULONG, REQUIRED_ARG, 0, 0, 3600*12, 0,
  0, 1},
.
.
.
}

should look like this

Code:

//static ulong gptr*; <<<---- remove this

static struct my_option my_long_options[] =
{
.
.
93: {"connect_timeout", OPT_CONNECT_TIMEOUT, "", (ulong*) &opt_connect_timeout,
  (ulong*) &opt_connect_timeout, 0, GET_ULONG, REQUIRED_ARG, 0, 0, 3600*12, 0,
  0, 1},
.
.
.
}

That solves some of the compile errors under g++ 4.3.2 - on to the rest...

rylan76 02-09-2009 02:33 PM

Fixing some more errors has revealed that this:

Code:

static struct my_option my_long_options[] =
{
.
.
93: {"connect_timeout", OPT_CONNECT_TIMEOUT, "", (ulong*) &opt_connect_timeout,
  (gptr*) &opt_connect_timeout, 0, GET_ULONG, REQUIRED_ARG, 0, 0, 3600*12, 0,
  0, 1},
.
.
.
}

should be

Code:

static struct my_option my_long_options[] =
{
.
.
93: {"connect_timeout", OPT_CONNECT_TIMEOUT, "", (uchar**) &opt_connect_timeout,
  (uchar**) &opt_connect_timeout, 0, GET_ULONG, REQUIRED_ARG, 0, 0, 3600*12, 0,
  0, 1},
.
.
.
}

Almost there...

rylan76 02-09-2009 02:59 PM

No luck.

This

Code:

static struct my_option my_long_options[] =
{
.
.
93: {"connect_timeout", OPT_CONNECT_TIMEOUT, "", (uchar**) &opt_connect_timeout,
  (uchar**) &opt_connect_timeout, 0, GET_ULONG, REQUIRED_ARG, 0, 0, 3600*12, 0,
  0, 1},
.
.
.
} //<<<<--- this is line 118.

Just keeps on giving

Code:

src/main.cpp:118: error: invalid conversion from ‘int’ to ‘void*’
Weird - so the entire structure is now valid, but the compiler breaks on the } on the line closing the structure... DAMN!

Anybody have any ideas?

rylan76 02-09-2009 03:16 PM

Got It - sorta.

Eventually, all that I could do was to comment out the entire section out of the declaration. I guess this gives me a bit of a broken mysqlcc, but it DOES work:

In main.cpp, change

Code:

static my_option my_long_options[] =
{
  {"compress", 'C', "Use compression in server/client protocol.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},

  {"blocking_queries", 'b', "Use blocking queries.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},

  {"syntax", 'y', "Enable syntax highlighting and completion.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},

  {"database", 'd', "Database to use.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},

  {"host", 'h', "Connect to host", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},

  {"user", 'u', "User for login if not current user.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},

  {"password", 'p',
  "Password to use when connecting to server. If password is not given, MySQL Control Center will prompt for the password.",
  0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},

  {"port", 'P', "Port number to use for connection.", 0, 0, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},

#ifndef WIN32
  {"socket", 'S', "Socket file to use for connection.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
 
  {"connection_name", 'c', "This is a synonym for --server.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},

  {"server", 's', "MySQL Control Center connection name.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},

  {"query", 'q', "Open a query window on startup.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},

  {"register", 'r', "Open the 'Register Server' dialog on startup.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
 
  {"help", '?', "Display this help and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0,  0, 0, 0, 0, 0},
 
  {"syntax_file", 'Y', "Syntax file for completion.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},

  {"history_size", 'H', "History size for the query window.", 0, 0, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},

  {"translations_path", 'T', "Path to the directory where MySQL Control Center translations are located.",
  0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, 

  {"plugins_path", 'g', "Path to the directory where MySQL Control Center plugins are located.",
  0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, 

  {"version", 'V', "Print version information and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
 
  {"connect_timeout", OPT_CONNECT_TIMEOUT, "", (uchar**) &opt_connect_timeout,
  (uchar**) &opt_connect_timeout, 0, GET_ULONG, REQUIRED_ARG, 0, 0, 3600*12, 0,
  0, 1},
 
  {"select_limit", OPT_SELECT_LIMIT, "", (uchar**) &select_limit,
  (uchar**) &select_limit, 0, GET_ULONG, REQUIRED_ARG, 1000L, 1, ~0L, 0, 1, 0},
 
  {"net_buffer_length", OPT_NET_BUFFER_LENGTH, "",
  (uchar**) &my_net_buffer_length, (uchar**) &my_net_buffer_length, 0, GET_ULONG,
  REQUIRED_ARG, 16384, 1024, 512*1024*1024L, 0, 1024, 0},

  {"max_allowed_packet", OPT_MAX_ALLOWED_PACKET, "",
  (uchar**) &my_max_allowed_packet, (uchar**) &my_max_allowed_packet, 0, GET_ULONG,
  REQUIRED_ARG, 16 *1024L*1024L, 4096, 512*1024L*1024L, 0,
  1024, 0},

  {"local-infile", OPT_LOCAL_INFILE, "Enable/disable LOAD DATA LOCAL INFILE.",
  (uchar**) &opt_local_infile,
  (uchar**) &opt_local_infile, 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},

  {"max_join_size", OPT_MAX_JOIN_SIZE, "", (uchar**) &max_join_size,
  (uchar**) &max_join_size, 0, GET_ULONG, REQUIRED_ARG, 1000000L, 1, ~0L, 0, 1,
  0},
 
  { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};

to

Code:

static my_option my_long_options[] =
{
  {"compress", 'C', "Use compression in server/client protocol.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},

  {"blocking_queries", 'b', "Use blocking queries.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},

  {"syntax", 'y', "Enable syntax highlighting and completion.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},

  {"database", 'd', "Database to use.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},

  {"host", 'h', "Connect to host", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},

  {"user", 'u', "User for login if not current user.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},

  {"password", 'p',
  "Password to use when connecting to server. If password is not given, MySQL Control Center will prompt for the password.",
  0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},

  {"port", 'P', "Port number to use for connection.", 0, 0, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},

#ifndef WIN32
  {"socket", 'S', "Socket file to use for connection.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
 
  {"connection_name", 'c', "This is a synonym for --server.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},

  {"server", 's', "MySQL Control Center connection name.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},

  {"query", 'q', "Open a query window on startup.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},

  {"register", 'r', "Open the 'Register Server' dialog on startup.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
 
  {"help", '?', "Display this help and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0,  0, 0, 0, 0, 0},
 
  {"syntax_file", 'Y', "Syntax file for completion.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},

  {"history_size", 'H', "History size for the query window.", 0, 0, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},

  {"translations_path", 'T', "Path to the directory where MySQL Control Center translations are located.",
  0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, 

  {"plugins_path", 'g', "Path to the directory where MySQL Control Center plugins are located.",
  0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, 

  {"version", 'V', "Print version information and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
  /*
  {"connect_timeout", OPT_CONNECT_TIMEOUT, "", (uchar**) &opt_connect_timeout,
  (uchar**) &opt_connect_timeout, 0, GET_ULONG, REQUIRED_ARG, 0, 0, 3600*12, 0,
  0, 1},
 
  {"select_limit", OPT_SELECT_LIMIT, "", (uchar**) &select_limit,
  (uchar**) &select_limit, 0, GET_ULONG, REQUIRED_ARG, 1000L, 1, ~0L, 0, 1, 0},
 
  {"net_buffer_length", OPT_NET_BUFFER_LENGTH, "",
  (uchar**) &my_net_buffer_length, (uchar**) &my_net_buffer_length, 0, GET_ULONG,
  REQUIRED_ARG, 16384, 1024, 512*1024*1024L, 0, 1024, 0},

  {"max_allowed_packet", OPT_MAX_ALLOWED_PACKET, "",
  (uchar**) &my_max_allowed_packet, (uchar**) &my_max_allowed_packet, 0, GET_ULONG,
  REQUIRED_ARG, 16 *1024L*1024L, 4096, 512*1024L*1024L, 0,
  1024, 0},

  {"local-infile", OPT_LOCAL_INFILE, "Enable/disable LOAD DATA LOCAL INFILE.",
  (uchar**) &opt_local_infile,
  (uchar**) &opt_local_infile, 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},

  {"max_join_size", OPT_MAX_JOIN_SIZE, "", (uchar**) &max_join_size,
  (uchar**) &max_join_size, 0, GET_ULONG, REQUIRED_ARG, 1000000L, 1, ~0L, 0, 1,
  0},
  */
  { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};

i. e. comment all lines with (uchar**) references, so they don't get compiled and

at last doing THAT made the

Code:

src/main.cpp:118: error: invalid conversion from ‘int’ to ‘void*’
go away, and the program finished compiling and seems to work.

Anybody got any idea why, putting the commented lines above in the declaration, make g++ 4.3.2 fail?

Thanks

tcordes 07-02-2010 12:52 PM

Hi, thanks for your post. My mysqlcc install recently broke with an update to Fedora 12. I got errors about mismatched mysql lib versions. Trying to compile from source I got the same errors as you. You comment solution worked great, I'm not good enough at C++ to try to find the proper solution.

Not sure why no one maintains this program, it's the best quick field editor out there that I've found so far.

knudfl 07-02-2010 01:17 PM

Post 6 , @ tcordes

May be try out the Debian patches for gmysqlcc
( I don't know, if gmysqlcc does the same as mysqlcc.)
http://packages.debian.org/sid/gmysqlcc
→ → [gmysqlcc_0.3.0-2.diff.gz]
http://ftp.de.debian.org/debian/pool....3.0-2.diff.gz
1) zcat gmysqlcc_0.3.0-2.diff.gz | patch -p1
2) patch -p0 debian/patches/dont_override_cflags.patch
3) patch -p0 debian/patches/no_encoding_at_desktop.patch

There is also an SRC.RPM, gmysqlcc-0.3.0-3mdv2009.1.src.rpm
http://ftp.linux.org.tr/mandriva/cur...2009.1.src.rpm
The files have a time stamp 'February 2008'.

-----------------------------------------------
...... And later I found this :
'Niels Horn's Blog' about mysqlcc ( 17 - June 2010 )
http://blog.nielshorn.net/2010/06/ge...mysql-headers/
Includes a patch. ( To use gcc-4.4.4 it seems.)
-----------------------------------------------
..


All times are GMT -5. The time now is 02:34 PM.